71 lines
2.2 KiB
C#
71 lines
2.2 KiB
C#
using Ease.Core.Model;
|
|
using HRM.BO;
|
|
using HRM.DA;
|
|
using HRM.UI.MODELS;
|
|
using Payroll.BO;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
namespace HRM.UI
|
|
{
|
|
public class MakeDataTableFromObject
|
|
{
|
|
public static List<DailyAttnProcessTModel> MakeAttnApproveDataTable(List<DailyAttnProcess> _daPocess)
|
|
{
|
|
DataTable dt = null;
|
|
List<DailyAttnProcessTModel> models = new List<DailyAttnProcessTModel>();
|
|
|
|
if (_daPocess != null)
|
|
{
|
|
List<Shift> _shifts = new ShiftService().GetAllShift();
|
|
|
|
foreach (DailyAttnProcess item in _daPocess)
|
|
{
|
|
DailyAttnProcessTModel obj = new DailyAttnProcessTModel();
|
|
obj.Location = new AttendanceLocationTModel();
|
|
|
|
obj.PKID = item.ID;
|
|
obj.DailyAttnProcessID = item.ID;
|
|
obj.EmployeeID = item.EmployeeID;
|
|
obj.AttnDate = item.AttnDate;
|
|
obj.InTime = item.InTime ?? DateTime.MinValue;
|
|
obj.OutTime = item.OutTime ?? DateTime.MinValue;
|
|
obj.ActualInTime = item.ActualInTime ?? DateTime.MinValue;
|
|
obj.ActualOutTime = item.ActualOutTime ?? DateTime.MinValue;
|
|
obj.ActualStatus = item.AttenType;
|
|
obj.ActualOT = item.OTHour;
|
|
obj.AttenType = item.AttenType;
|
|
obj.EmpAttenType = item.AttenType;
|
|
obj.WFStatus = item.WFStatus;
|
|
obj.Comments = item.Comments;
|
|
|
|
obj.Location.ZipcodeInTime = item.ZipcodeInTime;
|
|
obj.Location.ZipcodeOutTime = item.ZipcodeOutTime;
|
|
obj.Location.InTimeLatitude = item.InTimeLatitude;
|
|
obj.Location.OutTimeLatitude = item.OutTimeLatitude;
|
|
obj.Location.InTimeLongitude = item.InTimeLongitude;
|
|
obj.Location.OutTimeLongitude = item.OutTimeLongitude;
|
|
obj.Location.InTimeNearestAddress = item.InTimeNearestAddress;
|
|
obj.Location.OutTimeNearestAddress = item.OutTimeNearestAddress;
|
|
|
|
Shift oShift = _shifts.Where(o => o.ID == item.ShiftID).FirstOrDefault();
|
|
|
|
string shiftDescription;
|
|
if (oShift == null)
|
|
shiftDescription = "";
|
|
else
|
|
shiftDescription = oShift.Name + " (" + oShift.InTime.ToString("hh:mm tt") + " - " + oShift.OutTime.ToString("hh:mm tt") + ") ";
|
|
|
|
obj.Shift = shiftDescription;
|
|
|
|
models.Add(obj);
|
|
}
|
|
}
|
|
|
|
return models;
|
|
}
|
|
}
|
|
} |