EchoTex_Payroll/HRM.BO/Attendance/DailyOTProcess.cs

223 lines
6.1 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.Core;
namespace HRM.BO
{
#region DailyOTProcess
[Serializable]
public class DailyOTProcess : AuditTrailBase
{
#region Constructor
public DailyOTProcess()
{
_termID = 0;
_value = 0;
_employeeID = 0;
_workingDate = DateTime.MinValue;
}
#endregion
#region Properties
#region TermID : ID
private int _termID;
public int TermID
{
get { return _termID; }
set
{
//base.OnPropertyChange<ID>("TermID", _termID, value);
_termID = value;
}
}
#endregion
#region value : int
private double _value;
public double Value
{
get { return _value; }
set
{
//base.OnPropertyChange<double>("value", _value, value);
_value = value;
}
}
#endregion
#region EmployeeID : ID
private int _employeeID;
public int EmployeeID
{
get { return _employeeID; }
set
{
//base.OnPropertyChange<ID>("EmployeeID", _employeeID, value);
_employeeID = value;
}
}
#endregion
#region WorkingDate : DateTime
private DateTime _workingDate;
public DateTime WorkingDate
{
get { return _workingDate; }
set
{
//base.OnPropertyChange<DateTime>("workingdate", _workingDate, value);
_workingDate = value;
}
}
#endregion
//#region Service Factory IDailyOTProcessService : IDailyOTProcessService
//internal static IDailyOTProcessService Service
//{
// get { return Services.Factory.CreateService<IDailyOTProcessService>(typeof(IDailyOTProcessService)); }
//}
//#endregion
//public void Proecess(ObjectsTemplate<DailyAttnProcess> attProcesses)
//{
// ObjectsTemplate<DailyOTProcess> processItems = new ObjectsTemplate<DailyOTProcess>();
// ObjectsTemplate<ShiftTerm> shifTerms = ShiftTerm.Get();
// ObjectsTemplate<Employee> employees = Employee.Get();
// ObjectsTemplate<Shift> shifts = Shift.Get();
// double ExtraHour = 0;
// foreach (DailyAttnProcess attProcess in attProcesses)
// {
// if (attProcess.AttenType != EnumAttendanceType.Present) continue;
// Employee emp = employees.GetItem(attProcess.EmployeeID);
// if (emp == null && emp.IsEligibleOT == false) continue;
// Shift shift = shifts.GetItem(attProcess.ShiftID);
// if (shift == null) throw new ServiceException("shift not found for the employee:");
// // find extra hour ExtraHour
// TimeSpan st = attProcess.OutTime - attProcess.InTime;
// ExtraHour = st.Hours;
// ShiftTerm oShiftTerm = ShiftTerm.GetByShiftID(attProcess.ShiftID);
// foreach (ShiftTermDetail item in oShiftTerm.ShiftTermDetail)
// {
// if (ExtraHour > 0)
// {
// DailyOTProcess otP = new DailyOTProcess();
// otP.EmployeeID = attProcess.EmployeeID;
// otP.TermID = item.TermID;
// otP.WorkingDate = attProcess.AttnDate;
// otP.Value = (ExtraHour > item.Hour) ? item.Hour : ExtraHour;
// ExtraHour = ExtraHour - item.Hour;
// if (otP.Value > 0)
// {
// processItems.Add(otP);
// }
// }
// }
// }
// this.Save(processItems);
//}
#endregion
//#region Functions
//public static DailyOTProcess Get(ID nID)
//{
// DailyOTProcess oDailyOTProcess = null;
// #region Cache Header
// oDailyOTProcess = (DailyOTProcess)_cache["Get", nID];
// if (oDailyOTProcess != null)
// return oDailyOTProcess;
// #endregion
// oDailyOTProcess = DailyOTProcess.Service.Get(nID);
// #region Cache Footer
// _cache.Add(oDailyOTProcess, "Get", nID);
// #endregion
// return oDailyOTProcess;
//}
//public static ObjectsTemplate<DailyOTProcess> Get()
//{
// #region Cache Header
// ObjectsTemplate<DailyOTProcess> dailyOTProcesses = _cache["Get"] as ObjectsTemplate<DailyOTProcess>;
// if (dailyOTProcesses != null)
// return dailyOTProcesses;
// #endregion
// try
// {
// dailyOTProcesses = Service.Get();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(dailyOTProcesses, "Get");
// #endregion
// return dailyOTProcesses;
//}
//public ID Save()
//{
// return DailyOTProcess.Service.Save(this);
//}
//public void Save(ObjectsTemplate<DailyOTProcess> oDailyOTProcesses)
//{
// DailyOTProcess.Service.Save(oDailyOTProcesses);
//}
//public void Delete()
//{
// DailyOTProcess.Service.Delete(ID);
//}
//#endregion
}
#endregion
#region IDailyOTProcess Service
//public interface IDailyOTProcessService
//{
// DailyOTProcess Get(ID id);
// ObjectsTemplate<DailyOTProcess> Get();
// ID Save(DailyOTProcess item);
// void Save(ObjectsTemplate<DailyOTProcess> oDailyOTProcesses);
// void Delete(ID id);
//}
#endregion
}