using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { #region BonusDA internal class BonusParameterDA { #region Constructor private BonusParameterDA() { } #endregion #region Insert function //oBonusParameter.firstProjectMonth = oReader.GetDateTime("firstProjectMonth"); // oBonusParameter.SecondProjectMonth = oReader.GetDateTime("SecondProjectMonth"); internal static void Insert(TransactionContext tc, BonusParameter item) { tc.ExecuteNonQuery( "INSERT INTO BONUSPARAMETER(BonusParameterID, BONUSID, FLATAMOUNT, NOOFBASIC, NOOFDAYS,NOOFGROSS," + "PERCENTOFGROSS,GROSSOFDAYS,PAYROLLTYPEID, NoOfEarnedBasic,ConfimRequired," + " CreatedBy, CreationDate, SequenceNo, Status,NoOfDisbusement,IsFestival," + "EligibleCuttoffDate,IsProrated,IsOverYearCalculation,IsProjectInTaxCalculation," + "TaxProjectInMonth, firstProjectMonth,secondProjectMonth )" + " VALUES(%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%n,%d,%n,%n,%n,%n,%n,%b,%b,%b,%n, %d, %d)", item.ID, item.BonusID, item.FlatAmount, item.NoOfBasic, item.NoOfDays, item.NoOfGross, item.PercentOfGross, item.GrossOfDays, item.PayrollTypeID, item.NoOfEarnedBasic, item.ConfirmeRequired, item.CreatedBy, item.CreatedDate, item.Sequence, item.Status, item.NoOfDisbusement, item.IsFestival, item.EligibleCuttoffDate, item.IsProrated, item.IsOverYearCalculation, item.IsProjectInTaxCalculation, item.TaxProjectInMonth, item.firstProjectMonth, item.secondProjectMonth); } internal static void Insert(TransactionContext tc, BonusParameter.BonusServiceLength item) { tc.ExecuteNonQuery( "INSERT INTO BonusServiceLength(BonusParameterID,LengthOfService,EntitlePercent,BonusSLengthID)" + " VALUES(%n, %n,%n,%n)", item.BonusParameterID, item.LengthOfService, item.EntitlePercent, item.ID); } internal static void Insert(TransactionContext tc, BonusParameter.BonusSlab item) { tc.ExecuteNonQuery( "INSERT INTO BonusSlab(BONUSPARAMETERID,SlabType,SlabAmount,Amount,AmountType,BonusSlabID)" + " VALUES(%n, %n,%n,%n,%n,%n)", item.BonusParameterID, item.SlabType, item.SlabAmount, item.Amount, item.AmountType, item.ID); } internal static void Insert(TransactionContext tc, BonusParameter.BonusParamSalaryItem item) { tc.ExecuteNonQuery( "INSERT INTO BonusParamSalaryItem(BonusParameterID,AllowDeductID,[Percent],SalaryGroupCode,NoOfSalary,BonusParamSalaryItemID)" + " VALUES(%n, %n,%n,%n,%n,%n)", item.BonusParameterID, item.AllowDeductID, item.Percent, item.SalaryGroupCode, item.NoOfSalary, item.ID); } internal static void Insert(TransactionContext tc, BonusParameter.BonusParamAdjustItem item) { tc.ExecuteNonQuery( "INSERT INTO BonusParamAdjustItem(BonusParameterID,Amount,BonusParamAdjustItemID,BonusAdjustItemID)" + " VALUES(%n, %n,%n,%n)", item.BonusParameterID, item.Amount, item.ID, item.BonusAdjustItemID); } internal static void Insert(TransactionContext tc, BonusParameter.BonusParamGrade item) { tc.ExecuteNonQuery( "INSERT INTO BonusParamGrade(BonusParamID,GradeID)" + " VALUES(%n, %n)", item.BonusParamID, item.GradeID); } #endregion #region Update function internal static void Update(TransactionContext tc, BonusParameter item) { tc.ExecuteNonQuery( "UPDATE BONUSPARAMETER SET BONUSID=%n, flatAmount=%n, noOfBasic=%n, noOfDays=%n," + "NOOFGROSS=%n,PERCENTOFGROSS=%n,GROSSOFDAYS=%n, payrollTypeID=%n, noOfEarnedBasic=%n," + "ConfimRequired=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n," + "NoOfDisbusement=%n,IsFestival=%n,EligibleCuttoffDate=%n,IsProrated=%b,IsOverYearCalculation=%b,IsProjectInTaxCalculation=%b,TaxProjectInMonth=%n" + ", firstProjectMonth =%d, secondProjectMonth =%d WHERE BonusParameterID=%n", item.BonusID, item.FlatAmount, item.NoOfBasic, item.NoOfDays, item.NoOfGross, item.PercentOfGross, item.GrossOfDays, item.PayrollTypeID, item.NoOfEarnedBasic, item.ConfirmeRequired, item.ModifiedBy, item.ModifiedDate, item.Sequence, item.Status, item.NoOfDisbusement, item.IsFestival, item.EligibleCuttoffDate, item.IsProrated, item.IsOverYearCalculation, item.IsProjectInTaxCalculation, item.TaxProjectInMonth, item.firstProjectMonth, item.secondProjectMonth, item.ID); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc, EnumStatus status, int payrolltypeid) { if (EnumStatus.Regardless != status) { return tc.ExecuteReader( "SELECT * FROM BONUSPARAMETER Where Status=%n AND PayrollTypeID=%n Order By SequenceNo", status, payrolltypeid); } else { return tc.ExecuteReader("SELECT * FROM BONUSPARAMETER Where PayrollTypeID=%n Order By SequenceNo", payrolltypeid); } } internal static IDataReader Get(TransactionContext tc, int nBonusParamID) { return tc.ExecuteReader("SELECT * FROM BONUSPARAMETER WHERE BONUSPARAMETERID=%n", nBonusParamID); } internal static IDataReader GetByBonusID(TransactionContext tc, int nBonusID, int payrolltypeid) { return tc.ExecuteReader("SELECT * FROM BONUSPARAMETER WHERE BonusID=%n AND PayrollTypeID=%n", nBonusID, payrolltypeid); } internal static IDataReader GetSerLengthByBonus(TransactionContext tc, int nID) { return tc.ExecuteReader("Select * from BonusServiceLength Where BonusParameterID = %n", nID); } internal static IDataReader GetallSerLengthByBonus(TransactionContext tc) { return tc.ExecuteReader("Select * from BonusServiceLength "); } internal static IDataReader GetSlabByBonus(TransactionContext tc, int nID) { return tc.ExecuteReader("Select * from BonusSlab Where BonusParameterID = %n", nID); } internal static IDataReader GetSalaryItemByBonus(TransactionContext tc, int nID) { return tc.ExecuteReader("Select * from BonusParamSalaryItem Where BonusParameterID = %n", nID); } internal static IDataReader GetAdjustItemByBonus(TransactionContext tc, int nID) { return tc.ExecuteReader("Select * from BonusParamAdjustItem Where BonusParameterID = %n", nID); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int nID) { // tc.ExecuteNonQuery("UPDATE BONUSPARAMETER SET CreatedBy=%n,ModifiedBy=%n Where BonusParameterID=%n", User.CurrentUser.ID,User.CurrentUser.ID, nID); tc.ExecuteNonQuery("DELETE FROM BonusParamAdjustItem WHERE BonusParameterID=%n", nID); tc.ExecuteNonQuery("DELETE FROM BonusParamGrade WHERE BonusParamID=%n", nID); tc.ExecuteNonQuery("DELETE FROM BonusServiceLength WHERE BonusParameterID=%n", nID); tc.ExecuteNonQuery("DELETE FROM BonusParamSalaryItem WHERE BonusParameterID=%n", nID); tc.ExecuteNonQuery("DELETE FROM BONUSPARAMETER WHERE BonusParameterID=%n", nID); } internal static void DeleteBonusSLength(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM BonusServiceLength WHERE BonusParameterID=%n", nID); } internal static void DeleteBonusSlab(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM BonusSlab WHERE BonusParameterID=%n", nID); } internal static void DeleteBonusSalaryItem(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM BonusParamSalaryItem WHERE BonusParameterID=%n", nID); } internal static void DeleteBonusAdjustItem(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM BonusParamAdjustItem WHERE BonusParameterID=%n", nID); } internal static void DeleteBonusParamGrade(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM BonusParamGrade WHERE BonusParamID=%n", nID); } internal static IDataReader GetGrades(TransactionContext tc, int nID) { return tc.ExecuteReader("Select * from BonusParamGrade Where BonusParamID = %n", nID); } internal static IDataReader GetUsedGrades(TransactionContext tc, int bonusId) { return tc.ExecuteReader(@"select *from BonusParamGrade where BonusParamID in ( select BonusParameterID from BONUSPARAMETER where bonusId = %n)", bonusId); } #endregion } #endregion }