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

77 lines
2.2 KiB
C#

using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
#region BonusAdjustItemDA
internal class BonusAdjustItemDA
{
#region Constructor
private BonusAdjustItemDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, BonusAdjustItem item)
{
tc.ExecuteNonQuery(
"INSERT INTO BonusAdjustItem(BonusAdjustItemID, code, name, side, CreatedBy, CreatedDate, SequenceNo, Status,Amount)" +
" VALUES(%n, %s, %s, %n, %n, %d, %n, %n,%n)", item.ID, item.Code, item.Name, item.Side, item.CreatedBy,
item.CreatedDate, item.Sequence, item.Status, item.Amount);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, BonusAdjustItem item)
{
tc.ExecuteNonQuery(
"UPDATE BonusAdjustItem SET code=%s, name=%s, side=%n, ModifiedBy=%n, ModifiedDate=%d, SequenceNo=%n, Status=%n,Amount=%n" +
" WHERE BonusAdjustItemID=%n", item.Code, item.Name, item.Side, item.ModifiedBy, item.ModifiedDate,
item.Sequence, item.Status, item.Amount, 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 BonusAdjustItem where Status=%n Order By SequenceNo", status);
}
else
{
return tc.ExecuteReader("SELECT * FROM BonusAdjustItem Order By SequenceNo");
}
}
internal static IDataReader Get(TransactionContext tc, int nID)
{
return tc.ExecuteReader("SELECT * FROM BonusAdjustItem WHERE BonusAdjustItemID=%n", nID);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM BonusAdjustItem WHERE BonusAdjustItemID=%n", nID);
}
#endregion
}
#endregion
}