410 lines
11 KiB
C#
410 lines
11 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 SalaryProcess
|
|
|
|
[Serializable]
|
|
public class SalaryProcess : AuditTrailBase
|
|
{
|
|
#region Cache Store
|
|
|
|
private static Cache _cache = new Cache(typeof(SalaryProcess));
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
public SalaryProcess()
|
|
{
|
|
_salaryMonth = DateTime.MinValue;
|
|
_processDate = DateTime.MinValue;
|
|
_paymentDate = DateTime.MinValue;
|
|
_monthEndDate = DateTime.MinValue;
|
|
_workDays = 0;
|
|
_isFinalized = false;
|
|
_processCode = "";
|
|
_remarks = "";
|
|
_payrollTypeID = null;
|
|
_showInDesktop = false;
|
|
_showInDesktopDate = DateTime.MinValue;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region Salary Month : DateTime
|
|
|
|
private DateTime _salaryMonth;
|
|
public DateTime SalaryMonth
|
|
{
|
|
get { return _salaryMonth; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<DateTime>("SalaryMonth", _salaryMonth, value);
|
|
_salaryMonth = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region processDate : DateTime
|
|
|
|
private DateTime _processDate;
|
|
public DateTime ProcessDate
|
|
{
|
|
get { return _processDate; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<DateTime>("processDate", _processDate, value);
|
|
_processDate = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region paymentDate : System.DateTime
|
|
|
|
private System.DateTime? _paymentDate;
|
|
public System.DateTime? PaymentDate
|
|
{
|
|
get { return _paymentDate; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<System.DateTime>("paymentDate", _paymentDate, value);
|
|
_paymentDate = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region workDays : int
|
|
|
|
private int _workDays;
|
|
public int WorkDays
|
|
{
|
|
get { return _workDays; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<int>("workDays", _workDays, value);
|
|
_workDays = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region isFinalized : bool
|
|
|
|
private bool _isFinalized;
|
|
public bool IsFinalized
|
|
{
|
|
get { return _isFinalized; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<bool>("isFinalized", _isFinalized, value);
|
|
_isFinalized = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region payrollTypeID : int
|
|
|
|
private ID _payrollTypeID;
|
|
public ID PayrollTypeID
|
|
{
|
|
get { return _payrollTypeID; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<ID>("payrollTypeID", _payrollTypeID, value);
|
|
_payrollTypeID = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ProcessCode : string
|
|
|
|
private string _processCode;
|
|
public string ProcessCode
|
|
{
|
|
get { return _processCode; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("ProcessCode", _processCode, value);
|
|
_processCode = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Remarks : string
|
|
|
|
private string _remarks;
|
|
public string Remarks
|
|
{
|
|
get { return _remarks; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<string>("Remarks", _remarks, value);
|
|
_remarks = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ShowInDesktop : int
|
|
|
|
private bool _showInDesktop;
|
|
public bool ShowInDesktops
|
|
{
|
|
get { return _showInDesktop; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<bool>("ShowInDesktops", _showInDesktop, value);
|
|
_showInDesktop = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region ShowInDesktopDate : DateTime
|
|
|
|
private DateTime _showInDesktopDate;
|
|
public DateTime ShowInDesktopDate
|
|
{
|
|
get { return _showInDesktopDate; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<DateTime>("ShowInDesktopDate", _showInDesktopDate, value);
|
|
_showInDesktopDate = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region MonthEndDate : System.DateTime
|
|
|
|
private System.DateTime? _monthEndDate;
|
|
public System.DateTime? MonthEndDate
|
|
{
|
|
get { return _monthEndDate; }
|
|
set
|
|
{
|
|
base.OnPropertyChange<System.DateTime>("MonthEndDate", _monthEndDate, value);
|
|
_monthEndDate = value;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Service Factory ISalaryProcessService : ISalaryProcessService
|
|
|
|
internal static ISalaryProcessService Service
|
|
{
|
|
get { return Services.Factory.CreateService<ISalaryProcessService>(typeof(ISalaryProcessService)); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region Functions
|
|
|
|
public static SalaryProcess Get(ID nID)
|
|
{
|
|
SalaryProcess oSalaryProcess = null;
|
|
#region Cache Header
|
|
oSalaryProcess = (SalaryProcess)_cache["Get", nID];
|
|
if (oSalaryProcess != null)
|
|
return oSalaryProcess;
|
|
#endregion
|
|
oSalaryProcess = SalaryProcess.Service.Get(nID);
|
|
#region Cache Footer
|
|
_cache.Add(oSalaryProcess, "Get", nID);
|
|
#endregion
|
|
return oSalaryProcess;
|
|
}
|
|
|
|
public static ObjectsTemplate<SalaryProcess> Get(DateTime dMonthDate)
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<SalaryProcess> salaryProcesss = _cache["Get", dMonthDate] as ObjectsTemplate<SalaryProcess>;
|
|
if (salaryProcesss != null)
|
|
return salaryProcesss;
|
|
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
salaryProcesss = Service.Get(dMonthDate,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(salaryProcesss, "Get", dMonthDate);
|
|
|
|
#endregion
|
|
|
|
return salaryProcesss;
|
|
}
|
|
|
|
public static ObjectsTemplate<SalaryProcess> Get()
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<SalaryProcess> salaryProcesss = _cache["Get"] as ObjectsTemplate<SalaryProcess>;
|
|
if (salaryProcesss != null)
|
|
return salaryProcesss;
|
|
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
salaryProcesss = Service.Get(SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(salaryProcesss, "Get");
|
|
|
|
#endregion
|
|
|
|
return salaryProcesss;
|
|
}
|
|
|
|
public static ObjectsTemplate<SalaryProcess> GetSP()
|
|
{
|
|
#region Cache Header
|
|
|
|
ObjectsTemplate<SalaryProcess> salaryProcesss = _cache["Get"] as ObjectsTemplate<SalaryProcess>;
|
|
if (salaryProcesss != null)
|
|
return salaryProcesss;
|
|
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
salaryProcesss = Service.GetSP();
|
|
}
|
|
catch (ServiceException e)
|
|
{
|
|
throw new Exception(e.Message, e);
|
|
}
|
|
|
|
#region Cache Footer
|
|
|
|
_cache.Add(salaryProcesss, "GetSP");
|
|
|
|
#endregion
|
|
|
|
return salaryProcesss;
|
|
}
|
|
|
|
public bool GetBySMonth(DateTime dSMonth)
|
|
{
|
|
bool bShowInDesktop;
|
|
bShowInDesktop = SalaryProcess.Service.GetBySMonth(dSMonth,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|
return bShowInDesktop;
|
|
}
|
|
|
|
public ID Save()
|
|
{
|
|
return SalaryProcess.Service.Save(this);
|
|
}
|
|
|
|
public void SetAuditTraiProperty()
|
|
{
|
|
base.SetAuditTrailProperties();
|
|
}
|
|
|
|
public void Delete()
|
|
{
|
|
SalaryProcess.Service.Delete(this.ID);
|
|
}
|
|
public static int GetProcessID(DateTime nextPayProcessDate, int payrollTypeID)
|
|
{
|
|
int nTotlalProcessID = 0;
|
|
nTotlalProcessID = Service.GetProcessID(SystemInformation.CurrentSysInfo.NextPayProcessDate, Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|
return nTotlalProcessID;
|
|
}
|
|
|
|
public void UndoSalary()
|
|
{
|
|
SalaryProcess.Service.UndoSalary(this.ID);
|
|
}
|
|
|
|
public static void UndoMonthlySalaryByEmpIDs(string ids, DateTime salaryMonth)
|
|
{
|
|
SalaryProcess.Service.UndoMonthlySalaryByEmpIDs(ids, salaryMonth);
|
|
}
|
|
|
|
|
|
public void Update(SalaryProcess oSProcess)
|
|
{
|
|
this.SetAuditTraiProperty();
|
|
SalaryProcess.Service.Update(oSProcess);
|
|
}
|
|
|
|
public void SPApprove(SalaryProcess oSProcess)
|
|
{
|
|
SalaryProcess.Service.SPApprove(oSProcess);
|
|
}
|
|
|
|
public static ObjectsTemplate<SalaryProcess> GetAllProcess()
|
|
{
|
|
ObjectsTemplate<SalaryProcess> salaryProcesss = new ObjectsTemplate<SalaryProcess> ();
|
|
salaryProcesss = SalaryProcess.Service.GetAllProcess(SystemInformation.CurrentSysInfo.NextPayProcessDate,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|
return salaryProcesss;
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region ISalaryProcess Service
|
|
|
|
public interface ISalaryProcessService
|
|
{
|
|
SalaryProcess Get(ID id);
|
|
ObjectsTemplate<SalaryProcess> Get(int payrollTypeID);
|
|
ObjectsTemplate<SalaryProcess> GetSP();
|
|
bool GetBySMonth(DateTime sMonth, int payrollTypeID);
|
|
ID Save(SalaryProcess item);
|
|
int GetProcessID(DateTime nextPayProcessDate, int payrollTypeID);
|
|
void Delete(ID id);
|
|
void UndoSalary(ID id);
|
|
void Update(SalaryProcess oSProcess);
|
|
void SPApprove(SalaryProcess oSProcess);
|
|
ObjectsTemplate<SalaryProcess> Get(DateTime dMonthDate, int payrollTypeID);
|
|
void MonthEnd(DateTime month, ObjectsTemplate<PFTransaction> pftransaction,
|
|
ObjectsTemplate<LoanSchedule> loanshedule, ObjectsTemplate<ESBProvision> oESBProvisions, int payrollTypeID);
|
|
|
|
|
|
ObjectsTemplate<SalaryProcess> GetAllProcess(DateTime nextPayProcessDate, int payrollTypeID);
|
|
|
|
void UndoMonthlySalaryByEmpIDs(string ids, DateTime salaryMonth);
|
|
}
|
|
|
|
#endregion
|
|
}
|