EchoTex_Payroll/HRM.BO/Attendance/ShiftTerm.cs
2024-10-14 10:01:49 +06:00

249 lines
7.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.Core;
using System.Data;
namespace HRM.BO
{
[Serializable]
public class ShiftTerm : AuditTrailBase
{
#region Constructor
public ShiftTerm()
{
_shiftID = 0;
_weekendTermID = 0;
_holidayTermID = 0;
}
#endregion
#region Properties
#region shiftID : ID
private int _shiftID;
public int ShiftID
{
get { return _shiftID; }
set
{
//base.OnPropertyChange<ID>("shiftID", _shiftID, value);
_shiftID = value;
}
}
#endregion
#region weekendTermID : ID
private int _weekendTermID;
public int WeekendTermID
{
get { return _weekendTermID; }
set
{
//base.OnPropertyChange<ID>("weekendTermID", _weekendTermID, value);
_weekendTermID = value;
}
}
#endregion
#region holidayTermID : ID
private int _holidayTermID;
public int HolidayTermID
{
get { return _holidayTermID; }
set
{
//base.OnPropertyChange<ID>("holidayTermID", _holidayTermID, value);
_holidayTermID = value;
}
}
#endregion
#region Shift Term Detail : Shift Term Detail
private List<ShiftTermDetail> _shiftTermDetail;
public List<ShiftTermDetail> ShiftTermDetail
{
get
{
//if (_shiftTermDetail == null)
//{
// _shiftTermDetail = Payroll.BO.ShiftTermDetail.GetByShiftTermID(this.ID);
//}
return _shiftTermDetail;
}
set { _shiftTermDetail = value; }
}
//#endregion
//#region Service Factory IShiftTermService : IShiftTermService
//internal static IShiftTermService Service
//{
// get { return Services.Factory.CreateService<IShiftTermService>(typeof(IShiftTermService)); }
//}
//#endregion
#endregion
//#region Functions
//public static ShiftTerm Get(ID nID)
//{
// ShiftTerm oShiftTerm = null;
// #region Cache Header
// oShiftTerm = (ShiftTerm)_cache["Get", nID];
// if (oShiftTerm != null)
// return oShiftTerm;
// #endregion
// oShiftTerm = ShiftTerm.Service.Get(nID);
// #region Cache Footer
// _cache.Add(oShiftTerm, "Get", nID);
// #endregion
// return oShiftTerm;
//}
//public static ShiftTerm GetByShiftID(ID shiftID)
//{
// ShiftTerm oShiftTerm = null;
// #region Cache Header
// oShiftTerm = (ShiftTerm)_cache["GetByShiftID", shiftID];
// if (oShiftTerm != null)
// return oShiftTerm;
// #endregion
// oShiftTerm = ShiftTerm.Service.GetByShiftID(shiftID);
// #region Cache Footer
// _cache.Add(oShiftTerm, "GetByShiftID", shiftID);
// #endregion
// return oShiftTerm;
//}
//public static ObjectsTemplate<ShiftTerm> Get()
//{
// #region Cache Header
// ObjectsTemplate<ShiftTerm> shiftTerms = _cache["Get"] as ObjectsTemplate<ShiftTerm>;
// if (shiftTerms != null)
// return shiftTerms;
// #endregion
// try
// {
// shiftTerms = Service.Get();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(shiftTerms, "Get");
// #endregion
// return shiftTerms;
//}
//public ID Save()
//{
// this.SetAuditTrailProperties();
// return ShiftTerm.Service.Save(this);
//}
//public void Delete()
//{
// ShiftTerm.Service.Delete(ID);
//}
//public DataSet GetEmpOT(DateTime date, ID termID)
//{
// DataSet empOT = null;
// try
// {
// empOT = Service.GetEmpOT(date, termID);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// return empOT;
//}
//public void PrepareOT(DateTime date)
//{
// try
// {
// ObjectsTemplate<Term> terms = Term.Get(EnumStatus.Active);
// ObjectsTemplate<EmployeeOverTime> empOTs = new ObjectsTemplate<EmployeeOverTime>();
// EmployeeOverTime empOT = new EmployeeOverTime();
// TermParameter oTermParamerer = null;
// ObjectsTemplate<TermParameter> oTermParamerers = TermParameter.Get();
// ObjectsTemplate<Employee> employees = Employee.Get();
// Employee employee = null;
// foreach (Term trm in terms)
// {
// DataSet EmpOTHours = this.GetEmpOT(date, trm.ID);
// foreach (DataRow Dr in EmpOTHours.Tables[0].Rows)
// {
// empOT = new EmployeeOverTime();
// empOT.TermID = trm.ID;
// empOT.OTHours = Convert.ToDouble(Dr["TotalOT"]);
// if (empOT.OTHours <= 0) continue;
// empOT.EmployeeID = ID.FromInteger(Convert.ToInt32(Dr["EmployeeID"]));
// employee = employees.GetItem(empOT.EmployeeID);
// if (employee == null) continue;
// if (employee.IsEligibleOT == false) continue;
// oTermParamerer = TermParameter.GetParameter(oTermParamerers, employee, trm.ID);
// if (oTermParamerer == null)
// throw new ServiceException("Invalid Parameter, Term parameter/rule not found for the employee:" + employee.EmployeeNo);
// empOT.TermParameterID = oTermParamerer.ID;
// empOT.Value = oTermParamerer.Amount;
// empOT.MonthDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// empOT.OTMonth = GlobalFunctions.LastDateOfMonth(date);
// empOT.PayrollTypeID = employee.PayrollTypeID;
// if (empOT.OTHours > 0)
// empOTs.Add(empOT);
// }
// }
// EmployeeOverTime.Save(empOTs);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
//}
//#endregion
}
#endregion
//#region IShiftTerm Service
//public interface IShiftTermService
//{
// ShiftTerm Get(ID id);
// ObjectsTemplate<ShiftTerm> Get();
// ShiftTerm GetByShiftID(ID shiftID);
// ID Save(ShiftTerm item);
// void Delete(ID id);
// DataSet GetEmpOT(DateTime date, ID termID);
//}
//#endregion
}