CEL_Payroll/Payroll.BO/Loan/LoanSettlement.cs

316 lines
7.7 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ease.CoreV35;
using Ease.CoreV35.Model;
using Ease.CoreV35.Caching;
using System.Data.Linq.Mapping;
namespace Payroll.BO
{
#region LoanSettlement
[Serializable]
public class LoanSettlement : AuditTrailBase, IworkflowInterface
{
#region Cache Store
private static Cache _cache = new Cache(typeof(LoanSettlement));
#endregion
#region Constructor
public LoanSettlement()
{
_loanIssueID = null;
_settledAmount = 0;
_bankID = null;
_branchID = null;
_chequeNo = string.Empty;
_accountNo = string.Empty;
_submitDate = DateTime.MinValue;
_remarks = string.Empty;
_wfStatus = enumwfStatus.Not_yet_Submitted;
}
#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 WfStatus : enumwfststus
private enumwfStatus _wfStatus;
public enumwfStatus WFStatus
{
get { return _wfStatus; }
set
{
base.OnPropertyChange<short>("wfStatus", (short)_wfStatus, (short)value);
_wfStatus = value;
}
}
#endregion
#region SettledAmount : double
private double _settledAmount;
public double SettledAmount
{
get { return _settledAmount; }
set
{
base.OnPropertyChange<double>("settledAmount", _settledAmount, value);
_settledAmount = value;
}
}
#endregion
#region bankID : ID
private ID _bankID;
public ID BankID
{
get { return _bankID; }
set
{
base.OnPropertyChange<ID>("bankID", _bankID, value);
_bankID = value;
}
}
#endregion
#region BranchID : ID
private ID _branchID;
public ID BranchID
{
get { return _branchID; }
set
{
base.OnPropertyChange<ID>("branchID", _branchID, value);
_branchID = value;
}
}
#endregion
#region ChequeNo : string
private string _chequeNo;
public string ChequeNo
{
get { return _chequeNo; }
set
{
base.OnPropertyChange<string>("chequeNo", _chequeNo, value);
_chequeNo = value;
}
}
#endregion
#region AccountNo : string
private string _accountNo;
public string AccountNo
{
get { return _accountNo; }
set
{
base.OnPropertyChange<string>("chequeNo", _accountNo, value);
_accountNo = value;
}
}
#endregion
#region SubmitDate : DateTime
private DateTime _submitDate;
public DateTime SubmitDate
{
get { return _submitDate; }
set
{
base.OnPropertyChange<DateTime>("SubmitDate", _submitDate, value);
_submitDate = value;
}
}
#endregion
#region Remarks : string
private string _remarks;
public string Remarks
{
get { return _remarks; }
set
{
base.OnPropertyChange<string>("Remarks", _remarks, value);
_remarks = value;
}
}
#endregion
#endregion
public string WFDesciption()
{
return this.ObjectDescription;
}
public int GetStatusbyWf(enumwfStatus wfstatus)
{
return (int)this.WFStatus;
}
#region employee : Employee
private Employee _employee;
public Employee Employee
{
get
{
if (_loanIssueID.Integer > 0 )
{
LoanIssue ls = LoanIssue.Get(_loanIssueID);
_employee = new Employee();
_employee = Employee.Get(ls.EmployeeID);
}
return this._employee;
}
set
{
_employee = value;
}
}
#region loan : Loan
private Loan _loan;
public Loan LoanObj
{
get
{
if (_loanIssueID.Integer > 0)
{
LoanIssue ls = LoanIssue.Get(_loanIssueID);
_loan = Loan.Get(ls.LoanID);
}
return this._loan;
}
set
{
_loan = value;
}
}
#endregion
#endregion
public string ObjectDescription
{
get
{
string str = "";
str = " Employee (" + this.Employee.EmployeeNo + ")" + this.Employee.Name
+ " applied for the settlement of " + this.LoanObj.Name + " Loan. ";
return str;
}
}
public ID SetupID
{
get { return ID.FromInteger(2); }
}
public ID ObjectID
{
get { return this.ID; }
}
#region Service Factory ILoanSettlementService : ILoanSettlementService
internal static ILoanSettlementService Service
{
get { return Services.Factory.CreateService<ILoanSettlementService>(typeof(ILoanSettlementService)); }
}
#endregion
#region Functions
public static LoanSettlement Get(ID nID)
{
LoanSettlement oLoanSettlement = null;
#region Cache Header
oLoanSettlement = (LoanSettlement)_cache["Get", nID];
if (oLoanSettlement != null)
return oLoanSettlement;
#endregion
oLoanSettlement = LoanSettlement.Service.Get(nID);
#region Cache Footer
_cache.Add(oLoanSettlement, "Get", nID);
#endregion
return oLoanSettlement;
}
public static ObjectsTemplate<LoanSettlement> Get()
{
#region Cache Header
ObjectsTemplate<LoanSettlement> loanSettlements = _cache["Get"] as ObjectsTemplate<LoanSettlement>;
if (loanSettlements != null)
return loanSettlements;
#endregion
try
{
loanSettlements = Service.Get();
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(loanSettlements, "Get");
#endregion
return loanSettlements;
}
public ID Save()
{
base.SetAuditTrailProperties();
return LoanSettlement.Service.Save(this);
}
public void Delete()
{
LoanSettlement.Service.Delete(ID);
}
#endregion
}
#endregion
#region ILoanSettlementService Service
public interface ILoanSettlementService
{
LoanSettlement Get(ID id);
ObjectsTemplate<LoanSettlement> Get();
ID Save(LoanSettlement item);
void Delete(ID id);
}
#endregion
}