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 LoanCategory [Serializable] public class LoanCategory : BasicBaseObject// ,AuditTrailBase, IDisplayProperty { #region Constructor public LoanCategory() { DefaultInterestRate = 0; LoanCategoryCode = string.Empty; Description = string.Empty; UserObjectName = string.Empty; IsActive = EnumLoanCategoryStatus.Active; MaxAlowableFlatAmount = null; MaxInstallment = 0; MinInstallment = 0; PercentageofFund = 0; Version = 0; ProjectID = 0; } #endregion #region properties #region Property DefaultInterestRate : double public double DefaultInterestRate { get; set; } //private double _defaultInterestRate; //public double DefaultInterestRate //{ // get { return _defaultInterestRate; } // set // { // base.OnPropertyChange("DefaultInterestRate", _defaultInterestRate, value); // _defaultInterestRate = value; // } //} #endregion Property DefaultInterestRate : double #region Property LoanCategoryCode : string public string LoanCategoryCode { get; set; } //private string _loanCategoryCode; //public string LoanCategoryCode //{ // get { return _loanCategoryCode; } // set // { // base.OnPropertyChange("LoanCategoryCode", _loanCategoryCode, value); // _loanCategoryCode = value; // } //} #endregion Property LoanCategoryCode : string #region Property UserObjectName : string public string UserObjectName { get; set; } //private string _userObjectName; //public string UserObjectName //{ // get { return _userObjectName; } // set // { // base.OnPropertyChange("UserObjectName", _userObjectName, value); // _userObjectName = value; // } //} #endregion Property UserObjectName : string #region Property Description : string public string Description { get; set; } //private string _description; //public string Description //{ // get { return _description; } // set // { // base.OnPropertyChange("Description", _description, value); // _description = value; // } //} #endregion Property Description : string #region Property IsActive : EnumLoanCategoryStatus public EnumLoanCategoryStatus IsActive { get; set; } //private EnumLoanCategoryStatus _isActive; //public EnumLoanCategoryStatus IsActive //{ // get { return _isActive; } // set // { // base.OnPropertyChange("IsActive", (short)_isActive, (short)value); // _isActive = value; // } //} #endregion Property IsActive : EnumLoanCategoryStatus #region Property MaxAlowableFlatAmount : double public double? MaxAlowableFlatAmount { get; set; } //private double? _maxAlowableFlatAmount; //public double? MaxAlowableFlatAmount //{ // get { return _maxAlowableFlatAmount; } // set // { // if (value != 0) // { // base.OnPropertyChange("MaxAlowableFlatAmount", _maxAlowableFlatAmount, value); // } // _maxAlowableFlatAmount = value; // } //} #endregion Property MaxAlowableFlatAmount : double #region Property MaxInstallment : int public int MaxInstallment { get; set; } //private int _maxInstallment; //public int MaxInstallment //{ // get { return _maxInstallment; } // set // { // base.OnPropertyChange("MaxInstallment", _maxInstallment, value); // _maxInstallment = value; // } //} #endregion Property MaxInstallment : int #region Property MinInstallment : int public int MinInstallment { get; set; } //private int _minInstallment; //public int MinInstallment //{ // get { return _minInstallment; } // set // { // base.OnPropertyChange("MinInstallment", _minInstallment, value); // _minInstallment = value; // } //} #endregion Property MinInstallment : int #region Property PercentageofFund : double public double? PercentageofFund { get; set; } //private double? _percentageofFund; //public double? PercentageofFund //{ // get { return _percentageofFund; } // set // { // if (value != 0) // { // base.OnPropertyChange("PercentageofFund", _percentageofFund, value); // } // _percentageofFund = value; // } //} #endregion Property PercentageofFund : double #region Property Version : int public int Version { get; set; } //private int _version; //public int Version //{ // get { return _version; } // set // { // base.OnPropertyChange("Version", _version, value); // _version = value; // } //} #endregion Property Version : int #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 #region Property CodeDesc : string public string CodeDesc { get; set; } //private string _codeDesc; //public string CodeDesc //{ // get // { // _codeDesc = this.LoanCategoryCode + "[" + this.Description + "]"; // return _codeDesc; // } //} #endregion Property Code_Desc : string #region Property LoanFundRelations : LoanCategoryFundRelations //private LoanCategoryFundRelations _loanFundRelations; //public LoanCategoryFundRelations LoanFundRelations //{ // get // { // if (_loanFundRelations == null) // _loanFundRelations = new LoanCategoryFundRelations(); // return _loanFundRelations; // } //} #endregion Property LoanFundRelations : LoanCategoryFundRelations #endregion #region Class LoanCategoryFundRelation //[Serializable] //public class LoanCategoryFundRelation : AuditTrailBase //{ // #region Cache // private static Cache _cache = new Cache(typeof(LoanCategoryFundRelation)); // #endregion Cache // #region Properties // #region Property FundTypeID : ID // private ID _fundTypeID; // public ID FundTypeID // { // get { return _fundTypeID; } // set // { // base.OnPropertyChange("FundTypeID", _fundTypeID, value); // _fundTypeID = value; // } // } // #endregion Property FundType : ID // #region Property LoanCategoryID : ID // private ID _loanCategoryID; // public ID LoanCategoryID // { // get { return _loanCategoryID; } // set // { // base.OnPropertyChange("LoanCategoryID", _loanCategoryID, value); // _loanCategoryID = value; // } // } // #endregion Property LoanCategoryID : ID // #region Property ProjectID : ID // private ID _projectID; // public ID ProjectID // { // get { return _projectID; } // set // { // base.OnPropertyChange("ProjectID", _projectID, value); // _projectID = value; // } // } // #endregion Property ProjectID : ID // #endregion //} #endregion Class LoanCategoryFundRelation #region Class LoanCategoryFundRelations //[Serializable] //public class LoanCategoryFundRelations : ObjectsTemplate //{ // #region Constructor // public LoanCategoryFundRelations() // { // } // public LoanCategoryFundRelation GetItemByFundTypeID(ID fundTypeID) // { // return this.Find(delegate (LoanCategoryFundRelation item) { return item.FundTypeID == fundTypeID; }); // } // #endregion //} #endregion #region IDisplayProperty Members //public string Column1 //{ // get { return this.LoanCategoryCode; } //} //public string Column2 //{ // get { return this.Description; } //} //public string Column3 //{ // get { return string.Empty; } //} //public int Column4 //{ // get { return this.ID; } //} //public List GetMe() //{ // List disps = null; // ObjectsTemplate lnCats = Service.Get(); // if (lnCats != null) // { // disps = new List(); // foreach (LoanCategory lnCat in lnCats) // { // disps.Add(lnCat); // } // } // return disps; //} //public List GetMe(ID id) //{ // List disps = null; // LoanCategory lnCat = Service.Get(id, true); // if (lnCat != null) // { // disps = new List(); // disps.Add(lnCat); // } // return disps; //} #endregion //#region Function //public void Save() //{ // try // { // base.SetAuditTrailProperties(GlobalFunctions.GetServerDate().Date, User.CurrentUser.ID); // Service.Save(this); // //Clear Cache // CacheInfo.ClearCache(typeof(LoanCategory).FullName); // } // catch (Exception e) // { // throw new Exception(e.Message, e); // } //} //public LoanCategory Get(ID id, bool isGetChild) //{ // #region Cache Header // LoanCategory loanCategory = _cache["Get", id, isGetChild] as LoanCategory; // if (loanCategory != null) // return loanCategory; // #endregion // try // { // loanCategory = Service.Get(id, isGetChild); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(loanCategory, "Get", id, isGetChild); // #endregion // return loanCategory; //} //public LoanCategory Get(string loanCategoryCode, bool isGetChild) //{ // #region Cache Header // LoanCategory loanCategory = _cache["Get", loanCategoryCode, isGetChild] as LoanCategory; // if (loanCategory != null) // return loanCategory; // #endregion // try // { // loanCategory = Service.Get(loanCategoryCode, isGetChild); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(loanCategory, "Get", loanCategoryCode, isGetChild); // #endregion // return loanCategory; //} //public static ObjectsTemplate Get() //{ // #region Cache Header // ObjectsTemplate loanCategories = _cache["Get"] as ObjectsTemplate; // if (loanCategories != null) // return loanCategories; // #endregion // try // { // loanCategories = Service.Get(); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // #region Cache Footer // _cache.Add(loanCategories, "Get"); // #endregion // return loanCategories; //} //public static ObjectsTemplate Get(EnumLoanCategoryStatus status) //{ // ObjectsTemplate loanCategories = new ObjectsTemplate(); // try // { // loanCategories = Service.Get(status); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } // return loanCategories; //} //public static DataTable GetTable() //{ // try // { // return Service.GetTable(); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } //} //public bool IsIssued(ID loancatID) //{ // try // { // return Service.IsIssued(loancatID); // } // catch (ServiceException e) // { // throw new ServiceException(e.Message, e); // } //} //#region IsExist //public bool IsExist(string sCode, int version) //{ // try // { // return Service.IsExist(sCode, version); // } // catch (ServiceException e) // { // throw new ServiceException(e.Message, e); // } //} //#endregion //#region Validation Function //public bool Validate(ref string sMessage, string code, ref int msgNo, bool check) //{ // if (!this.IsNew && (this.LoanCategoryCode == code)) // { // } // else if (this.IsExist(this.LoanCategoryCode, 0)) // { // sMessage = "Category code can not be duplicate"; // msgNo = 1; // return false; // } // if (this.LoanCategoryCode == string.Empty || this.LoanCategoryCode == null) // { // sMessage = "Code Cannot be empty"; // msgNo = 2; // return false; // } // if (this.Description == string.Empty || this.Description == null) // { // sMessage = "Description cannot be empty"; // msgNo = 3; // return false; // } // if (this.MinInstallment <= 0) // { // sMessage = "Min installment no must be greater than 0"; // msgNo = 4; // return false; // } // if (this.MaxInstallment <= 0) // { // sMessage = "Max installment no must be greater than 0"; // msgNo = 5; // return false; // } // if (!(this.MaxInstallment > this.MinInstallment)) // { // sMessage = "Max installment no must be greater than min installment no."; // msgNo = 6; // return false; // } // if (this.DefaultInterestRate <= 0) // { // sMessage = "Default Interest Rate Cannot be 0"; // msgNo = 7; // return false; // } // if (check == true) // { // if (this.MaxAlowableFlatAmount == 0) // { // sMessage = "Please insert max alowable flat amount."; // msgNo = 8; // return false; // } // } // else // { // if (this.PercentageofFund == 0) // { // sMessage = "Please insert percentage of fund."; // msgNo = 9; // return false; // } // } // if (this.LoanFundRelations.Count == 0) // { // sMessage = "Please select fund."; // msgNo = 10; // return false; // } // return true; //} //#endregion //public void ChangeStatus(EnumLoanCategoryStatus status) //{ // try // { // base.SetAuditTrailProperties(GlobalFunctions.GetServerDate().Date, User.CurrentUser.ID); // Service.ChangeStatus(this, status); // //Clear Cache // CacheInfo.ClearCache(typeof(LoanCategory).FullName); // } // catch (ServiceException e) // { // throw new Exception(e.Message, e); // } //} //#endregion } #endregion public interface ILoanCategoryService { void Save(LoanCategory loanCategory); void ChangeStatus(LoanCategory loanCategory, EnumLoanCategoryStatus status); List Get(EnumLoanCategoryStatus status); LoanCategory Get(int loanCategoryID, bool isGetChild); LoanCategory Get(string loanCategoryCode, bool isGetChild); DataTable GetTable(); List Get(); bool IsExist(string loanCode, int version); bool IsIssued(int loancatID); } }