EchoTex_Payroll/HRM.DA/DA/RewardStatement/RewardStatementParameterDA.cs

103 lines
4.5 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
{
internal class RewardStatementParameterDA
{
#region Constructor
private RewardStatementParameterDA()
{
}
#endregion
#region RewardStatementParameter Methods
internal static IDataReader Get(TransactionContext tc, int rewardStatementParameterID)
{
return tc.ExecuteReader("SELECT * FROM RewardStatementParameter WHERE RewardStatementParameterID=%n",
rewardStatementParameterID);
}
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM RewardStatementParameter");
}
public static IDataReader GetRewardStatementDetails(TransactionContext tc, int rewardStatementID)
{
return tc.ExecuteReader("SELECT * FROM RewardStatementParameter WHERE RewardStatementID=%n",
rewardStatementID);
}
internal static void Insert(TransactionContext tc, RewardStatementParameter item)
{
string sql = SQLParser.MakeSQL(
@"INSERT INTO RewardStatementParameter(RewardStatementParameterID, RewardStatementID, FlatAmount, BasicAmount, GCAmount, IsIndividual, Gender, TopTeam, CreatedBy, CreatedDate)
VALUES(%n, %n, %n, %n, %n, %n, %n, %n, %n, %d)", item.ID,
(EnumRewardStatement)item.RewardStatementID, DataReader.GetNullValue(item.FlatAmount),
DataReader.GetNullValue(item.BasicAmount), DataReader.GetNullValue(item.GCAmount), item.IsIndividual,
(EnumGender)item.Gender, (EnumTopTeam)item.TopTeam, DataReader.GetNullValue(item.CreatedBy),
DataReader.GetNullValue(item.CreatedDate));
tc.ExecuteNonQuery(sql);
}
internal static void Update(TransactionContext tc, RewardStatementParameter item)
{
tc.ExecuteNonQuery(
"UPDATE RewardStatementParameter SET RewardStatementID=%n, FlatAmount=%n, BasicAmount=%n, GCAmount=%n, IsIndividual=%n, Gender=%n, TopTeam=%n, ModifiedBy=%n, ModifiedDate=%d" +
" WHERE RewardStatementParameterID=%n", (EnumRewardStatement)item.RewardStatementID, item.FlatAmount,
item.BasicAmount, item.GCAmount, item.IsIndividual, item.Gender, item.TopTeam,
DataReader.GetNullValue(item.ModifiedBy), DataReader.GetNullValue(item.ModifiedDate), item.ID);
}
internal static void Delete(TransactionContext tc, int rewardStatementParameterID)
{
tc.ExecuteNonQuery("DELETE FROM RewardStatementParameter WHERE RewardStatementParameterID=%n",
rewardStatementParameterID);
}
#endregion
#region RewardStatementParameterDetail Methods
internal static IDataReader GetRewardStatementParameterDetails(TransactionContext tc,
int rewardStatementParameterID)
{
return tc.ExecuteReader("SELECT * FROM RSParameterDetail WHERE RewardStatementParameterID=%n",
rewardStatementParameterID);
}
internal static void InsertRewardStatementParameterDetail(TransactionContext tc,
RewardStatementParameterDetail item)
{
tc.ExecuteNonQuery(
"INSERT INTO RSParameterDetail(RSParameterDetailID , RewardStatementParameterID, GradeDepartmentType, GradeDepartmentID)" +
" VALUES(%n, %n, %n, %n)", item.ID, item.RewardStatementParameterID,
(EnumGradeLocationType)item.GradeLocationType, item.GradeLocationID);
}
internal static void UpdateRewardStatementParameterDetail(TransactionContext tc,
RewardStatementParameterDetail item)
{
tc.ExecuteNonQuery(
"UPDATE RSParameterDetail SET RewardStatementParameterID=%n, GradeDepartmentType=%n, GradeDepartmentID=%n, ModifiedBy=%n, ModifiedDate=%d" +
" WHERE RSParameterDetailID=%n", item.RewardStatementParameterID,
(EnumGradeLocationType)item.GradeLocationType, item.GradeLocationID,
DataReader.GetNullValue(item.ModifiedBy), DataReader.GetNullValue(item.ModifiedDate), item.ID);
}
internal static void DeleteRewardStatementParameterDetail(TransactionContext tc, int rewardStatementParameterID)
{
tc.ExecuteNonQuery("DELETE FROM RSParameterDetail WHERE RewardStatementParameterID=%n",
rewardStatementParameterID);
}
#endregion
}
}