EchoTex_Payroll/HRM.DA/DA/HRBasic/NationalityDA.cs

82 lines
2.4 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System.Data;
namespace HRM.DA
{
internal class NationalityDA
{
#region constructor
public NationalityDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, Nationality item)
{
tc.ExecuteNonQuery(
"INSERT INTO NATIONALITY(NATIONALITYID, 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, Nationality item)
{
string query = SQLParser.MakeSQL(
"UPDATE NATIONALITY SET code=%s, description=%s, sequenceno=%n, status=%n, ModifiedBy=%n, modifieddate=%d" +
" WHERE NATIONALITYID=%n", item.Code, item.Description, item.Sequence, item.Status, item.ModifiedBy,
item.ModifiedDate, item.ID);
tc.ExecuteNonQuery(query);
}
#endregion
#region Get function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM NATIONALITY");
}
internal static IDataReader Get(TransactionContext tc, EnumStatus status)
{
if (EnumStatus.Active == status)
{
return tc.ExecuteReader("SELECT * FROM NATIONALITY Where Status=%n Order By SequenceNo", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM NATIONALITY Order By SequenceNo");
}
}
internal static IDataReader Get(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM NATIONALITY WHERE NATIONALITYID=%n", nID);
}
internal static IDataReader Get(TransactionContext tc, string sCode)
{
return tc.ExecuteReader("SELECT * FROM NATIONALITY WHERE Code=%s", sCode);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM NATIONALITY WHERE NATIONALITYID=%n", nID);
}
#endregion
}
}