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

193 lines
5.9 KiB
C#

using Ease.Core.DataAccess;
using Ease.Core.Model;
using Ease.Core.Utility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HRM.DA;
using HRM.BO;
namespace HRM.DA
{
public class EchoTexExceptionReportService
{
public DataSet GetEmpBankAdvice(DateTime dateTime, string sEmpID)
{
DataSet oBankAdvices = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oBankAdvices = EchoTexExceptionReportDA.GetEmpBankAdvice(tc, dateTime, sEmpID);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oBankAdvices;
}
public DataSet GetEmpSalarySheetEchoTex(DateTime dateTime, string sEmpID)
{
DataSet oSalaryMonthlys = new DataSet();
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
oSalaryMonthlys = EchoTexExceptionReportDA.GetEmpSalarySheetEchoTex(tc, dateTime, sEmpID);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return oSalaryMonthlys;
}
public DataSet GetMonthlyAttendanceDetail(DateTime dFromDate, DateTime dToDate, string sEmpID)
{
DataSet monthlyDetail = null;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
monthlyDetail = EchoTexExceptionReportDA.GetMonthlyAttendanceDetail(tc, dFromDate, dToDate, sEmpID);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return monthlyDetail;
}
public DataSet GetDailyInOut(DateTime attnDate, string sEmpID)
{
DataSet dailyInOut = null;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
tc.CommandTimeOut = 48000;
dailyInOut = EchoTexExceptionReportDA.GetDailyInOut(tc, attnDate, sEmpID);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dailyInOut;
}
public DataSet GetDailyAttnSummary(DateTime attnDate, string sEmpID)
{
DataSet dailyAttnSummary = null;
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
dailyAttnSummary = EchoTexExceptionReportDA.GetDailyAttnSummary(tc, attnDate, sEmpID);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dailyAttnSummary;
}
public DataSet GetDateRangeDataByStatus(DateTime attnFromDate, DateTime attnToDate, string sEmpID, params EnumAttendanceType[] eStatus)
{
DataSet dailyInOut = null;
string sStatus = string.Empty;
sStatus = eStatus.Aggregate(new StringBuilder(),
(sb, el) => sb.Append(((int)el).ToString() + ","),
sb => sb.ToString().Trim(','));
TransactionContext tc = null;
try
{
tc = TransactionContext.Begin();
dailyInOut = EchoTexExceptionReportDA.GetDateRangeDataByStatus(tc, attnFromDate, attnToDate, sStatus, sEmpID);
tc.End();
}
catch (ServiceException e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return dailyInOut;
}
public DataSet GetMonthlyKPIDetail(DateTime dFromDate, DateTime dToDate, string sEmpID)
{
DataSet monthlyDetail = null;
TransactionContext tc = null;
try
{
List<Leave> oLeaves = new LeaveService().Get();
tc = TransactionContext.Begin();
monthlyDetail = EchoTexExceptionReportDA.GetMonthlyKPIDetail(tc, dFromDate, dToDate, sEmpID, oLeaves);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return monthlyDetail;
}
}
}