449 lines
13 KiB
C#
449 lines
13 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Data;
|
|
using Ease.Core;
|
|
using Ease.CoreV35;
|
|
using Ease.Core.Utility;
|
|
|
|
namespace HRM.BO
|
|
{
|
|
#region Class LoanSchedule
|
|
[Serializable]
|
|
public class FmLoanSchedule : AuditTrailBase
|
|
{
|
|
#region Constructor
|
|
public FmLoanSchedule()
|
|
{
|
|
ActivityID = 0;
|
|
CustomerID = 0;
|
|
EffectiveBalance = 0.0;
|
|
//_closingBalance = 0.0;
|
|
InstallmentAmount = 0.0;
|
|
InstallmentInterest = 0.0;
|
|
InstallmentPrincipal = 0.0;
|
|
LoanCategoryID = 0;
|
|
LoanID = 0;
|
|
PayDate = DateTime.MinValue;
|
|
ScheduledPayDate = DateTime.MinValue;
|
|
SerialNo = 0;
|
|
ProjectID = 0;//Ease.CoreV35.Model.ID.FromInteger(FM.BO.Common.User.CurrentMasterParam.ID.Integer);
|
|
}
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region Property ActivityID : ID
|
|
public int ActivityID { get; set; }
|
|
//private ID _activityID;
|
|
//public ID ActivityID
|
|
//{
|
|
// get { return _activityID; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<ID>("ActivityID", _activityID, value);
|
|
// _activityID = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property ActivityID : ID
|
|
|
|
#region Property CustomerID : ID
|
|
public int CustomerID { get; set; }
|
|
//private ID _customerID;
|
|
//public ID CustomerID
|
|
//{
|
|
// get { return _customerID; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<ID>("CustomerID", _customerID, value);
|
|
// _customerID = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property CustomerID : ID
|
|
|
|
#region Property LoanCustomer : LoanCustomer
|
|
// public LoanCustomer LoanCustomer { get; set; }
|
|
|
|
//private LoanCustomer _loanCustomer;
|
|
//public LoanCustomer LoanCustomer
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_loanCustomer == null && !_customerID.IsUnassigned && _customerID.Integer > 0)
|
|
// {
|
|
// _loanCustomer = new LoanCustomer();
|
|
// _loanCustomer = _loanCustomer.Get(_customerID);
|
|
// }
|
|
|
|
// return _loanCustomer;
|
|
// }
|
|
|
|
// set
|
|
// {
|
|
// _loanCustomer = value;
|
|
// _customerID = (_customerID == null ? null : _loanCustomer.ID);
|
|
// }
|
|
//}
|
|
|
|
#endregion Property LoanCustomer : LoanCustomer
|
|
|
|
#region Property EffectiveBalance : double
|
|
public double EffectiveBalance { get; set; }
|
|
//private double _effectiveBalance;
|
|
//public double EffectiveBalance
|
|
//{
|
|
// get { return _effectiveBalance; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<double>("EffectiveBalance", _effectiveBalance, value);
|
|
// _effectiveBalance = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property EffectiveBalance : double
|
|
|
|
#region Property ClosingBalance : double
|
|
|
|
//private double _closingBalance;
|
|
//public double ClosingBalance
|
|
//{
|
|
// get { return _closingBalance; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<double>("ClosingBalance", _closingBalance, value);
|
|
// _closingBalance = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property ClosingBalance : double
|
|
|
|
#region Property InstallmentAmount : double
|
|
public double InstallmentAmount { get; set; }
|
|
//private double _installmentAmount;
|
|
//public double InstallmentAmount
|
|
//{
|
|
// get { return _installmentAmount; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<double>("InstallmentAmount", _installmentAmount, value);
|
|
// _installmentAmount = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property InstallmentAmount : double
|
|
|
|
#region Property InstallmentInterest : double
|
|
public double InstallmentInterest { get; set; }
|
|
//private double _installmentInterest;
|
|
//public double InstallmentInterest
|
|
//{
|
|
// get { return _installmentInterest; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<double>("InstallmentInterest", _installmentInterest, value);
|
|
// _installmentInterest = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property InstallmentInterest : double
|
|
|
|
#region Property InstallmentPrincipal : double
|
|
public double InstallmentPrincipal { get; set; }
|
|
//private double _installmentPrincipal;
|
|
//public double InstallmentPrincipal
|
|
//{
|
|
// get { return _installmentPrincipal; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<double>("InstallmentPrincipal", _installmentPrincipal, value);
|
|
// _installmentPrincipal = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property InstallmentPrincipal : double
|
|
|
|
#region Property LoanCategory : LoanCategory
|
|
public LoanCategory LoanCategory { get; set; }
|
|
//private LoanCategory _loanCategory;
|
|
//public LoanCategory LoanCategory
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_loanCategory == null && !_loanCategoryID.IsUnassigned && _loanCategoryID.Integer > 0)
|
|
// {
|
|
// _loanCategory = new LoanCategory();
|
|
// _loanCategory = _loanCategory.Get(_loanCategoryID, false);
|
|
// }
|
|
|
|
// return _loanCategory;
|
|
// }
|
|
// set
|
|
// {
|
|
// _loanCategory = value;
|
|
// _loanCategoryID = (_loanCategoryID == null ? null : _loanCategory.ID);
|
|
// }
|
|
//}
|
|
|
|
#endregion Property LoanCategory : LoanCategory
|
|
|
|
#region Property LoanCategoryID : ID
|
|
public int LoanCategoryID { get; set; }
|
|
//private ID _loanCategoryID;
|
|
//public ID LoanCategoryID
|
|
//{
|
|
// get { return _loanCategoryID; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<ID>("LoanCategoryID", _loanCategoryID, value);
|
|
// _loanCategoryID = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property LoanCategoryID : ID
|
|
|
|
#region Property LoanID : ID
|
|
public int LoanID { get; set; }
|
|
//private ID _loanID;
|
|
//public ID LoanID
|
|
//{
|
|
// get { return _loanID; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<ID>("LoanID", _loanID, value);
|
|
// _loanID = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property LoanID : ID
|
|
|
|
#region Property Loan : Loan
|
|
public FmLoan Loan { get; set; }
|
|
//private Loan _loan;
|
|
//public Loan Loan
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_loan == null && !_loanID.IsUnassigned && _loanID.Integer > 0)
|
|
// {
|
|
// _loan = new Loan();
|
|
// _loan = _loan.Get(_loanID, false, false, false);
|
|
// }
|
|
|
|
// return _loan;
|
|
// }
|
|
// set
|
|
// {
|
|
// _loan = value;
|
|
// _loanID = (_loanID == null ? null : _loan.ID);
|
|
// }
|
|
//}
|
|
|
|
#endregion Property Loan : Loan
|
|
|
|
#region Property PayDate : DateTime
|
|
public DateTime? PayDate { get; set; }
|
|
//private DateTime? _payDate;
|
|
//public DateTime? PayDate
|
|
//{
|
|
// get { return _payDate; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<DateTime>("PayDate", _payDate, value);
|
|
// _payDate = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property PayDate : DateTime
|
|
|
|
#region Property ScheduledPayDate : DateTime
|
|
public DateTime ScheduledPayDate { get; set; }
|
|
//private DateTime _scheduledPayDate;
|
|
//public DateTime ScheduledPayDate
|
|
//{
|
|
// get { return _scheduledPayDate; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<DateTime>("ScheduledpayDate", _scheduledPayDate, value);
|
|
// _scheduledPayDate = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property ScheduledPayDate : DateTime
|
|
|
|
#region Property SerialNo : int
|
|
public int SerialNo { get; set; }
|
|
//private int _serialNo;
|
|
//public int SerialNo
|
|
//{
|
|
// get { return _serialNo; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<int>("SerialNo", _serialNo, value);
|
|
// _serialNo = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property SerialNo : int
|
|
|
|
#region Property ProjectID : ID
|
|
public int ProjectID { get; set; }
|
|
//private ID _projectID;
|
|
//public ID ProjectID
|
|
//{
|
|
// get { return _projectID; }
|
|
// set
|
|
// {
|
|
// base.OnPropertyChange<ID>("ProjectID", _projectID, value);
|
|
// _projectID = value;
|
|
// }
|
|
//}
|
|
|
|
#endregion Property ProjectID : ID
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region Function
|
|
|
|
//public void Save()
|
|
//{
|
|
// try
|
|
// {
|
|
// //base.SetAuditTrailProperties();
|
|
// Service.Save(this);
|
|
|
|
// //Clear Cache
|
|
// CacheInfo.ClearCache(typeof(FmLoanSchedule).FullName);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public FmLoanSchedule Get(ID id)
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// FmLoanSchedule loanSchedule = _cache["Get", id] as FmLoanSchedule;
|
|
|
|
// if (loanSchedule != null)
|
|
// return loanSchedule;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// loanSchedule = Service.Get(id);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(loanSchedule, "Get", id);
|
|
|
|
// #endregion
|
|
|
|
// return loanSchedule;
|
|
//}
|
|
|
|
//public static ObjectsTemplate<FmLoanSchedule> Get()
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// ObjectsTemplate<FmLoanSchedule> LoanSchedules = _cache["Get"] as ObjectsTemplate<FmLoanSchedule>;
|
|
// 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 static DataTable GetTable()
|
|
//{
|
|
// try
|
|
// {
|
|
// return Service.GetTable();
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
//public void Delete(ID loanScheduleID)
|
|
//{
|
|
// try
|
|
// {
|
|
// Service.Delete(loanScheduleID);
|
|
|
|
// //Clear Cache
|
|
// CacheInfo.ClearCache(typeof(FmLoanSchedule).FullName);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
public double GetTotalPrinciple(List<FmLoanSchedule> loanSchedules)
|
|
{
|
|
double totalPrincipal = 0.0;
|
|
foreach (FmLoanSchedule loanSchedule in loanSchedules)
|
|
{
|
|
totalPrincipal = totalPrincipal + loanSchedule.InstallmentPrincipal;
|
|
}
|
|
return totalPrincipal;
|
|
}
|
|
|
|
//public static bool GetSchedule(DateTime dt)
|
|
//{
|
|
// try
|
|
// {
|
|
// return FmLoanSchedule.Service.GetSchedule(dt);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new ServiceException(e.Message, e);
|
|
// }
|
|
//}
|
|
|
|
#endregion
|
|
|
|
}
|
|
#endregion
|
|
|
|
/*public interface ILoanScheduleService
|
|
{
|
|
void Save(FmLoanSchedule loanSchedule);
|
|
void Delete(int loanScheduleID);
|
|
FmLoanSchedule Get(int loanScheduleID);
|
|
DataTable GetTable();
|
|
List<FmLoanSchedule> Get();
|
|
bool GetSchedule(DateTime dt);
|
|
}*/
|
|
}
|