using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.Core; using Ease.Core.Model; using System.Data; namespace HRM.BO { #region Loan Parameter public class LoanParameter : AuditTrailBase { public delegate void ItemChanged(); #region Constructor public LoanParameter() { //_loanID = null; //_noOfGross = 0; //_noOfBasic = 0; //_minInstallmentMonth = 0; //_maxInstallmentMonth = 0; //_minReconcileMonth = 0; //_minFlatAmount = 0.0; //_maxFlatAmount = 0.0; } #endregion #region Properties public double MinFlatAmount { get; set; } public double MaxFlatAmount { get; set; } public int LoanID { get; set; } public double NoOfGross { get; set; } public double NoOfBasic { get; set; } public int MinInstallmentMonth { get; set; } public int MaxInstallmentMonth { get; set; } public int MinReconcileMonth { get; set; } public List LoadGradesTemp { get; set; } //#region LoanGrades //private List _loanGrades; //public List LoadGradesTemp //{ // get // { // if (_loanGrades == null) // { // _loanGrades = LoanGrades.Service.GetLoanGrades(this.ID.Integer); // } // return _loanGrades; // } // set // { // _loanGrades = value; // } //} //#endregion public List LoadDocsTemp { get; set; } //#region LoanDoc //private List _loanDocs; //public List LoadDocsTemp //{ // get // { // if (_loanDocs == null) // { // _loanDocs = LoanDoc.Service.GetLoanDoc(this.ID.Integer); // } // return _loanDocs; // } // set // { // _loanDocs = value; // } //} //#endregion public int PayrollTypeID { get; set; } #endregion // #region Service Factory ILoanParameterService : ILoanParameterService // internal static ILoanParameterService Service // { // get { return Services.Factory.CreateService(typeof(ILoanParameterService)); } // } // #endregion // #region Functions // public static LoanParameter GetApplicableParameter(Employee oemployee, ID loanid) // { // List opss = LoanParameter.Get(); // LoanParameter oparamter = GetApplicableParameter(oemployee, oemployee.GradeID, opss, loanid); // return oparamter; // } // public static List GetApplicableParameters(Employee employee, //ID graId, List parameters) // { // List applicableParams = parameters.FindAll(delegate(LoanParameter param) { return IsApplicable(param, graId, employee); }); // return applicableParams; // } // public static LoanParameter GetApplicableParameter(Employee employee, // ID graId, List parameters) // { // foreach (LoanParameter item in parameters) // { // if (IsApplicable(item, graId, employee) == true) // return item; // } // return null; // } // public static LoanParameter GetApplicableParameter(Employee employee, // ID graId, List parameters, ID loanid) // { // foreach (LoanParameter item in parameters) // { // if (item.LoanID == loanid) // { // if (IsApplicable(item, graId, employee) == true) // return item; // } // } // return null; // } // private static bool IsApplicable(LoanParameter param, ID graid, Employee employee) // { // bool isApplicable = false; // foreach (LoanGrades adgrade in param.LoadGradesTemp) // { // if (adgrade.GradeID.Integer == graid.Integer) // { // isApplicable = true; // } // } // if (!isApplicable) return false; // return true; // } // public static LoanParameter Get(ID nID) // { // LoanParameter oLoanParameter = null; // #region Cache Header // oLoanParameter = (LoanParameter)_cache["Get", nID]; // if (oLoanParameter != null) // return oLoanParameter; // #endregion // oLoanParameter = LoanParameter.Service.Get(nID, SystemInformation.CurrentSysInfo.PayrollTypeID); // #region Cache Footer // _cache.Add(oLoanParameter, "Get", nID); // #endregion // return oLoanParameter; // } // public static List Get() // { // #region Cache Header // List loanParameters = _cache["Get"] as List; // if (loanParameters != null) // return loanParameters; // #endregion // try // { // loanParameters = Service.Get(SystemInformation.CurrentSysInfo.PayrollTypeID); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(loanParameters, "Get"); // #endregion // return loanParameters; // } // public ID Save() // { // base.SetAuditTrailProperties(); // return LoanParameter.Service.Save(this, SystemInformation.CurrentSysInfo.PayrollTypeID); // } // public void Delete() // { // LoanParameter.Service.Delete(ID); // } // public static List GetLoanGrades(int loanParameterID) // { // List oLoanGrades = null; // oLoanGrades = Service.GetLoanGrades(loanParameterID); // return oLoanGrades; // } // public static List GetLoanDoc(int loanParameterID) // { // List oLoanDoc = null; // oLoanDoc = Service.GetLoanDoc(loanParameterID); // return oLoanDoc; // } // #endregion } #endregion #region ILoanParameterService Service public interface ILoanParameterService { LoanParameter Get(int id, int payrollTypeID); List Get(int payrollTypeID); int Save(LoanParameter item, int payrollTypeID); void Delete(int id); List GetLoanGrades(int loanParameterID); List GetLoanDoc(int loanParameterID); } #endregion }