using HRM.BO; using Ease.Core.DataAccess; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HRM.DA { internal class CompanyDA { #region Constructor private CompanyDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, Company item) { tc.ExecuteNonQuery( "INSERT INTO Company(CompanyID, code, description, CreatedBy, CreatedDate, SequenceNo, Status)" + " VALUES(%n, %s, %s, %n, %d, %n, %n)", item.ID, item.Code, item.Name, item.CreatedBy, item.CreatedDate, item.Sequence, item.Status); } #endregion #region Update function internal static void Update(TransactionContext tc, Company item) { tc.ExecuteNonQuery( "UPDATE Company SET code=%s, description=%s, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n" + " WHERE CompanyID=%n", item.Code, item.Name, item.ModifiedBy, item.ModifiedDate, item.Sequence, item.Status, item.ID); } #endregion #region Get Function internal static IDataReader Get(TransactionContext tc, EnumStatus status) { if (EnumStatus.Active == status || EnumStatus.Inactive == status) { return tc.ExecuteReader("SELECT * FROM Company where Status=%n Order By SequenceNo", status); } else { return tc.ExecuteReader("SELECT * FROM Company Order By SequenceNo"); } } internal static IDataReader Get(TransactionContext tc, int nID) { return tc.ExecuteReader("SELECT * FROM Company WHERE CompanyID=%n", nID); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM Company WHERE CompanyID=%n", nID); } #endregion } }