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

74 lines
3.1 KiB
C#

using HRM.BO;
using Ease.Core.DataAccess;
using System;
using System.Data;
namespace HRM.DA
{
#region SuccessionRoleDA
internal class SuccessionPlanningDA
{
#region Constructor
private SuccessionPlanningDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, SuccessionPlanning item)
{
string sql = SQLParser.MakeSQL(@"Insert into SuccessionPlanning(SuccessionPlanningID, PlanByUserID, PlanByEmployeeID, EntryDate, SuccessionRoleID, PlanDate,
EmployeeID,EmpDesignationID,SuccessionType,SuccessorOneID,SuccessorOneReadiness,SuccessorTwoID,SuccessorTwoReadiness,Remarks,OursideSuccessor,PlanningYear,CreatedBy,CreationDate) " +
"Values(%n, %n, %n, %d, %n, %d,%n,%n,%n,%n,%n,%n,%n,%s,%s,%d,%n,%d)", item.ID, item.PlanByUserID,item.PlanByEmployeeID, item.EntryDate, item.SuccessionRoleID, item.PlanDate,
item.EmployeeID,item.EmpDesignationID,item.SuccessionType,item.SuccessorOneID,item.SuccessorOneReadiness,item.SuccessorTwoID,item.SuccessorTwoReadiness,
item.Remarks,item.OursideSuccessor,item.PlanningYear,item.CreatedBy,item.CreatedDate);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Update Function
internal static void Update(TransactionContext tc, SuccessionPlanning item)
{
string sql = SQLParser.MakeSQL(@"Update SuccessionPlanning Set PlanByUserID = %n, PlanByEmployeeID = %n, EntryDate = %s, SuccessionRoleID = %n, PlanDate = %d,EmployeeID=%n,EmpDesignationID=%n " +
"SuccessionType=%n,SuccessorOneID=%n,SuccessorOneReadiness=%n,SuccessorTwoID=%n,SuccessorTwoReadiness=%n,Remarks=%s,OursideSuccessor=%s,PlanningYear=%d where SuccessionPlanningID=%n"
, item.ID, item.PlanByUserID, item.EntryDate, item.SuccessionRoleID, item.PlanDate,
item.EmployeeID, item.EmpDesignationID, item.SuccessionType, item.SuccessorOneID, item.SuccessorOneReadiness, item.SuccessorTwoID, item.SuccessorTwoReadiness,
item.Remarks, item.OursideSuccessor, item.PlanningYear,item.ID);
tc.ExecuteNonQuery(sql);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM SuccessionPlanning");
}
internal static IDataReader Get(TransactionContext tc, int id)
{
return tc.ExecuteReader("SELECT * FROM SuccessionPlanning WHERE SuccessionPlanningID=%n", id);
}
#endregion
#region Delete Function
internal static void Delete(TransactionContext tc, int id)
{
tc.ExecuteNonQuery("DELETE FROM SuccessionPlanning WHERE SuccessionPlanningID=%n", id);
}
#endregion
}
#endregion
}