EchoTex_Payroll/HRM.DA/DA/RewardStatement/RewardStatementDA.cs

68 lines
2.5 KiB
C#
Raw 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
{
internal class RewardStatementDA
{
#region Insert function
public static void Insert(TransactionContext tc, RewardStatement oItem)
{
string query = SQLParser.MakeSQL(
@"INSERT INTO RewardStatement(RewardStatementID, RewardStatementType, Name, ComponentType, ComponentID, Description, CreatedBy, CreatedDate)" +
" VALUES(%n, %n, %s, %n, %n, %s, %n, %d)", oItem.ID, (EnumRewardStatement)oItem.RewardStatementType,
oItem.Name, (enumPayrollComponentType)oItem.ComponentType.GetValueOrDefault(),
DataReader.GetNullValue(oItem.ComponentID, 0), oItem.Description, oItem.CreatedBy, oItem.CreatedDate);
tc.ExecuteNonQuery(query);
}
#endregion
#region Update function
public static void Update(TransactionContext tc, RewardStatement oItem)
{
tc.ExecuteNonQuery(
"UPDATE RewardStatement SET RewardStatementType=%n, Name=%s, ComponentType=%n, ComponentID=%n, Description=%s, ModifiedBy=%n, ModifiedDate=%d" +
" WHERE RewardStatementID=%n", (EnumRewardStatement)oItem.RewardStatementType, oItem.Name,
(enumPayrollComponentType)oItem.ComponentType.GetValueOrDefault(),
DataReader.GetNullValue(oItem.ComponentID, 0), oItem.Description, oItem.ModifiedBy, oItem.ModifiedDate,
oItem.ID);
}
#endregion
#region Get function
public static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM RewardStatement ORDER BY RewardStatementType");
}
public static IDataReader Get(TransactionContext tc, EnumRewardStatement rewardStatementType)
{
return tc.ExecuteReader("SELECT * FROM RewardStatement WHERE RewardStatementType=%n",
(EnumRewardStatement)rewardStatementType);
}
public static IDataReader Get(TransactionContext tc, int rewardStatementID)
{
return tc.ExecuteReader("SELECT * FROM RewardStatement WHERE RewardStatementID=%n", rewardStatementID);
}
#endregion
#region Delete function
public static void Delete(TransactionContext tc, int id)
{
tc.ExecuteNonQuery("DELETE FROM RewardStatement WHERE RewardStatementID=%n", id);
}
#endregion
}
}