403 lines
10 KiB
C#
403 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 EmployeeStatus
|
|||
|
|
|||
|
[Serializable]
|
|||
|
public class EmployeeStatus : BasicBaseObject
|
|||
|
{
|
|||
|
#region Cache Store
|
|||
|
|
|||
|
private static Cache _cache = new Cache(typeof(EmployeeStatus));
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public EmployeeStatus()
|
|||
|
{
|
|||
|
_empStatus = EnumEmployeeStatus.Live;
|
|||
|
_description = string.Empty;
|
|||
|
_continueOwnPartPF = false;
|
|||
|
_continueCmpPartPF = false;
|
|||
|
_continueGratuity = false;
|
|||
|
_gradeSalaryChangeType = null;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Properties
|
|||
|
|
|||
|
#region status : EnumEmployeeStatus
|
|||
|
|
|||
|
private EnumEmployeeStatus _empStatus;
|
|||
|
public EnumEmployeeStatus EmpStatus
|
|||
|
{
|
|||
|
get { return _empStatus; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<short>("EmpStatus", (short)_empStatus, (short)value);
|
|||
|
_empStatus = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region description : string
|
|||
|
|
|||
|
private string _description;
|
|||
|
public string Description
|
|||
|
{
|
|||
|
get { return _description; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<string>("description", _description, value);
|
|||
|
_description = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region continueOwnPartPF : bool
|
|||
|
|
|||
|
private bool _continueOwnPartPF;
|
|||
|
public bool ContinueOwnPartPF
|
|||
|
{
|
|||
|
get { return _continueOwnPartPF; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("continueOwnPartPF", _continueOwnPartPF, value);
|
|||
|
_continueOwnPartPF = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region continueCmpPartPF : bool
|
|||
|
|
|||
|
private bool _continueCmpPartPF;
|
|||
|
public bool ContinueCmpPartPF
|
|||
|
{
|
|||
|
get { return _continueCmpPartPF; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("continueCmpPartPF", _continueCmpPartPF, value);
|
|||
|
_continueCmpPartPF = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region continueGratuity : bool
|
|||
|
|
|||
|
private bool _continueGratuity;
|
|||
|
public bool ContinueGratuity
|
|||
|
{
|
|||
|
get { return _continueGratuity; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("continueGratuity", _continueGratuity, value);
|
|||
|
_continueGratuity = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region ParentID : ID
|
|||
|
|
|||
|
private ID _parentID;
|
|||
|
public ID ParentID
|
|||
|
{
|
|||
|
get { return _parentID; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("ParentID", _parentID, value);
|
|||
|
_parentID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#region category : Category
|
|||
|
|
|||
|
private GradeSalaryChangeType _gradeSalaryChangeType;
|
|||
|
public GradeSalaryChangeType GradeSalaryChangeType
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (this.ID != null && !this.ID.IsUnassigned)
|
|||
|
{
|
|||
|
if (this.ID.Integer > 0 && _gradeSalaryChangeType == null)
|
|||
|
{
|
|||
|
_gradeSalaryChangeType = new GradeSalaryChangeType();
|
|||
|
_gradeSalaryChangeType = GradeSalaryChangeType.Get(this.ID);
|
|||
|
}
|
|||
|
}
|
|||
|
return this._gradeSalaryChangeType;
|
|||
|
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_gradeSalaryChangeType = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory IEmployeeStatusService : IEmployeeStatusService
|
|||
|
|
|||
|
internal static IEmployeeStatusService Service
|
|||
|
{
|
|||
|
get { return Services.Factory.CreateService<IEmployeeStatusService>(typeof(IEmployeeStatusService)); }
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpStatusComponent
|
|||
|
[Serializable]
|
|||
|
public class EmpStatusComponent :ObjectTemplate
|
|||
|
{
|
|||
|
#region constructor
|
|||
|
public EmpStatusComponent()
|
|||
|
{ }
|
|||
|
#endregion
|
|||
|
|
|||
|
#region properties
|
|||
|
|
|||
|
#region ComponentType :int
|
|||
|
private int _componentType;
|
|||
|
public int ComponentType
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _componentType;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_componentType = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region StatusID
|
|||
|
private ID _statusID;
|
|||
|
public ID StatusID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _statusID;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("_statusID", _statusID, value);
|
|||
|
_statusID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
public new void SetID(ID id)
|
|||
|
{
|
|||
|
base.SetID(id);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region EmpStatusComponents
|
|||
|
[Serializable]
|
|||
|
public class EmpStatusComponents : ObjectsTemplate<EmpStatusComponent>
|
|||
|
{
|
|||
|
#region constructor
|
|||
|
public EmpStatusComponents()
|
|||
|
{ }
|
|||
|
#endregion
|
|||
|
public EmpStatusComponent GetItemByEmpStatusID(ID EmpStatusID)
|
|||
|
{
|
|||
|
return this.Find(delegate(EmpStatusComponent item) { return item.StatusID == EmpStatusID; });
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region Property EmpStatusComponents
|
|||
|
private ObjectsTemplate<EmpStatusComponent> _empStatusComponents;
|
|||
|
public ObjectsTemplate<EmpStatusComponent> EmployeeStatusComponents
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_empStatusComponents == null && this.ID != null && !this.ID.IsUnassigned)
|
|||
|
_empStatusComponents = EmployeeStatus.GetChild(this.ID);
|
|||
|
return _empStatusComponents;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_empStatusComponents = value;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Functions
|
|||
|
|
|||
|
public static EmployeeStatus Get(ID nID)
|
|||
|
{
|
|||
|
EmployeeStatus oEmployeeStatus = null;
|
|||
|
#region Cache Header
|
|||
|
oEmployeeStatus = (EmployeeStatus)_cache["Get", nID];
|
|||
|
if (oEmployeeStatus != null)
|
|||
|
return oEmployeeStatus;
|
|||
|
#endregion
|
|||
|
oEmployeeStatus = EmployeeStatus.Service.Get(nID);
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oEmployeeStatus, "Get", nID);
|
|||
|
#endregion
|
|||
|
return oEmployeeStatus;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<EmployeeStatus.EmpStatusComponent> GetChild(ID parentID)
|
|||
|
{
|
|||
|
ObjectsTemplate<EmployeeStatus.EmpStatusComponent> a = new ObjectsTemplate<EmpStatusComponent>();
|
|||
|
a = EmployeeStatus.Service.GetChild(parentID);
|
|||
|
return a;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<EmployeeStatus> Get(EnumStatus status)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<EmployeeStatus> employeeStatuses = _cache["Get",status] as ObjectsTemplate<EmployeeStatus>;
|
|||
|
if (employeeStatuses != null)
|
|||
|
return employeeStatuses;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
employeeStatuses = Service.Get(status);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(employeeStatuses, "Get", status);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return employeeStatuses;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<EmployeeStatus> Get()
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<EmployeeStatus> employeeStatuses = _cache["Get"] as ObjectsTemplate<EmployeeStatus>;
|
|||
|
if (employeeStatuses != null)
|
|||
|
return employeeStatuses;
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
employeeStatuses = Service.Get();
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(employeeStatuses, "Get");
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return employeeStatuses;
|
|||
|
}
|
|||
|
|
|||
|
public static ObjectsTemplate<EmployeeStatus> GetByEmpStatus(EnumStatus status,EnumEmployeeStatus empStatus)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<EmployeeStatus> employeeStatuses = _cache["Get", status, empStatus] as ObjectsTemplate<EmployeeStatus>;
|
|||
|
if (employeeStatuses != null)
|
|||
|
return employeeStatuses;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
employeeStatuses = Service.GetByEmpStatus(status,empStatus);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(employeeStatuses, "Get", status,empStatus);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return employeeStatuses;
|
|||
|
}
|
|||
|
|
|||
|
public void SaveStatus()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
this.SetAuditTrailProperties();
|
|||
|
Service.SaveStatus(this);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void Delete()
|
|||
|
{
|
|||
|
EmployeeStatus.Service.Delete(this.ID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
public void SetObjectID(ID id)
|
|||
|
{
|
|||
|
base.SetID(id);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region IEmployeeStatus Service
|
|||
|
|
|||
|
public interface IEmployeeStatusService
|
|||
|
{
|
|||
|
EmployeeStatus Get(ID id);
|
|||
|
|
|||
|
ObjectsTemplate<EmployeeStatus> Get();
|
|||
|
ObjectsTemplate<EmployeeStatus.EmpStatusComponent> GetChild(ID id);
|
|||
|
ObjectsTemplate<EmployeeStatus> Get(EnumStatus status);
|
|||
|
ObjectsTemplate<EmployeeStatus> GetByEmpStatus(EnumStatus status,EnumEmployeeStatus empStatus);
|
|||
|
ID Save(EmployeeStatus item);
|
|||
|
void SaveStatus(EmployeeStatus oEmployeeStatus);
|
|||
|
void Delete(ID id);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|