EchoTex_Payroll/HRM.DA/DA/RewardStatement/LTIncentivePlanDA.cs

73 lines
2.7 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 LTIncentivePlanDA
{
#region Insert function
public static void Insert(TransactionContext tc, LTIncentivePlan oItem)
{
string query = SQLParser.MakeSQL(
@"INSERT INTO LTIncentivePlan(LTIncentivePlanID, EmployeeID, LTType, ShareYear, AwardedShare, VestingPercent, Remarks, VestedRemarks, IsVestedDSBS, CreatedBy, CreatedDate)" +
" VALUES(%n, %n, %n, %d, %n, %n, %s, %s, %n, %n, %d)", oItem.ID, oItem.EmpID, oItem.LTType,
oItem.ShareYear, oItem.AwardedShare, oItem.VestingPercent.GetValueOrDefault(), oItem.Remarks,
oItem.VestedRemarks, oItem.IsVestedDSBS.GetValueOrDefault(), oItem.CreatedBy, oItem.CreatedDate);
tc.ExecuteNonQuery(query);
}
#endregion
#region Update function
public static void Update(TransactionContext tc, LTIncentivePlan oItem)
{
tc.ExecuteNonQuery(
"UPDATE LTIncentivePlan SET EmployeeID=%n, LTType=%n, ShareYear=%d, AwardedShare=%n, VestingPercent=%n, Remarks=%s, VestedRemarks=%s, IsVestedDSBS=%n, ModifiedBy=%n, ModifiedDate=%d" +
" WHERE LTIncentivePlanID=%n", oItem.EmpID, oItem.LTType, oItem.ShareYear, oItem.AwardedShare,
oItem.VestingPercent, oItem.Remarks, oItem.VestedRemarks, oItem.IsVestedDSBS, oItem.ModifiedBy,
oItem.ModifiedDate, oItem.ID);
}
#endregion
#region Get function
public static IDataReader GetLTIP(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM LTIncentivePlan WHERE LTType = 1 ORDER BY LTIncentivePlanID");
}
public static IDataReader GetDSBS(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM LTIncentivePlan WHERE LTType = 2 ORDER BY LTIncentivePlanID");
}
public static IDataReader GetLTIP(TransactionContext tc, int empID)
{
return tc.ExecuteReader(
"SELECT * FROM LTIncentivePlan WHERE LTType = 1 AND EmployeeID=%n ORDER BY LTIncentivePlanID", empID);
}
public static IDataReader GetDSBS(TransactionContext tc, int empID)
{
return tc.ExecuteReader(
"SELECT * FROM LTIncentivePlan WHERE LTType = 2 AND EmployeeID=%n ORDER BY LTIncentivePlanID", empID);
}
#endregion
#region Delete function
public static void Delete(TransactionContext tc, int id)
{
tc.ExecuteNonQuery("DELETE FROM LTIncentivePlan WHERE LTIncentivePlanID=%n", id);
}
#endregion
}
}