using System; using Payroll.BO; using System.Data; using System.Linq; using Ease.CoreV35.Model; using System.Data.SqlClient; using Ease.CoreV35.DataAccess; using System.Collections.Generic; using Ease.CoreV35.DataAccess.SQL; namespace Payroll.Service { #region class EducationLevelDA internal class EducationLevelDA { #region constructor public EducationLevelDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, EducationLevel item) { tc.ExecuteNonQuery("INSERT INTO EDUCATIONLEVEL(EDUCATIONLEVELID, CODE, DESCRIPTION, EDUCATIONTYPEID, SEQUENCENO, STATUS, CREATEDBY, CREATIONDATE)" + " VALUES(%n, %s, %s, %n, %n, %n, %n, %d)", item.ID.Integer, item.Code, item.Description, item.EducationTypeID.Integer, item.Sequence, item.Status, item.CreatedBy.Integer, item.CreatedDate); } #endregion #region Update function internal static void Update(TransactionContext tc, EducationLevel item) { tc.ExecuteNonQuery("UPDATE EDUCATIONLEVEL SET code=%s, description=%s, educationtypeid=%n, sequencenO=%n, status=%n, modifiedby=%n, modifieddate=%d" + " WHERE EDUCATIONLEVELID=%n", item.Code, item.Description, item.EducationTypeID.Integer, item.Sequence, item.Status, item.ModifiedBy.Integer, item.ModifiedDate, item.ID.Integer); } #endregion #region Get function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM EDUCATIONLEVEL"); } internal static IDataReader Get(TransactionContext tc, EnumStatus status) { if (status == EnumStatus.Regardless) { return tc.ExecuteReader("SELECT * FROM EDUCATIONLEVEL Order By SequenceNo"); } else { return tc.ExecuteReader("SELECT * FROM EDUCATIONLEVEL Where Status=%n Order By SequenceNo", status); } } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM EDUCATIONLEVEL WHERE EDUCATIONLEVELID=%n", nID.Integer); } internal static IDataReader Get(TransactionContext tc, string sCode) { return tc.ExecuteReader("SELECT * FROM EDUCATIONLEVEL WHERE Code=%s", sCode); } internal static IDataReader GetByType(TransactionContext tc, int typeID) { return tc.ExecuteReader("SELECT * FROM EducationLevel where EducationTypeID=%n ORDER BY SEQUENCENO", typeID); } internal static IDataReader GetByLevelID(TransactionContext tc, ID nLevelID) { return tc.ExecuteReader("SELECT * FROM EducationLevel where EducationLevelID=%n", nLevelID.Integer); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [EDUCATIONLEVEL] WHERE EDUCATIONLEVELID=%n", nID.Integer); } #endregion internal static DataSet GetManpower(TransactionContext tc, string sparam) { DataSet rootDataset = new DataSet(); DataSet tempdataset = new DataSet(); try { string query = SQLParser.MakeSQL(@"SELECT d.[DESCRIPTION] Department, edu.[DESCRIPTION] qualification,COUNT(e.EMPLOYEEID) HeadCount FROM EMPLOYEE e,EMPACADEMIC a,EDUCATIONLEVEL edu,department d WHERE e.EMPLOYEEID=a.EMPLOYEEID AND a.EDUCATIONLEVELID=edu.EDUCATIONLEVELID AND e.DEPARTMENTID=d.DEPARTMENTID %q GROUP BY d.[DESCRIPTION],edu.[DESCRIPTION] ORDER BY d.[DESCRIPTION],edu.[DESCRIPTION] ", sparam); tempdataset = tc.ExecuteDataSet(query); tempdataset.Tables[0].TableName = "Manpower"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } } #endregion }