using HRM.BO; using Ease.Core.DataAccess; using System.Data; namespace HRM.DA { #region class ThanaDA internal class ThanaDA { #region Constructor private ThanaDA() { } #endregion #region Insert function internal static void Insert(TransactionContext tc, Thana item) { tc.ExecuteNonQuery( "INSERT INTO THANA(THANAID, CODE, NAME, DISTRICTID, SEQUENCENO, STATUS, CREATEDBY, CREATIONDATE)" + " VALUES(%n, %s, %s, %n, %n, %n, %n, %d)", item.ID, item.Code, item.Name, item.DistrictID, item.Sequence, item.Status, item.CreatedBy, item.CreatedDate); } #endregion #region Update function internal static void Update(TransactionContext tc, Thana item) { tc.ExecuteNonQuery( "UPDATE THANA SET code=%s, name=%s, districtid=%n, sequencenO=%n, status=%n, modifiedby=%n, modifieddate=%d" + " WHERE THANAID=%n", item.Code, item.Name, item.DistrictID, 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 THANA"); } internal static IDataReader Get(TransactionContext tc, EnumStatus status) { if (status == EnumStatus.Regardless) { return tc.ExecuteReader("SELECT * FROM THANA Order By SequenceNo", status); } else { return tc.ExecuteReader("SELECT * FROM THANA Where Status=%n Order By SequenceNo", status); } } internal static IDataReader Get(TransactionContext tc, int nID) { return tc.ExecuteReader("SELECT * FROM THANA WHERE THANAID=%n", nID); } internal static IDataReader Get(TransactionContext tc, string sCode) { return tc.ExecuteReader("SELECT * FROM THANA WHERE Code=%s", sCode); } internal static IDataReader GetByDistID(TransactionContext tc, int nDistID) { return tc.ExecuteReader("SELECT * FROM THANA WHERE DistrictID=%n ORDER BY Name", nDistID); } #endregion #region Delete function internal static void Delete(TransactionContext tc, int nID) { tc.ExecuteNonQuery("DELETE FROM THANA WHERE THANAID=%n", nID); } #endregion } #endregion }