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

84 lines
3.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HRM.BO;
using Ease.Core.DataAccess;
using Ease.Core.Model;
using Ease.Core.Utility;
namespace HRM.DA
{
#region AccessCard Service
[Serializable]
public class AttnParametarizationService : ServiceTemplate, IAttnParametarizationService
{
public AttnParametarizationService() { }
private void MapObject(AttnParametarization oAttnParametarization, DataReader oReader)
{
base.SetObjectID(oAttnParametarization, oReader.GetInt32("AttnParameterID").Value);
oAttnParametarization.MonthStartDay = oReader.GetInt32("MonthStartDay").Value;
oAttnParametarization.ConsicutiveLateForAbsent = oReader.GetInt32("ConsicutiveLateForAbsent").Value;
oAttnParametarization.MonthlyLateForAbsent = oReader.GetInt32("MonthlyLateForAbsent").Value;
oAttnParametarization.AllPresentAllowanceID = oReader.GetInt32("AllPresentAllowanceID");
oAttnParametarization.AllPresentAllowanceID2 = oReader.GetInt32("AllPresentAllowanceID2");
oAttnParametarization.AbsentLeaveID = oReader.GetInt32("AbsentLeaveID");
oAttnParametarization.lateAbsentLeaveID = oReader.GetInt32("lateAbsentLeaveID");
oAttnParametarization.lateAbsentProvLeaveID = oReader.GetInt32("lateAbsentProvLeaveID");
oAttnParametarization.AbsentProvLeaveID = oReader.GetInt32("AbsentProvLeaveID");
oAttnParametarization.IsAbsentDeductionApplicable = oReader.GetBoolean("IsAbsentDeductionApplicable").Value;
oAttnParametarization.lwpLeaveTypeID = oReader.GetInt32("lwpLeaveTypeID");
oAttnParametarization.lwpLeaveID = oReader.GetInt32("lwpLeaveID");
oAttnParametarization.lwpProvLeaveID = oReader.GetInt32("lwpProvLeaveID");
oAttnParametarization.PayrollTypeID = oReader.GetInt32("PayrollTypeID").Value;
oAttnParametarization.AllPresentAllowanceDays = oReader.GetInt32("AllPresentAllowanceDays").Value;
this.SetObjectState(oAttnParametarization, Ease.Core.ObjectState.Saved);
}
protected override T CreateObject<T>(DataReader oReader)
{
AttnParametarization oAttnParametarization = new AttnParametarization();
MapObject(oAttnParametarization, oReader);
return oAttnParametarization as T;
}
protected AttnParametarization CreateObject(DataReader oReader)
{
AttnParametarization oAttnParametarization = new AttnParametarization();
MapObject(oAttnParametarization, oReader);
return oAttnParametarization;
}
#region Service implementation
public AttnParametarization Get(int payrolltypeid)
{
AttnParametarization oAttnParametarization = new AttnParametarization();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader oreader = new DataReader(AttnParametarizationDA.Get(tc, payrolltypeid));
if (oreader.Read())
{
oAttnParametarization = this.CreateObject<AttnParametarization>(oreader);
}
oreader.Close();
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oAttnParametarization;
}
#endregion
}
#endregion
}