using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { internal class ProdBonusWorkScheduleDA { #region Constructor private ProdBonusWorkScheduleDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, ProdBonusWorkSchedule item) { tc.ExecuteNonQuery( "INSERT INTO ProdBonusWorkSchedule(ProdBonusWorkScheduleID, ProdBonusSetupID,ProdBonusLineID,StartDateTime, EndDateTime)" + " VALUES(%n, %n,%n, %D,%D)", item.ID, item.ProdBonusSetupID, item.ProdBonusLineID, item.StartDateTime, item.EndDateTime); } #endregion #region Update function internal static void Update(TransactionContext tc, ProdBonusWorkSchedule item) { //string sql = SQLParser.MakeSQL( // "UPDATE ProdBonusWorkSchedule SET ProdBonusSetupID=%n,ProdBonusLineID=%n, StartDateTime=%D, EndDateTime=%D " + // "WHERE ProdBonusWorkScheduleID=%n", item.ProdBonusSetupID, item.ProdBonusLineID, item.StartDateTime, // item.EndDateTime, item.ID); string sql = SQLParser.MakeSQL( "UPDATE ProdBonusWorkSchedule SET ProdBonusSetupID=%n,ProdBonusLineID=%n, StartDateTime=%D" + "WHERE ProdBonusWorkScheduleID=%n", item.ProdBonusSetupID, item.ProdBonusLineID, item.StartDateTime, item.ID); tc.ExecuteNonQuery(sql); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM ProdBonusWorkSchedule"); } internal static IDataReader GetBySetupId(TransactionContext tc, int nSetupID) { return tc.ExecuteReader("SELECT * FROM ProdBonusWorkSchedule where ProdBonusSetupID=%n", nSetupID); } internal static IDataReader GetByLineID(TransactionContext tc, int lineID) { return tc.ExecuteReader("SELECT * FROM ProdBonusWorkSchedule where ProdBonusLineID=%n", lineID); } internal static IDataReader Get(TransactionContext tc, int nID) { return tc.ExecuteReader("SELECT * FROM ProdBonusWorkSchedule WHERE ProdBonusWorkScheduleID=%n", nID); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM ProdBonusWorkSchedule WHERE ProdBonusWorkScheduleID=%n", nID); } #endregion } }