using HRM.BO; using Ease.Core.DataAccess; using System.Data; namespace HRM.DA { internal class NominationPurposeDA { #region constructor public NominationPurposeDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, NominationPurpose item) { tc.ExecuteNonQuery( "INSERT INTO NOMINATIONPURPOSE(NOMINATIONPURPOSEID, CODE, DESCRIPTION, SEQUENCENO, STATUS, CREATEDBY, CREATIONDATE)" + " VALUES(%n, %s, %s, %n, %n, %n, %d)", item.ID, item.Code, item.Description, item.Sequence, item.Status, item.CreatedBy, item.CreatedDate); } #endregion #region Update function internal static void Update(TransactionContext tc, NominationPurpose item) { tc.ExecuteNonQuery( "UPDATE NOMINATIONPURPOSE SET code=%s, description=%s, sequencenO=%n, status=%n, modifiedby=%n, modifieddate=%d" + " WHERE NOMINATIONPURPOSEID=%n", item.Code, item.Description, item.Sequence, item.Status, item.ModifiedBy, item.ModifiedDate, item.ID); } #endregion #region Get function internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader("SELECT * FROM NOMINATIONPURPOSE"); } internal static IDataReader Get(TransactionContext tc, EnumStatus status) { if (status == EnumStatus.Regardless) { return tc.ExecuteReader("SELECT * FROM NOMINATIONPURPOSE Order By SequenceNo"); } else { return tc.ExecuteReader("SELECT * FROM NOMINATIONPURPOSE Where Status=%n Order By SequenceNo", status); } } internal static IDataReader Get(TransactionContext tc, int nID) { return tc.ExecuteReader("SELECT * FROM NOMINATIONPURPOSE WHERE NOMINATIONPURPOSEID=%n", nID); } internal static IDataReader Get(TransactionContext tc, string sCode) { return tc.ExecuteReader("SELECT * FROM NOMINATIONPURPOSE WHERE Code=%s", sCode); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM NOMINATIONPURPOSE WHERE NOMINATIONPURPOSEID=%n", nID); } #endregion } }