EchoTex_Payroll/HRM.DA/DA/PF/PFExceptionDA.cs

96 lines
3.2 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;
using System.Collections.Generic;
namespace HRM.DA
{
#region PFExceptionDA
internal class PFExceptionDA
{
#region Constructor
private PFExceptionDA()
{
}
#endregion
#region Insert function
internal static void Insert(TransactionContext tc, PFException item)
{
tc.ExecuteNonQuery(
"INSERT INTO PFException(PFExceptionID, EmployeeID, EPFPercent, CPFPercent, EPFAmount, CPFAmount, StartDate, CreatedBy, CreatedDate)" +
" VALUES(%n, %n, %n, %n, %n, %n, %d, %n, %d)", item.ID, item.EmployeeID,
DataReader.GetNullValue(item.EPFPercent), DataReader.GetNullValue(item.CPFPercent),
DataReader.GetNullValue(item.EPFAmount), DataReader.GetNullValue(item.CPFAmount), item.StartDate,
item.CreatedBy, item.CreatedDate);
}
#endregion
#region Update function
internal static void Update(TransactionContext tc, PFException item)
{
tc.ExecuteNonQuery(@"UPDATE PFException SET EmployeeID=%n , EPFPercent=%n, CPFPercent=%n,
EPFAmount=%n,CPFAmount=%n, StartDate=%d,
ModifiedBy=%n,ModifiedDate = %d
WHERE PFExceptionID=%n", item.EmployeeID, DataReader.GetNullValue(item.EPFPercent),
DataReader.GetNullValue(item.CPFPercent), DataReader.GetNullValue(item.EPFAmount),
DataReader.GetNullValue(item.CPFAmount), item.StartDate, item.ModifiedBy,
item.ModifiedDate.Value, item.ID);
}
#endregion
#region Get Function
internal static IDataReader Get(TransactionContext tc)
{
return tc.ExecuteReader("SELECT * FROM PFException");
}
internal static DataSet Get(TransactionContext tc, DateTime dDate)
{
DataSet rootDataset = new DataSet();
DataSet tempdataset = new DataSet();
try
{
string sSQL = SQLParser.MakeSQL(@"SELECT distinct(pex.EmployeeID) EmployeeID FROM PFException pex
LEFT OUTER JOIN PFTransaction pt ON pex.EmployeeID = pt.EMPLOYEEID
LEFT OUTER JOIN EMPLOYEE e ON pt.EMPLOYEEID = E.EMPLOYEEID
WHERE pex.StartDate < %d AND e.[STATUS] <> %n", dDate, (int)EnumEmployeeStatus.Live);
tempdataset = tc.ExecuteDataSet(sSQL);
tempdataset.Tables[0].TableName = "EmpPFExp";
rootDataset.Tables.Add(tempdataset.Tables[0].Copy());
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return rootDataset;
}
#endregion
#region Delete function
internal static void Delete(TransactionContext tc, int PFExceptionID)
{
tc.ExecuteNonQuery("DELETE FROM [PFException] WHERE PFExceptionID=%n", PFExceptionID);
}
#endregion
}
#endregion
}