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 LoanTransaction [Serializable] public class LoanTransaction : BasicBaseObject { #region Constructor public LoanTransaction() { CustomerID = 0; LoanID = 0; TranType = EnumLoanTransactionType.None; Amount = 0; LoanScheduleID = 0; PaymentDate = DateTime.MinValue; ProjectID = 0; //ProjectID = Ease.CoreV35.Model.ID.FromInteger(FM.BO.Common.User.CurrentMasterParam.ID.Integer); } #endregion #region Properties #region Property CustomerID : ID public int CustomerID { get; set; } //private ID _customerID; //public ID CustomerID //{ // get { return _customerID; } // set // { // base.OnPropertyChange("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 LoanID : ID public int LoanID { get; set; } //private ID _loanID; //public ID LoanID //{ // get { return _loanID; } // set // { // base.OnPropertyChange("LoanID", _loanID, value); // _loanID = value; // } //} #endregion Property LoanID : ID #region Property Loan : Loan //public Loan 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 TranType : EnumLoanTransactionType public EnumLoanTransactionType TranType { get; set; } //private EnumLoanTransactionType _tranType; //public EnumLoanTransactionType TranType //{ // get { return _tranType; } // set // { // base.OnPropertyChange("TranType", (short)_tranType, (short)value); // _tranType = value; // } //} #endregion Property TranType : EnumLoanTransactionType #region Property Amount : double public double Amount { get; set; } //private double _amount; //public double Amount //{ // get { return _amount; } // set // { // base.OnPropertyChange("Amount", _amount, value); // _amount = value; // } //} #endregion Property Amount : double #region Property LoanScheduleID : ID public int LoanScheduleID { get; set; } //private ID _loanScheduleID; //public ID LoanScheduleID //{ // get { return _loanScheduleID; } // set // { // base.OnPropertyChange("LoanScheduleID", _loanScheduleID, value); // _loanScheduleID = value; // } //} #endregion Property LoanScheduleID : ID #region Property LoanSchedule : LoanSchedule public FmLoanSchedule LoanSchedule { get; set; } //private LoanSchedule _loanSchedule; //public LoanSchedule LoanSchedule //{ // get // { // if (_loanSchedule == null && !_loanScheduleID.IsUnassigned && _loanScheduleID.Integer > 0) // { // _loanSchedule = new LoanSchedule(); // _loanSchedule = _loanSchedule.Get(_loanScheduleID); // } // return _loanSchedule; // } // set // { // _loanSchedule = value; // _loanScheduleID = (_loanScheduleID == null ? null : _loanSchedule.ID); // } //} #endregion Property Loan : Loan #region Property PaymentDate : DateTime public DateTime PaymentDate { get; set; } //private DateTime _paymentDate; //public DateTime PaymentDate //{ // get { return _paymentDate; } // set // { // base.OnPropertyChange("PaymentDate", _paymentDate, value); // _paymentDate = value; // } //} #endregion Property PaymentDate : DateTime #region Property ProjectID : ID public int ProjectID { get; set; } //private ID _projectID; //public ID ProjectID //{ // get { return _projectID; } // set // { // base.OnPropertyChange("ProjectID", _projectID, value); // _projectID = value; // } //} #endregion Property ProjectID : ID #endregion //#region Function //public void Save() //{ // try // { // base.SetAuditTrailProperties(GlobalFunctions.GetServerDate().Date, User.CurrentUser.ID); // Service.Save(this); // //Clear Cache // CacheInfo.ClearCache(typeof(LoanTransaction).FullName); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } //} //public LoanTransaction Get(ID id) //{ // #region Cache Header // LoanTransaction loanTransaction = _cache["Get", id] as LoanTransaction; // if (loanTransaction != null) // return loanTransaction; // #endregion // try // { // loanTransaction = Service.Get(id); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(loanTransaction, "Get", id); // #endregion // return loanTransaction; //} //public static ObjectsTemplate Get() //{ // #region Cache Header // ObjectsTemplate loanTransactions = _cache["Get"] as ObjectsTemplate; // if (loanTransactions != null) // return loanTransactions; // #endregion // try // { // loanTransactions = Service.Get(); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(loanTransactions, "Get"); // #endregion // return loanTransactions; //} //public static DataTable GetTable() //{ // try // { // return Service.GetTable(); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } //} //public void Delete(ID loanTransactionID) //{ // try // { // Service.Delete(loanTransactionID); // //Clear Cache // CacheInfo.ClearCache(typeof(LoanTransaction).FullName); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } //} //#endregion public LoanTransaction CreateLoanTransaction(LoanTransaction loanTran, int cusID, int loanID, EnumLoanTransactionType tranType, double amount, int scheduleID, DateTime paymentDate, int createdBy, DateTime createdDate) { LoanTransaction loanTransaction = loanTran; try { loanTransaction.CustomerID = cusID; loanTransaction.LoanID = loanID; loanTransaction.TranType = tranType; loanTransaction.Amount = amount; loanTransaction.LoanScheduleID = scheduleID; loanTransaction.PaymentDate = paymentDate; loanTransaction.CreatedBy = createdBy; loanTransaction.CreatedDate = createdDate; } catch (Exception e) { throw e; } return loanTransaction; } } #endregion public interface ILoanTransactionService { void Save(LoanTransaction loanTransaction); void Delete(int loanTransactionID); LoanTransaction Get(int loanTransactionID); DataTable GetTable(); List Get(); } }