EchoTex_Payroll/HRM.DA/Service/Attendance/AttnBenefitAuditTrailService.cs
2024-10-14 10:01:49 +06:00

86 lines
3.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Data;
using HRM.BO;
using Ease.Core.Model;
using Ease.Core.DataAccess;
using Ease.Core.Utility;
namespace HRM.DA
{
#region AttnBenifitAuditTrail Service
[Serializable]
public class AttnBenefitAuditTrailService : ServiceTemplate
{
public AttnBenefitAuditTrailService()
{
}
private void MapObject(AttnBenefitAuditTrail oAttnBenefitAuditTrail, DataReader oReader)
{
base.SetObjectID(oAttnBenefitAuditTrail, (oReader.GetInt32("AttnBenefitAuditTrailID").Value));
oAttnBenefitAuditTrail.EmployeeID = oReader.GetInt32("EmployeeID", 0);
oAttnBenefitAuditTrail.SalaryMonth = oReader.GetDateTime("SalaryMonth") == null
? DateTime.MinValue
: oReader.GetDateTime("SalaryMonth").Value;
;
oAttnBenefitAuditTrail.ItemType = (enumPayrollComponentType)oReader.GetInt32("ItemType").Value;
oAttnBenefitAuditTrail.ItemID = oReader.GetInt32("ItemID", 0);
oAttnBenefitAuditTrail.AttnDate = oReader.GetDateTime("AttnDate") == null
? DateTime.MinValue
: oReader.GetDateTime("AttnDate").Value;
;
oAttnBenefitAuditTrail.ColumnName = oReader.GetString("ColumnName");
oAttnBenefitAuditTrail.Value = oReader.GetDouble("Value").Value;
oAttnBenefitAuditTrail.UserID = oReader.GetInt32("UserID", 0);
oAttnBenefitAuditTrail.ApproveTime = oReader.GetDateTime("ApproveTime") == null
? DateTime.MinValue
: oReader.GetDateTime("ApproveTime").Value;
oAttnBenefitAuditTrail.SystemMode = (EnumSystemType)oReader.GetInt32("SystemMode").Value;
oAttnBenefitAuditTrail.SourceModule = oReader.GetString("SourceModule");
this.SetObjectState(oAttnBenefitAuditTrail, Ease.Core.ObjectState.Saved);
}
protected override T CreateObject<T>(DataReader oReader)
{
AttnBenefitAuditTrail oAttnBenefitAuditTrail = new AttnBenefitAuditTrail();
MapObject(oAttnBenefitAuditTrail, oReader);
return oAttnBenefitAuditTrail as T;
}
#region Function
public DataSet GetAttnBenefitAuditTrailData(DateTime date)
{
DataSet allData = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
allData = AttnBenefitAuditTrailDA.GetAttnBenefitAuditTrailData(tc, date);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return allData;
}
#endregion
}
#endregion
}