EchoTex_Payroll/HRM.DA/DA/Basic/ReligionDA.cs

95 lines
3.0 KiB
C#
Raw 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 ReligionDA
{
#region Constructor
private ReligionDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, Religion item)
{
tc.ExecuteNonQuery(
"INSERT INTO Religion(ReligionID, code, name, CreatedBy, CreationDate, SequenceNo, Status, nameinbangla)" +
" VALUES(%n, %s, %s, %n, %d, %n, %n, %u)", item.ID, item.Code, item.Name,
DataReader.GetNullValue(item.CreatedBy), DataReader.GetNullValue(item.CreatedDate), item.Sequence,
item.Status, item.NameInBangla);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, Religion item)
{
tc.ExecuteNonQuery(
"UPDATE Religion SET code=%s, name=%s, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n, nameinbangla=%u" +
" WHERE ReligionID=%n", item.Code, item.Name, DataReader.GetNullValue(item.ModifiedBy),
DataReader.GetNullValue(item.ModifiedDate), item.Sequence, item.Status, item.NameInBangla, 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 Religion Where Status=%n Order By SequenceNo", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM Religion Order By SequenceNo");
}
}
internal static IDataReader Get(TransactionContext tc, EnumStatus status, int payrolltypeid)
{
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
{
return tc.ExecuteReader("SELECT * FROM Religion Where Status=%n and payrolltypeid=%n Order By SequenceNo", status, payrolltypeid);
}
else
{
return tc.ExecuteReader("SELECT * FROM Religion where payrolltypeid=%n Order By SequenceNo", payrolltypeid);
}
}
internal static IDataReader Get(TransactionContext tc, int ID)
{
return tc.ExecuteReader("SELECT * FROM Religion WHERE ReligionID=%n", ID);
}
internal static IDataReader Get(TransactionContext tc, string sCode)
{
return tc.ExecuteReader("SELECT * FROM Religion WHERE Code=%s", sCode);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM Religion");
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int id)
{
tc.ExecuteNonQuery("DELETE FROM Religion WHERE ReligionID=%n", id);
}
#endregion
}
}