183 lines
6.2 KiB
C#
183 lines
6.2 KiB
C#
|
using Ease.Core.DataAccess;
|
|||
|
using Ease.Core.Model;
|
|||
|
using Ease.Core.Utility;
|
|||
|
using HRM.BO;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace HRM.DA
|
|||
|
{
|
|||
|
public class PFDepositFlowService : ServiceTemplate, IPFDepositFlowService
|
|||
|
{
|
|||
|
public PFDepositFlowService() { }
|
|||
|
|
|||
|
#region MapObject For PFDepositFlow
|
|||
|
private void MapObject(PFDepositFlow pfDepositFlow, DataReader oReader)
|
|||
|
{
|
|||
|
pfDepositFlow.PFDepositFlowID = oReader.GetInt32("PFDepositFlowID",0);
|
|||
|
pfDepositFlow.MonthDate = oReader.GetDateTime("MonthDate").Value;
|
|||
|
pfDepositFlow.ProjectID = oReader.GetInt32("ProjectID", 0);
|
|||
|
pfDepositFlow.OwnContribution = oReader.GetDecimal("OwnContribution").Value;
|
|||
|
pfDepositFlow.CmpContribution = oReader.GetDecimal("CmpContribution").Value;
|
|||
|
pfDepositFlow.LapesForfeiture = oReader.GetDecimal("LapesForfeiture").Value;
|
|||
|
pfDepositFlow.PFloanAsPerPayroll = oReader.GetDecimal("PFloanAsPerPayroll").Value;
|
|||
|
pfDepositFlow.PFLoanInstallmentRefund = oReader.GetDecimal("PFLoanInstallmentRefund").Value;
|
|||
|
pfDepositFlow.PFDeductionRefund = oReader.GetDecimal("PFDeductionRefund").Value;
|
|||
|
pfDepositFlow.PaybleToBDCL = oReader.GetDecimal("PaybleToBDCL").Value;
|
|||
|
pfDepositFlow.AddPFLoanInstallment = oReader.GetDecimal("AddPFLoanInstallment").Value;
|
|||
|
pfDepositFlow.AddPFOutstandigDeduction = oReader.GetDecimal("AddPFOutstandigDeduction").Value;
|
|||
|
pfDepositFlow.CreatedBy = oReader.GetInt32("CreatedBy").Value;
|
|||
|
pfDepositFlow.CreatedDate = oReader.GetDateTime("CreatedDate").Value;
|
|||
|
pfDepositFlow.Prepareby = oReader.GetInt32("Prepareby").GetValueOrDefault();
|
|||
|
pfDepositFlow.PrepareDate = oReader.GetDateTime("PrepareDate").GetValueOrDefault();
|
|||
|
pfDepositFlow.CheckedBy = oReader.GetInt32("CheckedBy");
|
|||
|
pfDepositFlow.CheckedDate = oReader.GetDateTime("CheckedDate").GetValueOrDefault();
|
|||
|
pfDepositFlow.CheckedRemarks = oReader.GetString("CheckedRemarks");
|
|||
|
pfDepositFlow.ApprovedBy = oReader.GetInt32("ApprovedBy");
|
|||
|
pfDepositFlow.ApprovedDate = oReader.GetDateTime("ApprovedDate").GetValueOrDefault(); ;
|
|||
|
pfDepositFlow.ApprovedRemarks = oReader.GetString("ApprovedRemarks");
|
|||
|
}
|
|||
|
|
|||
|
protected override T CreateObject<T>(DataReader oReader)
|
|||
|
{
|
|||
|
PFDepositFlow oPFDepositFlow = new PFDepositFlow();
|
|||
|
MapObject(oPFDepositFlow, oReader);
|
|||
|
return oPFDepositFlow as T;
|
|||
|
}
|
|||
|
#endregion MapObject For PFDepositFlow
|
|||
|
|
|||
|
#region Service Implemantation
|
|||
|
|
|||
|
PFDepositFlow IPFDepositFlowService.Get(int id)
|
|||
|
{
|
|||
|
PFDepositFlow oPFDepositFlow = null;
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
DataReader oreader = new DataReader(PFDepositFlowDA.Get(tc, id));
|
|||
|
if (oreader.Read())
|
|||
|
{
|
|||
|
oPFDepositFlow = this.CreateObject<PFDepositFlow>(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 oPFDepositFlow;
|
|||
|
}
|
|||
|
|
|||
|
public List<PFDepositFlow> GetAll()
|
|||
|
{
|
|||
|
List<PFDepositFlow> PFDepositFlowList = new List<PFDepositFlow>();
|
|||
|
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin();
|
|||
|
|
|||
|
DataReader dr = new DataReader(PFDepositFlowDA.GetAll(tc));
|
|||
|
PFDepositFlowList = this.CreateObjects<PFDepositFlow>(dr);
|
|||
|
dr.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 PFDepositFlowList;
|
|||
|
}
|
|||
|
|
|||
|
public int Save(PFDepositFlow oPFDepositFlow)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
if (oPFDepositFlow.IsNew)
|
|||
|
{
|
|||
|
int id = tc.GenerateID("PFDepositFlow", "PFDepositFlowID");
|
|||
|
base.SetObjectID(oPFDepositFlow, id);
|
|||
|
//if (oPFDepositFlow.Code == string.Empty)
|
|||
|
// oPFDepositFlow.Code = GlobalFunctionService.GetMaxCode(tc, "Asset", "Code");
|
|||
|
PFDepositFlowDA.Insert(tc, oPFDepositFlow);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PFDepositFlowDA.Update(tc, oPFDepositFlow);
|
|||
|
}
|
|||
|
|
|||
|
return oPFDepositFlow.ID;
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
finally
|
|||
|
{
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void Delete(int id)
|
|||
|
{
|
|||
|
TransactionContext tc = null;
|
|||
|
try
|
|||
|
{
|
|||
|
tc = TransactionContext.Begin(true);
|
|||
|
PFDepositFlowDA.Delete(tc, id);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
#region Handle Exception
|
|||
|
|
|||
|
if (tc != null)
|
|||
|
tc.HandleError();
|
|||
|
ExceptionLog.Write(e);
|
|||
|
throw new ServiceException(e.Message, e);
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
finally
|
|||
|
{
|
|||
|
tc.End();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion Service Implemantation
|
|||
|
}
|
|||
|
}
|