using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35.DataAccess; using Payroll.BO; using System.Data; using Ease.CoreV35.Model; namespace Payroll.Service.Attendence.DA { #region CardOperationDA internal class CardOperationDA { #region Constructor private CardOperationDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, CardOperation item) { tc.ExecuteNonQuery("INSERT INTO CardOperation(CardOperationID, CardID, CardNumber, CardStatus, EmployeeID, Comments, AssignDate, CreatedBy, CreatedDate)" + " VALUES(%n, %n, %s, %n, %n, %s, %d, %n, %d)", item.ID.Integer, item.CardID.Integer, item.CardNumber, item.Status, item.EmployeeID.Integer, item.Comments, item.AssignDate, item.CreatedBy.Integer, item.CreatedDate); } #endregion #region Update function internal static void Update(TransactionContext tc, CardOperation item) { tc.ExecuteNonQuery("UPDATE CardOperation SET CardID=%n, CardNumber=%s, CardStatus=%n, EmployeeID=%n, Comments=%s, AssignDate=%d, ModifiedBy=%n, ModifiedDate=%d" + " WHERE CardOperationID=%n", item.CardID.Integer, item.CardNumber, item.Status, item.EmployeeID.Integer, item.Comments, item.AssignDate, item.ModifiedBy.Integer, item.ModifiedDate, item.ID.Integer); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM CardOperation"); } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM CardOperation WHERE CardOperationID=%n", nID.Integer); } internal static IDataReader GetByCardID(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM CardOperation WHERE CardID=%n", nID.Integer); } internal static IDataReader GetByEmpIDAndCardID(TransactionContext tc, int empId, int cardId) { return tc.ExecuteReader("SELECT * FROM CardOperation WHERE CardID=%n and EmployeeID=%n", cardId, empId); } internal static IDataReader Get(TransactionContext tc, string CardNumber) { return tc.ExecuteReader("SELECT * FROM CardOperation WHERE CardNumber=%s", CardNumber); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [CardOperation] WHERE CardOperationID=%n", nID); } #endregion } #endregion }