using System; using Payroll.BO; using System.Data; using System.Linq; using Ease.CoreV35.Model; using System.Data.SqlClient; using Ease.CoreV35.DataAccess; using System.Collections.Generic; using Ease.CoreV35.DataAccess.SQL; namespace Payroll.Service { internal class ProdBonusAttnDA { #region Constructor private ProdBonusAttnDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, ProdBonusAttn item) { tc.ExecuteNonQuery("INSERT INTO ProdBonusAttn(ProdBonusAttnID, ProdBonusSetupID,BonusScheduleID,ProdBonusLineID,InTime,OutTime,BonusHour, EmployeeID,IsCommon)" + " VALUES(%n, %n, %n,%n,%D,%D,%n,%n,%b)", item.ID.Integer, item.ProdBonusSetupID.Integer, item.BonusScheduleID.Integer, item.ProdBonusLineID.Integer, item.InTime, item.OutTime, item.BonusHour, item.EmployeeID.Integer, item.IsCommon); } #endregion #region Update function internal static void Update(TransactionContext tc, ProdBonusAttn item) { tc.ExecuteNonQuery("UPDATE ProdBonusAttn SET ProdBonusSetupID=%n,BonusScheduleID=%n,ProdBonusLineID=%n,InTime=%d,OutTime=%d,BonusHour=%n, EmployeeID=%n,IsCommon=%b" + "WHERE ProdBonusAttnID=%n", item.ProdBonusSetupID, item.ProdBonusLineID.Integer, item.InTime, item.OutTime, item.BonusHour, item.EmployeeID,item.IsCommon, item.ID.Integer); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM ProdBonusAttn"); } internal static IDataReader Get(TransactionContext tc,int setupID,int scheduleID) { return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND BonusScheduleID=%n", setupID, scheduleID); } internal static IDataReader GetBySetupID(TransactionContext tc, ID setupID) { return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n ", setupID.Integer); } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusAttnID=%n",nID.Integer ); } internal static IDataReader GetByLineID(TransactionContext tc, ID lineID) { return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusLineID=%n ", lineID.Integer); } internal static IDataReader Get(TransactionContext tc, int setupID, DateTime dateTime) { return tc.ExecuteReader("SELECT * FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND CAST(InTime AS date)=%d", setupID, dateTime); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM ProdBonusAttn WHERE ProdBonusAttnID=%n", nID.Integer); } internal static void Delete(TransactionContext tc, ID setupID, DateTime inTime) { tc.ExecuteNonQuery("DELETE FROM ProdBonusAttn WHERE ProdBonusSetupID=%n AND CAST(InTime AS date)=%d", setupID.Integer, inTime); } #endregion } }