using Ease.Core.DataAccess; using HRM.BO; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HRM.DA { internal class JVSetupGradeDA { #region Constructor public JVSetupGradeDA() { } #endregion #region Get internal static System.Data.IDataReader Get(TransactionContext tc, int id) { return tc.ExecuteReader("SELECT * FROM JVSetupGrade WHERE JVSetupGradeID =%n", id); } internal static System.Data.IDataReader Get(Ease.Core.DataAccess.TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM JVSetupGrade"); } internal static System.Data.IDataReader GetByJVSetup(TransactionContext tc, int JVSetupID) { return tc.ExecuteReader("SELECT * FROM JVSetupGrade Where JVSetupID=%n", JVSetupID); } internal static System.Data.IDataReader GetLatestSetupByJVType(TransactionContext tc, int payrolltypeid, int jvSetupID) { return tc.ExecuteReader(@"SELECT * FROM JVSetupGrade Where JVSetupID IN ( SELECT JVSetupID FROM JVSetup Where JVTypeID=%n and PayrollTypeID=%n and MonthDate = (" + " select max(MonthDate) from JVSetup where JVTypeID=%n and PayrollTypeID=%n))", jvSetupID, payrolltypeid, jvSetupID, payrolltypeid); } #endregion #region Insert internal static void Insert(Ease.Core.DataAccess.TransactionContext tc, JVSetupGrade oJVSetupGrade) { tc.ExecuteNonQuery("INSERT INTO JVSetupGrade(JVSetupGradeID, GradeID, JVSetupID, CreatedBy, CreationDate)" + " VALUES(%n, %n, %n, %n, %d)", oJVSetupGrade.ID, oJVSetupGrade.GradeID, oJVSetupGrade.JVSetupID, DataReader.GetNullValue(oJVSetupGrade.CreatedBy), DataReader.GetNullValue(oJVSetupGrade.CreatedDate)); } #endregion #region Update internal static void Update(Ease.Core.DataAccess.TransactionContext tc, JVSetupGrade oJVSetupGrade) { tc.ExecuteNonQuery("UPDATE JVSetupGrade SET GradeID=%n, JVSetupID=%n,ModifiedBy=%n, ModifiedDate=%d" + " WHERE JVSetupGradeID=%n", oJVSetupGrade.GradeID, oJVSetupGrade.JVSetupID, DataReader.GetNullValue(oJVSetupGrade.ModifiedBy), DataReader.GetNullValue(oJVSetupGrade.ModifiedDate), oJVSetupGrade.ID); } #endregion #region Delete internal static void Delete(TransactionContext tc, int id) { tc.ExecuteNonQuery("DELETE FROM JVSetupGrade WHERE JVSetupGradeID=%n", id); } //Not Used in Any Service internal static void DeleteByJVSetup(TransactionContext tc, int nJVSetupID, int payorlltypeid) { tc.ExecuteNonQuery(@"DELETE FROM JVSetupGrade WHERE JVSetupID In(Select JVSetupID from JVSetup where JVSetupID=%n and PayrollTypeID=%n)", nJVSetupID, payorlltypeid); //tc.ExecuteNonQuery("DELETE FROM [JVSetupGrade] WHERE JVSetupID=%n", nJVSetupID); } #endregion } }