494 lines
12 KiB
C#
494 lines
12 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Data;
|
|||
|
using Ease.CoreV35;
|
|||
|
using Ease.CoreV35.Model;
|
|||
|
using Ease.CoreV35.Caching;
|
|||
|
using System.Data.Linq.Mapping;
|
|||
|
|
|||
|
namespace Payroll.BO
|
|||
|
{
|
|||
|
#region LoanSchedule
|
|||
|
|
|||
|
[Serializable]
|
|||
|
public class LoanSchedule:AuditTrailBase
|
|||
|
{
|
|||
|
#region Cache Store
|
|||
|
|
|||
|
private static Cache _cache = new Cache(typeof(LoanSchedule));
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Constructor
|
|||
|
|
|||
|
public LoanSchedule()
|
|||
|
{
|
|||
|
_loanIssueID = null;
|
|||
|
_employeeID = null;
|
|||
|
_scheduleNo = 0;
|
|||
|
_openingBalance = 0;
|
|||
|
_installmentPrincipal = 0;
|
|||
|
_installmentInterest = 0;
|
|||
|
_dueInstallmentDate = DateTime.MinValue;
|
|||
|
_paymentDate = null;
|
|||
|
_days = 0;
|
|||
|
_calculatedDate = DateTime.MinValue;
|
|||
|
_actualInterest = 0;
|
|||
|
_closingBalance = 0;
|
|||
|
_loanIssue = null;
|
|||
|
_isPaid = false;
|
|||
|
_interestRate = 0;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Properties
|
|||
|
|
|||
|
#region LoanIssueID : ID
|
|||
|
|
|||
|
private ID _loanIssueID;
|
|||
|
public ID LoanIssueID
|
|||
|
{
|
|||
|
get { return _loanIssueID; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("LoanIssueID", _loanIssueID, value);
|
|||
|
_loanIssueID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region EmployeeID : ID
|
|||
|
|
|||
|
private ID _employeeID;
|
|||
|
public ID EmployeeID
|
|||
|
{
|
|||
|
get { return _employeeID; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<ID>("EmployeeID", _employeeID, value);
|
|||
|
_employeeID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region scheduleNo : int
|
|||
|
|
|||
|
private int _scheduleNo;
|
|||
|
public int ScheduleNo
|
|||
|
{
|
|||
|
get { return _scheduleNo; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<int>("scheduleNo", _scheduleNo, value);
|
|||
|
_scheduleNo = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region scheduleNo : int
|
|||
|
|
|||
|
private bool _bPaid;
|
|||
|
public bool Paid
|
|||
|
{
|
|||
|
get { return (_paymentDate!=null); }
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region openingBalance : double
|
|||
|
|
|||
|
private double _openingBalance;
|
|||
|
public double OpeningBalance
|
|||
|
{
|
|||
|
get { return _openingBalance; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<double>("openingBalance", _openingBalance, value);
|
|||
|
_openingBalance = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region installment : double
|
|||
|
|
|||
|
private double _installment;
|
|||
|
public double Installment
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _installmentPrincipal + _installmentInterest;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region installmentPrincipal : double
|
|||
|
|
|||
|
private double _installmentPrincipal;
|
|||
|
public double InstallmentPrincipal
|
|||
|
{
|
|||
|
get { return _installmentPrincipal; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<double>("installmentPrincipal", _installmentPrincipal, value);
|
|||
|
_installmentPrincipal = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region installmentInterest : double
|
|||
|
|
|||
|
private double _installmentInterest;
|
|||
|
public double InstallmentInterest
|
|||
|
{
|
|||
|
get { return _installmentInterest; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<double>("installmentInterest", _installmentInterest, value);
|
|||
|
_installmentInterest = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region dueInstallmentDate : DateTime
|
|||
|
|
|||
|
private DateTime _dueInstallmentDate;
|
|||
|
public DateTime DueInstallmentDate
|
|||
|
{
|
|||
|
get { return _dueInstallmentDate; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<DateTime>("dueInstallmentDate", _dueInstallmentDate, value);
|
|||
|
_dueInstallmentDate = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region paymentDate : System.DateTime
|
|||
|
|
|||
|
private DateTime? _paymentDate;
|
|||
|
public DateTime? PaymentDate
|
|||
|
{
|
|||
|
get { return _paymentDate; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<System.DateTime>("paymentDate", _paymentDate, value);
|
|||
|
_paymentDate = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region paymentDate : System.DateTime
|
|||
|
|
|||
|
private EnumLoanPaymentMode _paymentMode;
|
|||
|
public EnumLoanPaymentMode PaymentMode
|
|||
|
{
|
|||
|
get { return _paymentMode; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<short >("PaymentMode",(short) _paymentMode,(short) value);
|
|||
|
_paymentMode = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
#region days : int
|
|||
|
|
|||
|
private int _days;
|
|||
|
public int Days
|
|||
|
{
|
|||
|
get { return _days; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<int>("days", _days, value);
|
|||
|
_days = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region calculatedDate : DateTime
|
|||
|
|
|||
|
private DateTime _calculatedDate;
|
|||
|
public DateTime CalculatedDate
|
|||
|
{
|
|||
|
get { return _calculatedDate; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<DateTime>("calculatedDate", _calculatedDate, value);
|
|||
|
_calculatedDate = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region actualInterest : double
|
|||
|
|
|||
|
private double _actualInterest;
|
|||
|
public double ActualInterest
|
|||
|
{
|
|||
|
get { return _actualInterest; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<double>("actualInterest", _actualInterest, value);
|
|||
|
_actualInterest = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region closingBalance : double
|
|||
|
|
|||
|
private double _closingBalance;
|
|||
|
public double ClosingBalance
|
|||
|
{
|
|||
|
get { return _closingBalance; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<double>("closingBalance", _closingBalance, value);
|
|||
|
_closingBalance = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region loanIssue : LoanIssue
|
|||
|
|
|||
|
private LoanIssue _loanIssue;
|
|||
|
public LoanIssue LoanIssue
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_loanIssueID.Integer > 0 && _loanIssue == null)
|
|||
|
{
|
|||
|
_loanIssue = new LoanIssue();
|
|||
|
_loanIssue = LoanIssue.Get(_loanIssueID);
|
|||
|
}
|
|||
|
return this._loanIssue;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_loanIssue = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region IsPaid : bool
|
|||
|
|
|||
|
private bool _isPaid;
|
|||
|
public bool IsPaid
|
|||
|
{
|
|||
|
get { return _isPaid; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<bool>("IsPaid", _isPaid, value);
|
|||
|
_isPaid = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region InterestRate : double
|
|||
|
|
|||
|
private double _interestRate;
|
|||
|
public double InterestRate
|
|||
|
{
|
|||
|
get { return _interestRate; }
|
|||
|
set
|
|||
|
{
|
|||
|
base.OnPropertyChange<double>("InterestRate", _interestRate, value);
|
|||
|
_interestRate = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Service Factory ILoanScheduleService : ILoanScheduleService
|
|||
|
|
|||
|
internal static ILoanScheduleService Service
|
|||
|
{
|
|||
|
get { return Services.Factory.CreateService<ILoanScheduleService>(typeof(ILoanScheduleService)); }
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Functions
|
|||
|
|
|||
|
public static LoanSchedule Get(ID nID)
|
|||
|
{
|
|||
|
LoanSchedule oLoanSchedule = null;
|
|||
|
#region Cache Header
|
|||
|
oLoanSchedule = (LoanSchedule)_cache["Get", nID];
|
|||
|
if (oLoanSchedule != null)
|
|||
|
return oLoanSchedule;
|
|||
|
#endregion
|
|||
|
oLoanSchedule = LoanSchedule.Service.Get(nID);
|
|||
|
#region Cache Footer
|
|||
|
_cache.Add(oLoanSchedule, "Get", nID);
|
|||
|
#endregion
|
|||
|
return oLoanSchedule;
|
|||
|
}
|
|||
|
public static DataSet GetByEmpIDANDLoanID(int EmpID, int LoanID)
|
|||
|
{
|
|||
|
DataSet ds = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
ds = Service.GetByEmpIDANDLoanID(EmpID, LoanID);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<LoanSchedule> Get()
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<LoanSchedule> loanSchedules = _cache["Get"] as ObjectsTemplate<LoanSchedule>;
|
|||
|
if (loanSchedules != null)
|
|||
|
return loanSchedules;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
loanSchedules = Service.Get();
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(loanSchedules, "Get");
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return loanSchedules;
|
|||
|
}
|
|||
|
public void setId(ID newId)
|
|||
|
{
|
|||
|
this.SetID(newId);
|
|||
|
}
|
|||
|
public static ObjectsTemplate<LoanSchedule> GetByIssueIDAndMonth(ID nIssueID, DateTime dateTime)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<LoanSchedule> loanSchedules = _cache["GetByIssueIDAndMonth", nIssueID, dateTime] as ObjectsTemplate<LoanSchedule>;
|
|||
|
if (loanSchedules != null)
|
|||
|
return loanSchedules;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
loanSchedules = Service.GetByIssueIDAndMonth(nIssueID, dateTime);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(loanSchedules, "GetByIssueIDAndMonth", nIssueID, dateTime);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return loanSchedules;
|
|||
|
}
|
|||
|
|
|||
|
public static DataSet GetLoanPaymentDue(DateTime dFromDate, DateTime dToDate)
|
|||
|
{
|
|||
|
|
|||
|
DataSet loanSchedules = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
loanSchedules = Service.GetLoanPaymentDue(dFromDate, dToDate);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
return loanSchedules;
|
|||
|
}
|
|||
|
public static ObjectsTemplate<LoanSchedule> GetByIssueID(ID nIssueID)
|
|||
|
{
|
|||
|
#region Cache Header
|
|||
|
|
|||
|
ObjectsTemplate<LoanSchedule> loanSchedules = _cache["GetByIssueID", nIssueID] as ObjectsTemplate<LoanSchedule>;
|
|||
|
if (loanSchedules != null)
|
|||
|
return loanSchedules;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
loanSchedules = Service.GetByIssueID(nIssueID);
|
|||
|
}
|
|||
|
catch (ServiceException e)
|
|||
|
{
|
|||
|
throw new Exception(e.Message, e);
|
|||
|
}
|
|||
|
|
|||
|
#region Cache Footer
|
|||
|
|
|||
|
_cache.Add(loanSchedules, "GetByIssueID", nIssueID);
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
return loanSchedules;
|
|||
|
}
|
|||
|
|
|||
|
public ID Save()
|
|||
|
{
|
|||
|
return LoanSchedule.Service.Save(this);
|
|||
|
}
|
|||
|
public void Delete()
|
|||
|
{
|
|||
|
LoanSchedule.Service.Delete(ID);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region ILoanSchedule Service
|
|||
|
|
|||
|
public interface ILoanScheduleService
|
|||
|
{
|
|||
|
LoanSchedule Get(ID id);
|
|||
|
DataSet GetByEmpIDANDLoanID(int EmpID, int LoanID);
|
|||
|
ObjectsTemplate<LoanSchedule> Get();
|
|||
|
ID Save(LoanSchedule item);
|
|||
|
void Delete(ID id);
|
|||
|
ObjectsTemplate<LoanSchedule> GetByIssueID(ID nIssueID);
|
|||
|
ObjectsTemplate<LoanSchedule> GetByIssueIDAndMonth(ID nIssueID, DateTime dateTime);
|
|||
|
DataSet GetLoanPaymentDue(DateTime dFromDate,DateTime dToDate);
|
|||
|
DataSet GetScheduleForSalary(DateTime monthDate, ID payrollTypeID);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|