using Ease.Core.DataAccess; using System.Data; using HRM.BO; namespace HRM.DA { internal class PayScaleDetailDA { #region Constructor private PayScaleDetailDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, PayScaleDetail item) { tc.ExecuteNonQuery( "INSERT INTO PAYSCALEITEM(PAYSCALEITEMID, PAYSCALEID, GRADEID, SCALESERIALNO, ALLOWANCEID, AMOUNT, SLABAMOUNT,StepIncrement)" + " VALUES(%n, %n, %n, %n, %n, %n, %n,%n)", item.ID, item.PayscaleID, item.GradeID, item.StepNo, item.AllowanceID, item.Amount, item.StepAmount, item.StepIncrement); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM PAYSCALEITEM"); } internal static IDataReader Get(TransactionContext tc, int GradeID, int AllowID) { return tc.ExecuteReader( "SELECT * FROM PAYSCALEITEM WHERE GRADEID=%n AND ALLOWANCEID=%n Order By SCALESERIALNO", GradeID, AllowID); } internal static IDataReader GetByGradeID(TransactionContext tc, int GradeID, int payrollTypeID) { return tc.ExecuteReader(@"select * from PayScaleItem where PayScaleID IN(SELECT PayScaleID FROM PayScale Where GradeID IN(Select GradeID from Grades where PayRollTypeID=%n and GradeID=%n) and EffectDate=(select max(EffectDate) from PayScale where GradeID=%n))", payrollTypeID, GradeID, GradeID); //return tc.ExecuteReader("SELECT * FROM PAYSCALEITEM WHERE GRADEID=%n and EffectDate=%d Order By SCALESERIALNO", nGradeID.Integer, Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate); } internal static IDataReader Get(TransactionContext tc, int ID) { return tc.ExecuteReader("SELECT * FROM PAYSCALEITEM WHERE PayScaleItemID=%n", ID); } internal static IDataReader GetByPayScale(TransactionContext tc, int payscaleID) { return tc.ExecuteReader("SELECT * FROM PAYSCALEITEM WHERE PAYSCALEID=%n", payscaleID); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int ID) { tc.ExecuteNonQuery("DELETE FROM PAYSCALEITEM WHERE PayScaleDetailID=%n", ID); } internal static void DeleteByPayScaleID(TransactionContext tc, int PayScaleID) { tc.ExecuteNonQuery("DELETE FROM PAYSCALEITEM WHERE PAYSCALEID=%n", PayScaleID); } #endregion } }