EchoTex_Payroll/HRM.BO/Loan/LoanParameter.cs
2024-10-14 10:01:49 +06:00

245 lines
7.1 KiB
C#

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<LoanGrades> LoadGradesTemp { get; set; }
//#region LoanGrades
//private List<LoanGrades> _loanGrades;
//public List<LoanGrades> LoadGradesTemp
//{
// get
// {
// if (_loanGrades == null)
// {
// _loanGrades = LoanGrades.Service.GetLoanGrades(this.ID.Integer);
// }
// return _loanGrades;
// }
// set
// {
// _loanGrades = value;
// }
//}
//#endregion
public List<LoanDoc> LoadDocsTemp { get; set; }
//#region LoanDoc
//private List<LoanDoc> _loanDocs;
//public List<LoanDoc> 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<ILoanParameterService>(typeof(ILoanParameterService)); }
// }
// #endregion
// #region Functions
// public static LoanParameter GetApplicableParameter(Employee oemployee, ID loanid)
// {
// List<LoanParameter> opss = LoanParameter.Get();
// LoanParameter oparamter = GetApplicableParameter(oemployee, oemployee.GradeID, opss, loanid);
// return oparamter;
// }
// public static List<LoanParameter> GetApplicableParameters(Employee employee,
//ID graId, List<LoanParameter> parameters)
// {
// List<LoanParameter> applicableParams = parameters.FindAll(delegate(LoanParameter param) { return IsApplicable(param, graId, employee); });
// return applicableParams;
// }
// public static LoanParameter GetApplicableParameter(Employee employee,
// ID graId, List<LoanParameter> 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<LoanParameter> 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<LoanParameter> Get()
// {
// #region Cache Header
// List<LoanParameter> loanParameters = _cache["Get"] as List<LoanParameter>;
// 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<LoanGrades> GetLoanGrades(int loanParameterID)
// {
// List<LoanGrades> oLoanGrades = null;
// oLoanGrades = Service.GetLoanGrades(loanParameterID);
// return oLoanGrades;
// }
// public static List<LoanDoc> GetLoanDoc(int loanParameterID)
// {
// List<LoanDoc> oLoanDoc = null;
// oLoanDoc = Service.GetLoanDoc(loanParameterID);
// return oLoanDoc;
// }
// #endregion
}
#endregion
#region ILoanParameterService Service
public interface ILoanParameterService
{
LoanParameter Get(int id, int payrollTypeID);
List<LoanParameter> Get(int payrollTypeID);
int Save(LoanParameter item, int payrollTypeID);
void Delete(int id);
List<LoanGrades> GetLoanGrades(int loanParameterID);
List<LoanDoc> GetLoanDoc(int loanParameterID);
}
#endregion
}