EchoTex_Payroll/HRM.DA/DA/HRBasic/CountryDA.cs
2024-10-14 10:01:49 +06:00

81 lines
2.3 KiB
C#

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