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 { [Serializable] public class UnAuthorizeLeaveParam : AuditTrailBase,ISetupManager { public UnAuthorizeLeaveParam() { } #region Cache Store private static Cache _cache = new Cache(typeof(UnAuthorizeLeaveParam)); #endregion #region Properties #region UnAhuthorizeLeaveID : ID private ID _unAhuthorizeLeaveID = null; public ID UnAhuthorizeLeaveID { get { return _unAhuthorizeLeaveID; } set { base.OnPropertyChange("UnAhuthorizeLeaveID", _unAhuthorizeLeaveID, value); _unAhuthorizeLeaveID = value; } } #endregion #region UnAhuthorizeLeave : UnAhuthorizeLeave private UnAuthorizeLeave _unAhuthorizeLeave = null; public UnAuthorizeLeave UnAuthorizeLeave { get { if (_unAhuthorizeLeave == null && !_unAhuthorizeLeaveID.IsUnassigned && _unAhuthorizeLeaveID.Integer > 0) { _unAhuthorizeLeave = UnAuthorizeLeave.Get(_unAhuthorizeLeaveID); } return _unAhuthorizeLeave; } } #endregion #region UnAhuthorizeLeaveDetails : UnAhuthorizeLeaveDetails private ObjectsTemplate _details = null; public ObjectsTemplate Details { get { if (_details == null && !this.ID.IsUnassigned && this.ID.Integer > 0) { _details = UnAuthorizeLeaveParamDetail.GetByParamID(this.ID); } if (_details == null) { _details = new ObjectsTemplate(); } return _details; } } #endregion #region Service Factory IUnAuthorizeLeaveParameterService : IUnAuthorizeLeaveParameterService internal static IUnAuthorizeLeaveParamService Service { get { return Services.Factory.CreateService(typeof(IUnAuthorizeLeaveParamService)); } } #endregion #endregion #region Function public ID Save() { this.SetAuditTrailProperties(); return Service.Save(this); } public void Delete() { Service.Delete(this.ID); } public static UnAuthorizeLeaveParam Get(ID id) { return Service.Get(id); } public static ObjectsTemplate Get() { return Service.Get(); } public static ObjectsTemplate GetByLeaveID(ID nLeaveID) { return Service.GetByLeaveID(nLeaveID); } public static UnAuthorizeLeaveParamDetail GetItem(UnAuthorizeLeaveParam leaveParam, int componentID) { foreach (UnAuthorizeLeaveParamDetail item in leaveParam.Details) { if (item.AllowanceID.Integer == componentID) { return item; } } return null; } #endregion #region ISetupManager Members private ObjectsTemplate _setupDetails; public ObjectsTemplate SetupDetails { get { return _setupDetails; } set { _setupDetails = value; } } public EmployeeSetupParameter ApplicableParameters(Employee employee) { EmployeeSetupParameter empParameter = new EmployeeSetupParameter(EnumParameterSetup.SalaryDeduct); empParameter.Employee = employee; empParameter.ParameterIDs = SetupManager.ApplicableParameters(employee, EnumParameterSetup.SalaryDeduct); return empParameter; } public List ApplicableParameters(ObjectsTemplate employees) { ObjectsTemplate details = SetupDetail.GetParameters(EnumParameterSetup.SalaryDeduct); List types = SetupDetail.GetTypes(EnumParameterSetup.SalaryDeduct); List empParametes = new List(); foreach (Employee emp in employees) { EmployeeSetupParameter empparameter = new EmployeeSetupParameter(EnumParameterSetup.SalaryDeduct); empparameter.Employee = emp; empparameter.ParameterIDs = SetupManager.ApplicableParameters(emp, EnumParameterSetup.SalaryDeduct, types, details); empParametes.Add(empparameter); } return empParametes; } public void FillMe(ID id) { UnAuthorizeLeaveParam tpm = UnAuthorizeLeaveParam.Get(id); this.UnAhuthorizeLeaveID = tpm.UnAhuthorizeLeaveID; this.CreatedBy = tpm.CreatedBy; this.CreatedDate = tpm.CreatedDate; this.ModifiedBy = tpm.ModifiedBy; this.ModifiedDate = tpm.ModifiedDate; this.SetID(tpm.ID); this.SetState(ObjectState.Saved); } #endregion } #region IUnAuthorizeLeaveParameter Service public interface IUnAuthorizeLeaveParamService { UnAuthorizeLeaveParam Get(ID id); ObjectsTemplate Get(); ID Save(UnAuthorizeLeaveParam item); void Delete(ID id); ObjectsTemplate GetByLeaveID(ID nLeaveID); } #endregion }