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("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("AllowanceID", _allowanceID, value); _allowanceID = value; } } #endregion #region LeaveID : ID private ID _leaveID; public ID LeaveID { get { return _leaveID; } set { base.OnPropertyChange("AllowanceID", _leaveID, value); _leaveID = value; } } #endregion #region valueInPercent : double private double _valueInPercent; public double ValueInPercent { get { return _valueInPercent; } set { base.OnPropertyChange("valueInPercent", _valueInPercent, value); _valueInPercent = value; } } #endregion #region Type : EnumUnAuthorizedLeave private EnumSalaryComponent _Type = EnumSalaryComponent.Basic; public EnumSalaryComponent Type { get { return _Type; } set { base.OnPropertyChange("type", (short)_Type, (short)value); _Type = value; } } #endregion #region Service Factory IUnAuthorizeLeaveParameterService : IUnAuthorizeLeaveParameterService internal static IUnAuthorizeLeaveParameterService Service { get { return Services.Factory.CreateService(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 Get() { #region Cache Header ObjectsTemplate unAuthorizeLeaveParameters = _cache["Get"] as ObjectsTemplate; 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 GetByParamID(ID nParamID) { #region Cache Header ObjectsTemplate unAuthorizeLeaveParameters = _cache["GetByParamID", nParamID] as ObjectsTemplate; 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 Get(); ObjectsTemplate GetDetail(ID nUnLeaveParamID); } #endregion }