CEL_Payroll/Payroll.BO/UnAuthLeave/UnAuthorizeLeaveParameter.cs

227 lines
6.0 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
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 UnAuthorizeLeaveParameter
[Serializable]
public class UnAuthorizeLeaveParamDetail:AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(UnAuthorizeLeaveParamDetail));
#endregion
#region Constructor
public UnAuthorizeLeaveParamDetail()
{
_unAhuthorizeLeaveParamID = null;
_allowanceID = null;
_valueInPercent = 0;
}
#endregion
#region Properties
#region UnAhuthorizeLeaveID : ID
private ID _unAhuthorizeLeaveParamID;
public ID UNLeaveParamID
{
get { return _unAhuthorizeLeaveParamID; }
set
{
base.OnPropertyChange<ID>("UnAhuthorizeLeaveID", _unAhuthorizeLeaveParamID, value);
_unAhuthorizeLeaveParamID = value;
}
}
#endregion
#region UnAhuthorizeLeave : UnAhuthorizeLeave
private UnAuthorizeLeave _unAhuthorizeLeave;
public UnAuthorizeLeave UnAuthorizeLeave
{
get
{
if (_unAhuthorizeLeave == null && !_unAhuthorizeLeaveParamID.IsUnassigned && _unAhuthorizeLeave.ID.Integer > 0)
{
_unAhuthorizeLeave = UnAuthorizeLeave.Get(_unAhuthorizeLeaveParamID);
}
return _unAhuthorizeLeave;
}
}
#endregion
#region AllowanceID : ID
private ID _allowanceID;
public ID AllowanceID
{
get { return _allowanceID; }
set
{
base.OnPropertyChange<ID>("AllowanceID", _allowanceID, value);
_allowanceID = value;
}
}
#endregion
#region LeaveID : ID
private ID _leaveID;
public ID LeaveID
{
get { return _leaveID; }
set
{
base.OnPropertyChange<ID>("AllowanceID", _leaveID, value);
_leaveID = value;
}
}
#endregion
#region valueInPercent : double
private double _valueInPercent;
public double ValueInPercent
{
get { return _valueInPercent; }
set
{
base.OnPropertyChange<double>("valueInPercent", _valueInPercent, value);
_valueInPercent = value;
}
}
#endregion
#region Type : EnumUnAuthorizedLeave
private EnumSalaryComponent _Type = EnumSalaryComponent.Basic;
public EnumSalaryComponent Type
{
get { return _Type; }
set
{
base.OnPropertyChange<short>("type", (short)_Type, (short)value);
_Type = value;
}
}
#endregion
#region Service Factory IUnAuthorizeLeaveParameterService : IUnAuthorizeLeaveParameterService
internal static IUnAuthorizeLeaveParameterService Service
{
get { return Services.Factory.CreateService<IUnAuthorizeLeaveParameterService>(typeof(IUnAuthorizeLeaveParameterService)); }
}
#endregion
#endregion
#region Functions
public static UnAuthorizeLeaveParamDetail Get(ID nID)
{
UnAuthorizeLeaveParamDetail oUnAuthorizeLeaveParameter = null;
#region Cache Header
oUnAuthorizeLeaveParameter = (UnAuthorizeLeaveParamDetail)_cache["Get", nID];
if (oUnAuthorizeLeaveParameter != null)
return oUnAuthorizeLeaveParameter;
#endregion
oUnAuthorizeLeaveParameter = UnAuthorizeLeaveParamDetail.Service.Get(nID);
#region Cache Footer
_cache.Add(oUnAuthorizeLeaveParameter, "Get", nID);
#endregion
return oUnAuthorizeLeaveParameter;
}
public static ObjectsTemplate<UnAuthorizeLeaveParamDetail> Get()
{
#region Cache Header
ObjectsTemplate<UnAuthorizeLeaveParamDetail> unAuthorizeLeaveParameters = _cache["Get"] as ObjectsTemplate<UnAuthorizeLeaveParamDetail>;
if (unAuthorizeLeaveParameters != null)
return unAuthorizeLeaveParameters;
#endregion
try
{
unAuthorizeLeaveParameters = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(unAuthorizeLeaveParameters, "Get");
#endregion
return unAuthorizeLeaveParameters;
}
public static ObjectsTemplate<UnAuthorizeLeaveParamDetail> GetByParamID(ID nParamID)
{
#region Cache Header
ObjectsTemplate<UnAuthorizeLeaveParamDetail> unAuthorizeLeaveParameters = _cache["GetByParamID", nParamID] as ObjectsTemplate<UnAuthorizeLeaveParamDetail>;
if (unAuthorizeLeaveParameters != null)
return unAuthorizeLeaveParameters;
#endregion
try
{
unAuthorizeLeaveParameters = Service.GetDetail(nParamID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(unAuthorizeLeaveParameters, "GetByParamID", nParamID);
#endregion
return unAuthorizeLeaveParameters;
}
#endregion
}
#endregion
#region IUnAuthorizeLeaveParameter Service
public interface IUnAuthorizeLeaveParameterService
{
UnAuthorizeLeaveParamDetail Get(ID id);
ObjectsTemplate<UnAuthorizeLeaveParamDetail> Get();
ObjectsTemplate<UnAuthorizeLeaveParamDetail> GetDetail(ID nUnLeaveParamID);
}
#endregion
}