using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.Core.Model; using System.Data.SqlClient; using Ease.Core.DataAccess; using Ease.Core.DataAccess.SQL; using HRM.BO; namespace HRM.DA { public class JVSetupCCDA { #region Constructor public JVSetupCCDA() { } #endregion #region Get internal static System.Data.IDataReader Get(TransactionContext tc, int id) { return tc.ExecuteReader("SELECT * FROM JVSetupCC WHERE JVSetupCCID =%n", id); } internal static System.Data.IDataReader Get(Ease.Core.DataAccess.TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM JVSetupCC"); } internal static System.Data.IDataReader GetByJVSetup(TransactionContext tc, int JVSetupID) { return tc.ExecuteReader("SELECT * FROM JVSetupCC Where JVSetupID=%n", JVSetupID); } internal static System.Data.IDataReader GetLatestSetupByJVType(TransactionContext tc, int payrolltypeid, int jvSetupID) { return tc.ExecuteReader(@"SELECT * FROM JVSetupCC 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, JVSetupCC oJVSetupCC) { tc.ExecuteNonQuery("INSERT INTO JVSetupCC(JVSetupCCID, CCID, JVSetupID, CreatedBy, CreationDate)" + " VALUES(%n, %n, %n, %n, %d)", oJVSetupCC.ID, oJVSetupCC.CCID, oJVSetupCC.JVSetupID, DataReader.GetNullValue(oJVSetupCC.CreatedBy), DataReader.GetNullValue(oJVSetupCC.CreatedDate)); } #endregion #region Update internal static void Update(Ease.Core.DataAccess.TransactionContext tc, JVSetupCC oJVSetupCC) { tc.ExecuteNonQuery("UPDATE JVSetupCC SET CCID=%n, JVSetupID=%n,ModifiedBy=%n, ModifiedDate=%d" + " WHERE JVSetupCCID=%n", oJVSetupCC.CCID, oJVSetupCC.JVSetupID, DataReader.GetNullValue(oJVSetupCC.ModifiedBy), DataReader.GetNullValue(oJVSetupCC.ModifiedDate), oJVSetupCC.ID); } #endregion #region Delete internal static void Delete(TransactionContext tc, int id) { tc.ExecuteNonQuery("DELETE FROM JVSetupCC WHERE JVSetupCCID=%n", id); } //Not Used in Any Service internal static void DeleteByJVSetup(TransactionContext tc, int nJVSetupID, int payorlltypeid) { tc.ExecuteNonQuery(@"DELETE FROM JVSetupCC WHERE JVSetupID In(Select JVSetupID from JVSetup where JVSetupID=%n and PayrollTypeID=%n)", nJVSetupID, payorlltypeid); //tc.ExecuteNonQuery("DELETE FROM [JVSetupCC] WHERE JVSetupID=%n", nJVSetupID); } #endregion } }