EchoTex_Payroll/HRM.DA/Service/Arrears/ArrearProcessService.cs

947 lines
33 KiB
C#
Raw Normal View History

2024-10-14 10:01:49 +06:00
using System;
using Ease.Core.Model;
using Ease.Core.DataAccess;
using Ease.Core.Utility;
using System.Collections.Generic;
using HRM.BO;
using System.Data;
using Ease.Core;
namespace HRM.DA
{
#region Asset Service
public class ArrearProcessService : ServiceTemplate
{
#region Private constructor and declaration
public ArrearProcessService()
{
}
#endregion
#region MapObject For Arrear
private void MapObject(ArrearProcess oItem, DataReader oReader)
{
// base.SetObjectID(oItem, oReader.GetID("ArrearProcessID"));
base.SetObjectID(oItem, oReader.GetInt32("ArrearProcessID").Value);
oItem.ProcessDescription = oReader.GetString("ProcessDescription");
oItem.ProcessMonth = oReader.GetDateTime("ProcessMonth").Value;
oItem.ProcessDate = oReader.GetDateTime("ProcessDate").Value;
oItem.IsApproved = oReader.GetBoolean("IsApproved").Value;
oItem.ApprovedBy = oReader.GetInt32("ApprovedBy", 0);
oItem.PayrollTypeID = oReader.GetInt32("PayrollTypeID", 0);
oItem.CreatedBy = oReader.GetInt32("CreatedBy", 0);
oItem.CreatedDate = oReader.GetDateTime("CreationDate").Value;
oItem.ModifiedBy = oReader.GetInt32("ModifiedBy", 0);
oItem.ModifiedDate = oReader.GetDateTime("ModifiedDate");
this.SetObjectState(oItem, Ease.Core.ObjectState.Saved);
}
private void MapAPDetailObject(ArrearProcessDetail oItem, DataReader oReader)
{
//base.SetObjectID(oItem, oReader.GetID("ArrearProcessDetailID"));
base.SetObjectID(oItem, oReader.GetInt32("ArrearProcessDetailID").Value);
oItem.ArrearProcessID = oReader.GetInt32("ArrearProcessID", 0);
oItem.EmployeeID = oReader.GetInt32("EmployeeID", 0);
oItem.ProcessMonth = oReader.GetDateTime("ProcessMonth").Value;
oItem.DepartmentID = oReader.GetInt32("DepartmentID").Value;
oItem.DesingnationID = oReader.GetInt32("DesingnationID").Value;
oItem.LocationID = oReader.GetInt32("LocationID").Value;
oItem.BranchID = oReader.GetInt32("BranchID").Value;
oItem.AccountNo = oReader.GetString("AccountNo");
oItem.GradeID = oReader.GetInt32("GradeID").Value;
oItem.ScaleID = oReader.GetInt32("ScaleID").Value;
oItem.BasicSalary = oReader.GetDouble("BasicSalary").Value;
oItem.GrossSalary = oReader.GetDouble("GrossSalary").Value;
oItem.IncrementPercent = oReader.GetDouble("IncrementPercent").Value;
oItem.ArrearEffectFromDate = oReader.GetDateTime("ArrearEffectFromDate").Value;
this.SetObjectState(oItem, Ease.Core.ObjectState.Saved);
}
private void MapAPDetailItemObject(ArrearProcessDetailItem oItem, DataReader oReader)
{
//base.SetObjectID(oItem, oReader.GetID("ArrearProcessDetailItemID"));
base.SetObjectID(oItem, oReader.GetInt32("ArrearProcessDetailItemID").Value);
oItem.ArrearProcessDetailID = oReader.GetInt32("ArrearprocessDetailID", 0);
oItem.ItemType = oReader.GetInt32("ItemType").HasValue
? (enumPayrollComponentType)oReader.GetInt32("ItemType").Value
: enumPayrollComponentType.Allowance;
oItem.ItemID = oReader.GetInt32("ItemID").HasValue ? oReader.GetInt32("ItemID").Value : 0;
oItem.Side = oReader.GetInt32("Side").HasValue
? (EnumArearTranSide)oReader.GetInt32("Side").Value
: EnumArearTranSide.None;
oItem.Description = oReader.GetString("Description");
oItem.CalculatedAmount = oReader.GetDouble("CalculatedAmount").Value;
oItem.ChangedAmount = oReader.GetDouble("ChangedAmount").Value;
oItem.SeriialNo = oReader.GetInt32("SerialNo").Value;
oItem.IsUploaded = oReader.GetBoolean("IsUploaded").Value;
this.SetObjectState(oItem, Ease.Core.ObjectState.Saved);
}
private void MapAPDetailItemMonthlyObject(ArrearProcessDetailItemMonthly oItem, DataReader oReader)
{
//base.SetObjectID(oItem, oReader.GetID("ArrearProcessDetailItemID"));
base.SetObjectID(oItem, oReader.GetInt32("ARRPROSDETAILITEMMONTHLYID").Value);
oItem.ArrearProcessDetailItemID = oReader.GetInt32("ArrearProcessDetailItemID", 0);
oItem.ItemType = oReader.GetInt32("ItemType").HasValue
? (enumPayrollComponentType)oReader.GetInt32("ItemType").Value
: enumPayrollComponentType.Allowance;
oItem.ItemID = oReader.GetInt32("ItemID").HasValue ? oReader.GetInt32("ItemID").Value : 0;
oItem.Side = oReader.GetInt32("Side").HasValue
? (EnumArearTranSide)oReader.GetInt32("Side").Value
: EnumArearTranSide.None;
oItem.Description = oReader.GetString("Description");
oItem.CalculatedAmount = oReader.GetDouble("CalculatedAmount").Value;
oItem.ChangedAmount = oReader.GetDouble("ChangedAmount").Value;
oItem.SeriialNo = oReader.GetInt32("SerialNo").Value;
oItem.SalaryMonth = oReader.GetDateTime("SalaryMonth").Value;
oItem.IsUploaded = oReader.GetBoolean("IsUploaded").Value;
this.SetObjectState(oItem, Ease.Core.ObjectState.Saved);
}
private void MapAPCostDistObject(ArrearProcessCostDist oItem, DataReader oReader)
{
// base.SetObjectID(oItem, oReader.GetID("ArrearProcessCostDistID"));
base.SetObjectID(oItem, oReader.GetInt32("ArrearProcessCostDistID").Value);
oItem.ArrearProcessDetailID = oReader.GetInt32("ArrearprocessDetailID", 0);
oItem.CostcenterID = oReader.GetInt32("CostcenterID", 0);
oItem.InvolvementPercent = oReader.GetDouble("InvolvementPercent").Value;
oItem.Amount = oReader.GetDouble("Amount").Value;
this.SetObjectState(oItem, Ease.Core.ObjectState.Saved);
}
protected override T CreateObject<T>(DataReader oReader)
{
ArrearProcess oArrear = new ArrearProcess();
MapObject(oArrear, oReader);
return oArrear as T;
}
private List<ArrearProcessDetail> CreateAPDetailObjects(DataReader dr)
{
List<ArrearProcessDetail> oAPDetails = new List<ArrearProcessDetail>();
while (dr.Read())
{
ArrearProcessDetail oAPDetail = new ArrearProcessDetail();
oAPDetail = CreateAPDetailObject(dr);
oAPDetails.Add(oAPDetail);
}
return oAPDetails;
}
private ArrearProcessDetail CreateAPDetailObject(DataReader dr)
{
ArrearProcessDetail oAPDetail = new ArrearProcessDetail();
MapAPDetailObject(oAPDetail, dr);
return oAPDetail;
}
private List<ArrearProcessDetailItem> CreateAPDetailItemObjects(DataReader dr)
{
List<ArrearProcessDetailItem> oAPDetailItems = new List<ArrearProcessDetailItem>();
while (dr.Read())
{
ArrearProcessDetailItem oAPDetailItem = new ArrearProcessDetailItem();
oAPDetailItem = CreateAPDetailItemObject(dr);
oAPDetailItems.Add(oAPDetailItem);
}
return oAPDetailItems;
}
private List<ArrearProcessDetailItemMonthly> CreateAPDetailItemMonthlyObjects(DataReader dr)
{
List<ArrearProcessDetailItemMonthly> oAPDetailItemMonthlys = new List<ArrearProcessDetailItemMonthly>();
while (dr.Read())
{
ArrearProcessDetailItemMonthly oAPDetailItemMonthly = new ArrearProcessDetailItemMonthly();
oAPDetailItemMonthly = CreateAPDetailItemMonthlyObject(dr);
oAPDetailItemMonthlys.Add(oAPDetailItemMonthly);
}
return oAPDetailItemMonthlys;
}
private ArrearProcessDetailItem CreateAPDetailItemObject(DataReader dr)
{
ArrearProcessDetailItem oAPDetailItem = new ArrearProcessDetailItem();
MapAPDetailItemObject(oAPDetailItem, dr);
return oAPDetailItem;
}
private ArrearProcessDetailItemMonthly CreateAPDetailItemMonthlyObject(DataReader dr)
{
ArrearProcessDetailItemMonthly oAPDetailItemMonthly = new ArrearProcessDetailItemMonthly();
MapAPDetailItemMonthlyObject(oAPDetailItemMonthly, dr);
return oAPDetailItemMonthly;
}
private List<ArrearProcessCostDist> CreateAPCostDistObjects(DataReader dr)
{
List<ArrearProcessCostDist> oAPCostDists = new List<ArrearProcessCostDist>();
while (dr.Read())
{
ArrearProcessCostDist oAPCostDist = new ArrearProcessCostDist();
oAPCostDist = CreateAPCostDistObject(dr);
oAPCostDists.Add(oAPCostDist);
}
return oAPCostDists;
}
private ArrearProcessCostDist CreateAPCostDistObject(DataReader dr)
{
ArrearProcessCostDist oAPCostDist = new ArrearProcessCostDist();
MapAPCostDistObject(oAPCostDist, dr);
return oAPCostDist;
}
#endregion
#region IArrearProcessService Members
public ArrearProcess Get(int ArrearProcessID)
{
ArrearProcess oArrearProcess = null;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader oreader = new DataReader(ArrearProcessDA.Get(tc, ArrearProcessID));
if (oreader.Read())
{
oArrearProcess = this.CreateObject<ArrearProcess>(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 oArrearProcess;
}
public List<ArrearProcess> GetWithPayrollType(int payrollTypeID)
{
List<ArrearProcess> ArrearProcesses = new List<ArrearProcess>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(ArrearProcessDA.GetWithPayrollType(tc, payrollTypeID));
ArrearProcesses = this.CreateObjects<ArrearProcess>(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 ArrearProcesses;
}
public List<ArrearProcess> Get(DateTime processMonth, int payrollTypeID)
{
List<ArrearProcess> ArrearProcesses = new List<ArrearProcess>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(ArrearProcessDA.Get(tc, processMonth, payrollTypeID));
ArrearProcesses = this.CreateObjects<ArrearProcess>(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 ArrearProcesses;
}
public List<ArrearProcessDetailItem> GetDetailItems(int nEmpID, DateTime processMonth, int payrollTypeID)
{
List<ArrearProcessDetailItem> ArrearProcesses = new List<ArrearProcessDetailItem>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(ArrearProcessDA.GetDetailItems(tc, nEmpID, processMonth, payrollTypeID));
ArrearProcesses = this.CreateAPDetailItemObjects(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 ArrearProcesses;
}
public DataSet GetDetailItems(string sEmpIDs, DateTime processMonth, int ItemType, int ItemID,
int payrollTypeID)
{
DataSet ds = null;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
ds = ArrearProcessDA.GetDetailItems(tc, sEmpIDs, processMonth, ItemType, ItemID, payrollTypeID);
tc.End();
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public List<ArrearProcessDetailItem> GetDetailItems(int arrearProcessId, int nEmpID)
{
List<ArrearProcessDetailItem> ArrearProcesses = new List<ArrearProcessDetailItem>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(ArrearProcessDA.GetDetailItems(tc, arrearProcessId, nEmpID));
ArrearProcesses = this.CreateAPDetailItemObjects(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 ArrearProcesses;
}
public List<ArrearProcessDetail> GetDetails(int arrearProcessId, string nEmpIDs)
{
List<ArrearProcessDetail> ArrearProcesses = new List<ArrearProcessDetail>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(ArrearProcessDA.GetDetails(tc, arrearProcessId, nEmpIDs));
ArrearProcesses = this.CreateAPDetailObjects(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 ArrearProcesses;
}
public List<ArrearProcessDetail> GetDetails(int arrearProcessId, int nEmpID)
{
List<ArrearProcessDetail> ArrearProcesses = new List<ArrearProcessDetail>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(ArrearProcessDA.GetDetails(tc, arrearProcessId, nEmpID));
ArrearProcesses = this.CreateAPDetailObjects(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 ArrearProcesses;
}
public int Save(ArrearProcess oArrearProcess)
{
TransactionContext tc = null;
string savingItem = "";
try
{
tc = TransactionContext.Begin(true);
if (oArrearProcess.IsNew)
{
int id = tc.GenerateID("ArrearProcess", "ArrearProcessID");
base.SetObjectID(oArrearProcess, (id));
ArrearProcessDA.Insert(tc, oArrearProcess);
}
else
{
ArrearProcessDA.Update(tc, oArrearProcess);
}
int ProcessDetailID = tc.GenerateID("ArrearProcessDetail", "ArrearProcessDetailID");
int ProcessDetailItemID = tc.GenerateID("ArrearProcessDetailItem", "ArrearProcessDetailItemID");
int ProcessDetailItemMonthlyID =
tc.GenerateID("ARRPROSDETAILITEMMONTHLY", "ARRPROSDETAILITEMMONTHLYID");
//int ProcessCostDistID = tc.GenerateID("ArrearProcessCostDist", "ArrearProcessCostDistID");
foreach (ArrearProcessDetail apd in oArrearProcess.ArrearProcessDetails)
{
savingItem = "Process Detail";
ProcessDetailID = ProcessDetailID + 1;
base.SetObjectID(apd, (ProcessDetailID));
apd.ArrearProcessID = oArrearProcess.ID;
ArrearProcessDA.Insert(tc, apd);
IncomeTaxService osvr = new IncomeTaxService();
foreach (IncomeTax item in apd.IncomeTaxcoll)
{
IncomeTaxService iis = new IncomeTaxService();
this.SetObjectState(item, ObjectState.New);
iis.Save(tc, item, EnumIncomeTaxDataFrom.SalaryITTempData);
}
//if (apd.IncomeTaxcoll != null && apd.IncomeTaxcoll.Count > 0) osvr.Insert(tc, apd.IncomeTaxcoll, EnumIncomeTaxDataFrom.SalaryITTempData);
foreach (ArrearProcessDetailItem apdi in apd.ArrearProcessDetailItems)
{
savingItem = "Process Detail Item";
ProcessDetailItemID = ProcessDetailItemID + 1;
base.SetObjectID(apdi, (ProcessDetailItemID));
apdi.ArrearProcessDetailID = apd.ID;
// Need to Discuss with Boss
if (oArrearProcess.IsNew)
{
ArrearProcessDA.Insert(tc, apdi);
}
else
{
if (apdi.ItemType == enumPayrollComponentType.IncomeTax)
{
ArrearProcessDA.DeleteTaxDetailItem(tc, apdi.ID, enumPayrollComponentType.IncomeTax);
ArrearProcessDA.Insert(tc, apdi);
}
}
foreach (ArrearProcessDetailItemMonthly apdim in apdi.ArrearProcessDetailItemMonthlys)
{
savingItem = "Process Detail Item Monthly";
ProcessDetailItemMonthlyID = ProcessDetailItemMonthlyID + 1;
base.SetObjectID(apdim, (ProcessDetailItemMonthlyID));
apdim.ArrearProcessDetailItemID = apdi.ID;
ArrearProcessDA.Insert(tc, apdim);
}
}
//foreach (ArrearProcessCostDist apcd in apd.ArrearProcessCostDists)
//{
// ProcessCostDistID = ProcessCostDistID +1;
// base.SetObjectID(apcd, (ProcessCostDistID));
// apcd.ArrearProcessDetailID = apd.ID;
// ArrearProcessDA.Insert(tc, apcd);
//}
}
return oArrearProcess.ID;
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message + " Error From " + savingItem, e);
#endregion
}
finally
{
tc.End();
}
}
public int SaveDetailItem(List<ArrearProcessDetailItem> ArrearProcessDetailItems)
{
TransactionContext tc = null;
try
{
foreach (ArrearProcessDetailItem apdi in ArrearProcessDetailItems)
{
List<ArrearProcessDetailItemMonthly> pim = apdi.ArrearProcessDetailItemMonthlys;
}
tc = TransactionContext.Begin(true);
foreach (ArrearProcessDetailItem apdi in ArrearProcessDetailItems)
{
if (apdi.IsNew)
{
int id = tc.GenerateID("ArrearProcessDetailItem", "ArrearProcessDetailItemID");
base.SetObjectID(apdi, (id));
ArrearProcessDA.DeleteDetailItemMonthlyByDetailID(tc, apdi.ArrearProcessDetailID, apdi.ItemType,
apdi.ItemID);
ArrearProcessDA.DeleteDetailItemByDetailID(tc, apdi.ArrearProcessDetailID, apdi.ItemType,
apdi.ItemID);
ArrearProcessDA.Insert(tc, apdi);
}
else
{
ArrearProcessDA.UpdateDetailItem(tc, apdi);
ArrearProcessDA.DeleteDetailItemMonthly(tc, apdi.ID);
}
foreach (ArrearProcessDetailItemMonthly apdim in apdi.ArrearProcessDetailItemMonthlys)
{
int id2 = tc.GenerateID("ARRPROSDETAILITEMMONTHLY", "ARRPROSDETAILITEMMONTHLYID");
base.SetObjectID(apdim, (id2));
apdim.ArrearProcessDetailItemID = apdi.ID;
ArrearProcessDA.Insert(tc, apdim);
}
}
return (1);
}
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(ArrearProcess oAP)
{
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin(true);
ArrearProcessDA.Delete(tc, oAP);
}
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 List<ArrearProcessDetail> GetArrearProcessDetails(int ArrearProcessID)
{
List<ArrearProcessDetail> ArrearProcessDetails = new List<ArrearProcessDetail>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(ArrearProcessDA.GetArrearProcessDetails(tc, ArrearProcessID));
ArrearProcessDetails = this.CreateAPDetailObjects(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 ArrearProcessDetails;
}
public List<ArrearProcessDetail> GetArrearProcessDetails(string sEmpID, DateTime startDate, DateTime endDate,
int payrollTypeID)
{
List<ArrearProcessDetail> ArrearProcessDetails = new List<ArrearProcessDetail>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr =
new DataReader(
ArrearProcessDA.GetArrearProcessDetails(tc, sEmpID, startDate, endDate, payrollTypeID));
ArrearProcessDetails = this.CreateAPDetailObjects(dr);
dr.Close();
foreach (ArrearProcessDetail item in ArrearProcessDetails)
{
dr = new DataReader(ArrearProcessDA.GetArrearProcessDetailItems(tc, item.ID));
item.ArrearProcessDetailItems = this.CreateAPDetailItemObjects(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 ArrearProcessDetails;
}
public DataSet GetArrearProcessDetailsByCCID(string sCCID, DateTime startDate, DateTime endDate,
int payrollTypeID)
{
DataSet ds = null;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
ds = ArrearProcessDA.GetArrearProcessDetailsByCCID(tc, sCCID, startDate, endDate, payrollTypeID);
tc.End();
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public DataSet GetArrearProcessDetailsByCCIDAndEmpID2(string sCCID, DateTime startDate, DateTime endDate,
string sEmpIDs)
{
DataSet ds = null;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
ds = ArrearProcessDA.GetArrearProcessDetailsByCCIDAndEmpID2(tc, sCCID, startDate, endDate, sEmpIDs);
tc.End();
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public DataSet GetArrearProcessDetailsByCCIDAndEmpID3(string sCCID, DateTime startDate, DateTime endDate,
string sEmpIDs)
{
DataSet ds = null;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
ds = ArrearProcessDA.GetArrearProcessDetailsByCCIDAndEmpID3(tc, sCCID, startDate, endDate, sEmpIDs);
tc.End();
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public DataSet GetArrPrssDetailsByCstIDEmpIDLocAndDeptWise(string sCCID, DateTime startDate, DateTime endDate,
string sEmpIDs)
{
DataSet ds = null;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
ds = ArrearProcessDA.GetArrPrssDetailsByCstIDEmpIDLocAndDeptWise(tc, sCCID, startDate, endDate,
sEmpIDs);
tc.End();
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public DataSet GetArrearProcessDetailsByCCIDAndEmpID(string sCCID, DateTime startDate, DateTime endDate,
string sEmpIDs, int payrollTypeID)
{
DataSet ds = null;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
ds = ArrearProcessDA.GetArrearProcessDetailsByCCIDAndEmpID(tc, sCCID, startDate, endDate, sEmpIDs,
payrollTypeID);
tc.End();
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public List<ArrearProcessDetailItem> GetArrearProcessDetailItems(int ArrearProcessDetailID)
{
List<ArrearProcessDetailItem> ArrearProcessDetailItems = new List<ArrearProcessDetailItem>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(ArrearProcessDA.GetArrearProcessDetailItems(tc, ArrearProcessDetailID));
ArrearProcessDetailItems = this.CreateAPDetailItemObjects(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 ArrearProcessDetailItems;
}
public List<ArrearProcessDetailItemMonthly> GetArrearProcessDetailItemMonthlys(int ArrearProcessDetailItemID)
{
List<ArrearProcessDetailItemMonthly> ArrearProcessDetailItemMonthlys =
new List<ArrearProcessDetailItemMonthly>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr =
new DataReader(ArrearProcessDA.GetArrearProcessDetailItemMonthlys(tc, ArrearProcessDetailItemID));
ArrearProcessDetailItemMonthlys = this.CreateAPDetailItemMonthlyObjects(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 ArrearProcessDetailItemMonthlys;
}
public List<ArrearProcessCostDist> GetArrearProcessCostDists(int ArrearProcessDetailID)
{
List<ArrearProcessCostDist> ArrearProcessCostDists = new List<ArrearProcessCostDist>();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
DataReader dr = new DataReader(ArrearProcessDA.GetArrearProcessCostDists(tc, ArrearProcessDetailID));
ArrearProcessCostDists = this.CreateAPCostDistObjects(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 ArrearProcessCostDists;
}
public bool IsExist(DateTime dt, int payrollTypeID)
{
bool isExist = false;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
isExist = ArrearProcessDA.IsExist(tc, dt, payrollTypeID);
//accessCards = this.CreateObjects<AccessCard>(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 isExist;
}
public void Approve(ArrearProcess prc, int payrollTypeID, DateTime nextPayProcessDate)
{
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
ArrearProcessDA.Approve(tc, prc, payrollTypeID, nextPayProcessDate);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
}
#endregion
}
#endregion
}