82 lines
2.4 KiB
C#
82 lines
2.4 KiB
C#
using HRM.BO;
|
|
using Ease.Core.DataAccess;
|
|
using System.Data;
|
|
|
|
namespace HRM.DA
|
|
{
|
|
internal class DistrictDA
|
|
{
|
|
#region Constructor
|
|
|
|
private DistrictDA()
|
|
{
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Insert function
|
|
|
|
internal static void Insert(TransactionContext tc, District item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"INSERT INTO DISTRICT(DISTRICTID, CODE, NAME, DIVISIONID, SEQUENCENO, STATUS, CREATEDBY, CREATIONDATE)" +
|
|
" VALUES(%n, %s, %s, %n, %n, %n, %n, %d)", item.ID, item.Code, item.Name,
|
|
DataReader.GetNullValue(item.DivisionID, 0), item.Sequence, item.Status, item.CreatedBy,
|
|
item.CreatedDate);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Update function
|
|
|
|
internal static void Update(TransactionContext tc, District item)
|
|
{
|
|
tc.ExecuteNonQuery(
|
|
"UPDATE DISTRICT SET code=%s, name=%s, divisionid=%n, sequencenO=%n, status=%n, modifiedby=%n, modifieddate=%d" +
|
|
" WHERE DISTRICTID=%n", item.Code, item.Name, item.DivisionID, 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 DISTRICT");
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
|
|
{
|
|
if (status == EnumStatus.Regardless)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM DISTRICT Order By SequenceNo");
|
|
}
|
|
else
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM DISTRICT Where Status=%n Order By SequenceNo", status);
|
|
}
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, int nID)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM DISTRICT WHERE DISTRICTID=%n", nID);
|
|
}
|
|
|
|
internal static IDataReader Get(TransactionContext tc, string sCode)
|
|
{
|
|
return tc.ExecuteReader("SELECT * FROM DISTRICT WHERE Code=%s", sCode);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Delete function
|
|
|
|
internal static void Delete(TransactionContext tc, int nID)
|
|
{
|
|
tc.ExecuteNonQuery("DELETE FROM DISTRICT WHERE DISTRICTID=%n", nID);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |