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 { #region BonusAdjustItemDA internal class BonusAdjustItemDA { #region Constructor private BonusAdjustItemDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, BonusAdjustItem item) { tc.ExecuteNonQuery("INSERT INTO BonusAdjustItem(BonusAdjustItemID, code, name, side, CreatedBy, CreatedDate, SequenceNo, Status,Amount)" + " VALUES(%n, %s, %s, %n, %n, %d, %n, %n,%n)", item.ID.Integer, item.Code, item.Name, item.Side, item.CreatedBy.Integer, item.CreatedDate, item.Sequence, item.Status,item.Amount); } #endregion #region Update function internal static void Update(TransactionContext tc, BonusAdjustItem item) { tc.ExecuteNonQuery("UPDATE BonusAdjustItem SET code=%s, name=%s, side=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n,Amount=%n" + " WHERE BonusAdjustItemID=%n", item.Code, item.Name, item.Side, item.ModifiedBy.Integer, item.ModifiedDate, item.Sequence, item.Status, item.Amount,item.ID.Integer); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc,EnumStatus status) { if (EnumStatus.Active == status || EnumStatus.Inactive == status) { return tc.ExecuteReader("SELECT * FROM BonusAdjustItem where Status=%n Order By SequenceNo", status); } else { return tc.ExecuteReader("SELECT * FROM BonusAdjustItem Order By SequenceNo"); } } internal static IDataReader Get(TransactionContext tc, ID nID) { return tc.ExecuteReader("SELECT * FROM BonusAdjustItem WHERE BonusAdjustItemID=%n", nID.Integer); } #endregion #region Delete function internal static void Delete(TransactionContext tc, ID nID) { tc.ExecuteNonQuery("DELETE FROM [BonusAdjustItem] WHERE BonusAdjustItemID=%n", nID.Integer); } #endregion } #endregion }