427 lines
10 KiB
C#
427 lines
10 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using Ease.CoreV35;
|
|||
|
using Ease.CoreV35.Model;
|
|||
|
using Ease.CoreV35.Caching;
|
|||
|
using System.Data.Linq.Mapping;
|
|||
|
|
|||
|
namespace Payroll.BO
|
|||
|
{
|
|||
|
#region EmployeeOverTime
|
|||
|
|
|||
|
[Serializable]
|
|||
|
public class EmployeeOverTime : AuditTrailBase
|
|||
|
{
|
|||
|
#region Cache Store
|
|||
|
|
|||
|
private static Cache _cache = new Cache(typeof(EmployeeOverTime));
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public EmployeeOverTime()
|
|||
|
{
|
|||
|
_termID = null;
|
|||
|
_termParameterID = null;
|
|||
|
_employeeID = null;
|
|||
|
_monthDate = DateTime.MinValue;
|
|||
|
_oTMonth = DateTime.MinValue;
|
|||
|
_oTHours = 0;
|
|||
|
_value = 0;
|
|||
|
_term = null;
|
|||
|
_employee = null;
|
|||
|
_PayrollTypeID = null;
|
|||
|
_oTMonthbasic = 0;
|
|||
|
//_monthRange = null;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Properties
|
|||
|
|
|||
|
#region TermID : ID
|
|||
|
|
|||
|
private ID _termID;
|
|||
|
public ID TermID
|
|||
|
{
|
|||
|
get { return _termID; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("TermID", _termID, value);
|
|||
|
_termID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region TermParameterID : ID
|
|||
|
|
|||
|
private ID _termParameterID;
|
|||
|
public ID TermParameterID
|
|||
|
{
|
|||
|
get { return _termParameterID; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("TermParameterID", _termParameterID, value);
|
|||
|
_termParameterID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region TermParameter : Object
|
|||
|
|
|||
|
private TermParameter _termParameter = null;
|
|||
|
public TermParameter TermParam
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (!_termParameterID.IsUnassigned && _termParameterID.Integer > 0)
|
|||
|
{
|
|||
|
_termParameter = TermParameter.Get(_termParameterID);
|
|||
|
}
|
|||
|
return _termParameter;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmployeeID : ID
|
|||
|
|
|||
|
private ID _employeeID;
|
|||
|
public ID EmployeeID
|
|||
|
{
|
|||
|
get { return _employeeID; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("EmployeeID", _employeeID, value);
|
|||
|
_employeeID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region monthDate : DateTime
|
|||
|
|
|||
|
private DateTime _monthDate;
|
|||
|
public DateTime MonthDate
|
|||
|
{
|
|||
|
get { return _monthDate; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<DateTime>("monthDate", _monthDate, value);
|
|||
|
_monthDate = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region OTHours : double
|
|||
|
|
|||
|
private double _oTHours;
|
|||
|
public double OTHours
|
|||
|
{
|
|||
|
get { return _oTHours; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<double>("OTHours", _oTHours, value);
|
|||
|
_oTHours = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region amount : double
|
|||
|
|
|||
|
private double _value;
|
|||
|
public double Value
|
|||
|
{
|
|||
|
get { return _value; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<double>("value", _value, value);
|
|||
|
_value = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region OTMonthBasic : double
|
|||
|
|
|||
|
private double _oTMonthbasic;
|
|||
|
public double OTMonthBasic
|
|||
|
{
|
|||
|
get { return _oTMonthbasic; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<double>("basicSalary", _oTMonthbasic, value);
|
|||
|
_oTMonthbasic = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region OTMonth : DateTime
|
|||
|
|
|||
|
private DateTime _oTMonth;
|
|||
|
public DateTime OTMonth
|
|||
|
{
|
|||
|
get { return _oTMonth; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<DateTime>("OTMonth", _oTMonth, value);
|
|||
|
_oTMonth = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region term : Term
|
|||
|
|
|||
|
private Term _term;
|
|||
|
public Term Term
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_termID.Integer > 0 && _term == null)
|
|||
|
{
|
|||
|
_term = new Term();
|
|||
|
_term = Term.Get(_termID);
|
|||
|
}
|
|||
|
return this._term;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_term = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region employee : Employee
|
|||
|
|
|||
|
private Employee _employee;
|
|||
|
public Employee Employee
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_employeeID.Integer > 0 && _employee == null)
|
|||
|
{
|
|||
|
_employee = new Employee();
|
|||
|
_employee = Employee.Get(_employeeID);
|
|||
|
}
|
|||
|
return this._employee;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_employee = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region PayrollTypeID : ID
|
|||
|
|
|||
|
private ID _PayrollTypeID;
|
|||
|
public ID PayrollTypeID
|
|||
|
{
|
|||
|
get { return _PayrollTypeID; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("PayrollTypeID", _PayrollTypeID, value);
|
|||
|
_PayrollTypeID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory IEmployeeOverTimeService : IEmployeeOverTimeService
|
|||
|
|
|||
|
internal static IEmployeeOverTimeService Service
|
|||
|
{
|
|||
|
get { return Services.Factory.CreateService<IEmployeeOverTimeService>(typeof(IEmployeeOverTimeService)); }
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Functions
|
|||
|
|
|||
|
public static EmployeeOverTime Get(ID nID)
|
|||
|
{
|
|||
|
EmployeeOverTime oEmployeeOverTime = null;
|
|||
|
#region Cache Header
|
|||
|
oEmployeeOverTime = (EmployeeOverTime)_cache["Get", nID];
|
|||
|
if (oEmployeeOverTime != null)
|
|||
|
return oEmployeeOverTime;
|
|||
|
#endregion
|
|||
|
oEmployeeOverTime = EmployeeOverTime.Service.Get(nID);
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oEmployeeOverTime, "Get", nID);
|
|||
|
#endregion
|
|||
|
return oEmployeeOverTime;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<EmployeeOverTime> Get()
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<EmployeeOverTime> empOverTimes = _cache["Get"] as ObjectsTemplate<EmployeeOverTime>;
|
|||
|
if (empOverTimes != null)
|
|||
|
return empOverTimes;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
empOverTimes = Service.Get();
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(empOverTimes, "Get");
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return empOverTimes;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<EmployeeOverTime> Get(DateTime dOTMonth,ID nPayrollTypeID)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<EmployeeOverTime> empOverTimes = _cache["Get"] as ObjectsTemplate<EmployeeOverTime>;
|
|||
|
if (empOverTimes != null)
|
|||
|
return empOverTimes;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
empOverTimes = Service.Get(dOTMonth,nPayrollTypeID);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(empOverTimes, "Get");
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return empOverTimes;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<EmployeeOverTime> GetByEmpID(ID nEmpID,DateTime dMonthDate)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<EmployeeOverTime> empOverTimes = _cache["Get",nEmpID,dMonthDate] as ObjectsTemplate<EmployeeOverTime>;
|
|||
|
if (empOverTimes != null)
|
|||
|
return empOverTimes;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
empOverTimes = Service.GetByEmpID(nEmpID,dMonthDate);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(empOverTimes, "Get",nEmpID,dMonthDate);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return empOverTimes;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<EmployeeOverTime> GetByEmpID(ID nEmpID, DateTime otMonth, DateTime salaryMonth)
|
|||
|
{
|
|||
|
|
|||
|
ObjectsTemplate<EmployeeOverTime> empOverTimes = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
empOverTimes = Service.GetByEmpID(nEmpID, otMonth, salaryMonth);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return empOverTimes;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public static void Save(ObjectsTemplate<EmployeeOverTime> _EmpOverTimes)
|
|||
|
{
|
|||
|
foreach (EmployeeOverTime oEmpOverTime in _EmpOverTimes)
|
|||
|
{
|
|||
|
oEmpOverTime.SetAuditTrailProperties();
|
|||
|
}
|
|||
|
EmployeeOverTime.Service.Save(_EmpOverTimes);
|
|||
|
}
|
|||
|
public static void DeleteByMonth(DateTime dOTMonth)
|
|||
|
{
|
|||
|
EmployeeOverTime.Service.DeleteByMonth(dOTMonth);
|
|||
|
}
|
|||
|
public ID Save()
|
|||
|
{
|
|||
|
return EmployeeOverTime.Service.Save(this);
|
|||
|
}
|
|||
|
//public void Delete()
|
|||
|
//{
|
|||
|
// EmployeeOverTime.Service.Delete(ID);
|
|||
|
//}
|
|||
|
|
|||
|
|
|||
|
public static void SaveByExcel(ObjectsTemplate<EmployeeOverTime> _EmpOverTimes)
|
|||
|
{
|
|||
|
foreach (EmployeeOverTime oEmpOverTime in _EmpOverTimes)
|
|||
|
{
|
|||
|
oEmpOverTime.SetAuditTrailProperties();
|
|||
|
}
|
|||
|
EmployeeOverTime.Service.SaveByExcel(_EmpOverTimes);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region IEmployeeOverTime Service
|
|||
|
|
|||
|
public interface IEmployeeOverTimeService
|
|||
|
{
|
|||
|
EmployeeOverTime Get(ID id);
|
|||
|
ObjectsTemplate<EmployeeOverTime> Get();
|
|||
|
ObjectsTemplate<EmployeeOverTime> GetByEmpID(ID nEmpID,DateTime dMonthDaet);
|
|||
|
ObjectsTemplate<EmployeeOverTime> GetByEmpID(ID nEmpID, DateTime otMonth, DateTime salaryMonth);
|
|||
|
ID Save(EmployeeOverTime item);
|
|||
|
void Save(ObjectsTemplate<EmployeeOverTime> _EmpOverTimes);
|
|||
|
|
|||
|
void SaveByExcel(ObjectsTemplate<EmployeeOverTime> _EmpOverTimes);
|
|||
|
|
|||
|
void DeleteByMonth(DateTime dOTMonth);
|
|||
|
//void Delete(ID id);
|
|||
|
ObjectsTemplate<EmployeeOverTime> Get(DateTime dOTMonth,ID nPayrollTypeID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|