EchoTex_Payroll/HRM.DA/DA/PMP/ReplaceEmployeesObjectivesDA.cs

80 lines
2.8 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
{
#region AssignProxyObjectiveSettingDA
internal class AssignProxyObjectiveSettingDA
{
#region Constructor
private AssignProxyObjectiveSettingDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, AssignProxyObjectiveSetting item)
{
tc.ExecuteNonQuery(
"INSERT INTO AssignProxyObjectiveSetting(AssignProxyObjectiveSettingID, RequestedEmployeeID, AssignedForEmployeeID, AssignedToEmployeeID, PMPYearID,GeadeID, IsApproved,AuthorizedType)" +
" VALUES(%n, %n, %n, %n, %n,%n, %b,%n)", item.ID, item.RequestedEmployeeID,
DataReader.GetNullValue(item.AssignedForEmployeeID), DataReader.GetNullValue(item.AssignedToEmployeeID),
item.PMPYearID, DataReader.GetNullValue(item.GeadeID), item.IsApproved, (int)item.AuthorizedType);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, AssignProxyObjectiveSetting item)
{
tc.ExecuteNonQuery(
"UPDATE AssignProxyObjectiveSetting SET RequestedEmployeeID=%n, AssignedForEmployeeID=%n, AssignedToEmployeeID=%n, PMPYearID=%n, IsApproved=%b,GeadeID=%n,ApprovedBy=%n,ApprovalDate=%d,AuthorizedType=%n" +
" WHERE AssignProxyObjectiveSettingID=%n", item.RequestedEmployeeID,
DataReader.GetNullValue(item.AssignedForEmployeeID), DataReader.GetNullValue(item.AssignedToEmployeeID),
item.PMPYearID, item.IsApproved, DataReader.GetNullValue(item.GeadeID),
DataReader.GetNullValue(item.ApprovedBy), item.ApprovalDate, (int)item.AuthorizedType, item.ID);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM AssignProxyObjectiveSetting");
}
internal static IDataReader Get(TransactionContext tc, int nPMPYearID)
{
return tc.ExecuteReader("SELECT * FROM AssignProxyObjectiveSetting where PMPYearID=%n", nPMPYearID);
}
internal static IDataReader Get(TransactionContext tc, int nPMPYearID, int nEmpID)
{
return tc.ExecuteReader(
"SELECT * FROM AssignProxyObjectiveSetting where PMPYearID=%n AND AssignedToEmployeeID=%n AND IsApproved=%b",
nPMPYearID, nEmpID, true);
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int nID)
{
tc.ExecuteNonQuery("DELETE FROM [AssignProxyObjectiveSetting] WHERE AssignProxyObjectiveSettingID=%n", nID);
}
#endregion
}
#endregion
}