using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35.DataAccess; using System.Data; using HRM.BO; using Ease.Core.DataAccess; namespace HRM.DA { internal class DualShiftEmployeeDA { #region Constructor private DualShiftEmployeeDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, DualShiftEmployee item) { string sql = SQLParser.MakeSQL(@"INSERT INTO dbo.DualShiftEmployee ( EmployeeID, Date) VALUES ( %n, %d)", item.ID, item.EmployeeID, item.EffectDate); tc.ExecuteNonQuery(sql); } #endregion #region Update function internal static void Update(TransactionContext tc, DualShiftEmployee item) { tc.ExecuteNonQuery(@"UPDATE DualShiftEmployee SET employeeID = %n, Date = %d WHERE DualShiftEmployeeID=%n", item.EmployeeID, item.EffectDate, item.ID); } #endregion internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM DualShiftEmployee"); } internal static IDataReader Get(TransactionContext tc, DateTime date) { return tc.ExecuteReader("SELECT * FROM DualShiftEmployee where EFFECTDATE = %d ", date); } internal static IDataReader Get(TransactionContext tc, int nID) { return tc.ExecuteReader("SELECT * FROM DualShiftEmployee WHERE DualShiftEmployeeID=%n", nID); } #region Delete function internal static void Delete(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM [DualShiftEmployee] WHERE DualShiftEmployeeID=%n", nID); } #endregion internal static void Save(TransactionContext tc, DataTable dTableNightShift) { foreach (DataRow dRow in dTableNightShift.Rows) { SQLParser.MakeSQL("Insert into DualShiftEmployee(EmployeeID, EffectDate) Values(%n, %d)", Convert.ToInt32(dRow["EmployeeID"].ToString()), dRow["EffectDate"].ToString()); tc.ExecuteNonQuery("Insert into DualShiftEmployee(EmployeeID, EffectDate) Values(%n, %d)", Convert.ToInt32(dRow["EmployeeID"].ToString()), dRow["EffectDate"].ToString()); } } } }