EchoTex_Payroll/HRM.DA/Service/Employee/ProfileDashboardMobileService.cs

68 lines
2.4 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using Ease.Core.DataAccess;
using Ease.Core.Model;
using Ease.Core.Utility;
using HRM.BO;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HRM.DA
{
#region Service
public class ProfileDashboardMobileService : ServiceTemplate, IProfileDashboardMobile
{
private void MapObject(ProfileDashboardMobile oProfileDashboardMobile, DataReader oReader)
{
oProfileDashboardMobile.ProfileComplitionPercent = oReader.GetInt32("ProfileComplitionPercent", 0);
oProfileDashboardMobile.CurrentMonthWorkingDays = oReader.GetInt32("CurrentMonthWorkingDays", 0);
oProfileDashboardMobile.CurrentMonthAbsent = oReader.GetInt32("CurrentMonthAbsent", 0);
oProfileDashboardMobile.CurrentMonthLate = oReader.GetInt32("CurrentMonthLate", 0);
oProfileDashboardMobile.CurrentMonthLeave = oReader.GetInt32("CurrentMonthLeave", 0);
oProfileDashboardMobile.TotalTeamCount = oReader.GetInt32("TotalTeamCount", 0);
oProfileDashboardMobile.ShiftName = oReader.GetString("ShiftName");
}
protected override T CreateObject<T>(DataReader dr)
{
ProfileDashboardMobile oProfileDashboardMobile = new ProfileDashboardMobile();
MapObject(oProfileDashboardMobile, dr);
return oProfileDashboardMobile as T;
}
//ProfileDashboardMobile CreateObject(DataReader dr)
//{
// ProfileDashboardMobile oProfileDashboardMobile = new ProfileDashboardMobile();
// MapObject(oProfileDashboardMobile, dr);
// return oProfileDashboardMobile;
//}
public DataSet ProfileDashboardMobile(int empId, DateTime fromDate, DateTime toDate)
{
TransactionContext tc = null;
DataSet ds = new DataSet();
try
{
tc = TransactionContext.Begin();
ds = EmployeeDA.GetMobileDashboardInfo(tc, empId, fromDate, toDate);
tc.End();
}
catch (Exception e)
{
#region Handle Exception
if (tc != null)
tc.HandleError();
ExceptionLog.Write(e);
throw new ServiceException(e.Message, e);
#endregion
}
return ds;
}
}
#endregion
}