EchoTex_Payroll/HRM.DA/DA/UnAuthLeave/UnAuthorizeLeaveDA.cs

89 lines
2.8 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
#region UnAuthorizeLeaveDA
internal class UnAuthorizeLeaveDA
{
#region Constructor
private UnAuthorizeLeaveDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, UnAuthorizeLeave item)
{
tc.ExecuteNonQuery(
"INSERT INTO LEAVESUSPENSETYPE(LeaveID, leaveDesc, code, CreatedBy, CreationDate, SequenceNo, Status, PayrollTypeid, LEAVEDESCINBANGLA)" +
" VALUES(%n, %s, %s, %n, %d, %n, %n, %n, %u)", item.ID, item.Name, item.Code, item.CreatedBy, item.CreatedDate,
item.Sequence, item.Status, item.PayrollTypeID, item.NameInBangla);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, UnAuthorizeLeave item)
{
tc.ExecuteNonQuery(
"UPDATE LEAVESUSPENSETYPE SET leaveDesc=%s, code=%s, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n, leavedescinbangla=%u" +
" WHERE LeaveID=%n", item.Name, item.Code, item.ModifiedBy, item.ModifiedDate, item.Sequence,
item.Status, item.NameInBangla, item.ID);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM LEAVESUSPENSETYPE");
}
internal static IDataReader Get(TransactionContext tc, EnumStatus status, int payrollTypeID)
{
if (EnumStatus.Active == status || EnumStatus.Inactive == status)
{
return tc.ExecuteReader(
@"SELECT d.* FROM LEAVESUSPENSETYPE d where d.status=%n and d.PayrollTypeID=%n order by d.leaveDesc", status,
payrollTypeID);
}
else
{
return tc.ExecuteReader(@"SELECT d.* FROM LEAVESUSPENSETYPE d Where d.PayrollTypeID=%n order by d.leaveDesc",
payrollTypeID);
}
}
internal static IDataReader Get(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM LEAVESUSPENSETYPE WHERE LeaveID=%n", nID);
}
internal static IDataReader Get(TransactionContext tc, string sCode)
{
return tc.ExecuteReader("SELECT * FROM LEAVESUSPENSETYPE WHERE Code = %s", sCode);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM LEAVESUSPENSETYPE WHERE LeaveID=%n", nID);
}
#endregion
}
#endregion
}