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 ESBDefinitionDA internal class ESBDefinitionDA { #region ESBDefinition #region Constructor private ESBDefinitionDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, ESBDefinition item) { tc.ExecuteNonQuery("INSERT INTO ESBDefinition(ESBID, Description, ServiceLength,PayrollTypeID,Trading,UserID, CreatedBy, CreatedDate, SequenceNo, Status)" + " VALUES(%n, %s, %n,%n,%n,%n, %n, %d, %n, %n)", item.ID.Integer, item.Description, item.MaxServiceLength,item.PayrollTypeID.Integer,item.Trading,item.UserID.Integer, item.CreatedBy.Integer, item.CreatedDate, item.Sequence, item.Status); } #endregion #region Update function internal static void Update(TransactionContext tc, ESBDefinition item) { tc.ExecuteNonQuery("UPDATE ESBDefinition SET code=%s, MaxServiceLength=%n,PayrollTypeID=%n,Trading=%n,UserID=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" + " WHERE ESBID=%n", item.Description, item.MaxServiceLength, item.PayrollTypeID.Integer, item.Trading, item.UserID, item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status, item.ID.Integer); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM ESBDefinition"); } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM ESBDefinition WHERE ESBID=%n", nID.Integer); } internal static IDataReader Get(TransactionContext tc, int nID) { return tc.ExecuteReader("SELECT * FROM ESBDefinition WHERE ESBID=%n", nID); } internal static IDataReader GetByPayrollType(TransactionContext tc, int nID) { return tc.ExecuteReader("SELECT * FROM ESBDefinition WHERE payrolltypeid=%n", nID); } internal static IDataReader GetByPayrollID(TransactionContext tc, int nID) { return tc.ExecuteReader("SELECT * FROM ESBDefinition WHERE PayrollTypeID=%n", nID); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [ESBDefinition] WHERE ESBID=%n", nID.Integer); } #endregion #endregion #region ESBElement #region Insert function internal static void InsertESBElement(TransactionContext tc, ESBElement item) { tc.ExecuteNonQuery("INSERT INTO ESBElement(ESBID,ElementID, ElmentType)" + " VALUES(%n, %n, %n)", item.ESBID.Integer, item.ElementID.Integer,(int)item.ElementType); } #endregion #region Update function internal static void UpdateESBElement(TransactionContext tc, ESBElement item) { tc.ExecuteNonQuery("UPDATE ESBElement SET ESBID=%n,ElementID=%n, ElmentType=%n" + " WHERE ESBID=%n", item.ESBID.Integer, item.ElementID.Integer, item.ElementType, item.ID.Integer); } #endregion #region Get Function internal static IDataReader GetESBElement(TransactionContext tc, int nESBID) { return tc.ExecuteReader("SELECT * FROM ESBElement where esbID=%n ", nESBID); } //internal static IDataReader GetESBElement(TransactionContext tc, ID nID) //{ // return tc.ExecuteReader("SELECT * FROM ESBElement WHERE ESBID=%n", nID.Integer); //} #endregion #region Delete function internal static void DeleteESBElement(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [ESBElement] WHERE ESBID=%n", nID.Integer); } #endregion #endregion #region ESBGrade #region Insert function internal static void InsertESBGrade(TransactionContext tc, ESBGrade item) { tc.ExecuteNonQuery("INSERT INTO ESBGrade(ESBID, GradeID)" + " VALUES(%n, %n)", item.ESBID.Integer, item.GradeID.Integer); } #endregion #region Update function internal static void UpdateESBGrade(TransactionContext tc, ESBGrade item) { tc.ExecuteNonQuery("UPDATE ESBGrade SET GradeID=%n" + " WHERE ESBID=%n", item.GradeID.Integer, item.ESBID.Integer); } #endregion #region Get Function internal static IDataReader GetESBGrade(TransactionContext tc, EnumStatus status) { if (EnumStatus.Active == status || EnumStatus.Inactive==status) { return tc.ExecuteReader("SELECT * FROM ESBGrade"); } else { return tc.ExecuteReader("SELECT * FROM ESBGrade"); } } internal static IDataReader GetESBGrade(TransactionContext tc, int nESBID) { return tc.ExecuteReader("SELECT * FROM ESBGrade where esbID=%n ", nESBID); } internal static IDataReader GetESBGrade(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM ESBGrade WHERE ESBGradeID=%n", nID.Integer); } #endregion #region Delete function internal static void DeleteESBGrade(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [ESBGrade] WHERE ESBID=%n", nID.Integer); } #endregion #endregion #region ESBSlab #region Insert function internal static void InsertESBSlab(TransactionContext tc, ESBSlab item) { tc.ExecuteNonQuery("INSERT INTO ESBSlab(ESBID, CalculNo,DaysToConsider,ServiceYear)" + " VALUES(%n, %n,%n, %n)", item.ESBID.Integer, item.CalculateNo, item.DaysToConsider, item.ServiceYear); } #endregion #region Update function internal static void UpdateESBSlab(TransactionContext tc, ESBSlab item) { tc.ExecuteNonQuery("UPDATE ESBSlab SET ESBID=%n, CalculateNo=%n,DaysToConsider=%n,ServiceYear=%n" + " WHERE ESBID=%n", item.ESBID.Integer, item.CalculateNo, item.DaysToConsider, item.ServiceYear, item.ESBID.Integer); } #endregion #region Get Function internal static IDataReader GetESBSlab(TransactionContext tc, EnumStatus status) { if (EnumStatus.Active == status) { return tc.ExecuteReader("SELECT * FROM ESBSlab where Status=%n", status); } else { return tc.ExecuteReader("SELECT * FROM ESBSlab"); } } internal static IDataReader GetSlabs(TransactionContext tc, int nESBID) { return tc.ExecuteReader("SELECT * FROM ESBSlab where esbID=%n", nESBID); } internal static IDataReader GetESBSlab(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM ESBSlab WHERE ESBID=%n", nID.Integer); } #endregion #region Delete function internal static void DeleteESBSlab(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [ESBSlab] WHERE ESBID=%n", nID.Integer); } #endregion #endregion } #endregion }