public static int DeleteLoanById(int id) { int iSuccess = 0; int uSuccess = 0; BorrowORLoanInfo loanInfo = LoanDAL.GetLoanById(id); UserInfo userInfo = UserDAL.GetUserByName(loanInfo.Lender); LoanDAL.DeleteLoanById(id, out iSuccess); if (iSuccess > 0) { if (loanInfo.BorrowORLoanType == 2) { CardInfo cardInfo = CardDAL.GetCardByCardNumber(loanInfo.Lender, userInfo.Id); float amount = cardInfo.Amount - loanInfo.Amount; float LoanAmount = cardInfo.LoanAmount - loanInfo.Amount; CardDAL.UpdateCardAmount(amount, LoanAmount, cardInfo.Id, 4, out uSuccess); } } if (iSuccess > 0 && ((loanInfo.BorrowORLoanType == 2 && uSuccess > 0) || (loanInfo.BorrowORLoanType != 2 && uSuccess == 0))) { return(1); } else { return(0); } }
public bool Create(LoanBusinessEntity loanBusinessEntity) { LoanDAL loanDAL = new LoanDAL(); loanBusinessEntity = GenerateLoanNo(loanBusinessEntity); return(loanDAL.Save(loanBusinessEntity)); }
/////////////////////////////////////////////////////////////////////////////////////////////////// public LoanEntities GetLoanByLoanID_BL(string loanID) { if (Regex.IsMatch(loanID, "[CARLOAN|HOMELOAN|EDULOAN][0-9]{14}$") == false) { throw new InvalidStringException("Not a valid loan ID"); } LoanDAL loanDALobj = new LoanDAL(); return(loanDALobj.GetLoanByLoanID_DAL(loanID)); }
//////////////////////////////////////////////////////////////////////////////////////////////////// public LoanEntities GetLoanByCustomerID_BL(string customerID) { if (Regex.IsMatch(customerID, "[0-9]{14}$") == false) { throw new InvalidStringException("Not a valid customer ID"); } LoanDAL loanDALobj = new LoanDAL(); return(loanDALobj.GetLoanByCustomerID_DAL(customerID)); }
///////////////////////////////////////////////////////////////////////////////////////////////// public bool GetLoanStatusBL(string loanID) { if (Regex.IsMatch(loanID, "[CARLOAN|HOMELOAN|EDULOAN][0-9]{14}$") == false) { throw new InvalidStringException("Not a valid load ID!"); } LoanDAL loanDALobj = new LoanDAL(); return(loanDALobj.GetLoanStatusDAL(loanID)); }
/////////////////////////////////////////////////////////////////////////////////////////////////// public void ApproveLoanBL(string loanID) { if (Regex.IsMatch(loanID, "[CARLOAN|HOMELOAN|EDULOAN][0-9]{14}$") == false) { throw new InvalidStringException("Not a valid loan ID"); } LoanDAL loanDALobj = new LoanDAL(); loanDALobj.ApproveLoanDAL(loanID); }
public Account Create(Customer cust, int amount) { try { Account newAccount = new LoanDAL().Create(cust, amount); newAccount = new CustomerDAL().addAccount(cust, newAccount); return(newAccount); } catch (Exception) { return(null); } }
public GetLoanState(int customerID, long loanID, DateTime? stateDate, int? userID = null, bool getCalculatorState = true) { //this.strategyArgs = new object[] { customerID, loanID, stateDate, userID, getCalculatorState }; this.StateDate = stateDate ?? DateTime.UtcNow; Result = new NL_Model(customerID); Result.Loan = new NL_Loans() { LoanID = loanID }; Result.UserID = userID; GetCalculatorState = getCalculatorState; LoanDAL = new LoanDAL(); this.strategyArgs = new object[] { Result.CustomerID, Result.Loan.LoanID, this.StateDate, Result.UserID, GetCalculatorState }; } // constructor
public static int InsertOrUpdatetoLoan(BorrowORLoanInfo info) { int iSuccess = 0; int uSuccess = 0; BorrowORLoanInfo loanInfo = new BorrowORLoanInfo(); UserInfo userInfo = UserDAL.GetUserByName(info.Lender); CardInfo cardInfo = CardDAL.GetCardByCardNumber(info.LoanAccount, userInfo.Id); if (info.Id > 0) { loanInfo = LoanDAL.GetLoanById(info.Id); } LoanDAL.InsertOrUpdatetoLoan(info, out iSuccess); if (iSuccess > 0 && info.BorrowORLoanType == 2) { float amount = 0; float loanAmount = 0; if (info.Id > 0) { amount = cardInfo.Amount + (info.Amount - loanInfo.Amount); loanAmount = cardInfo.Amount + (info.Amount - loanInfo.Amount); } else { amount = cardInfo.Amount + info.Amount; loanAmount = cardInfo.Amount + info.Amount; } CardDAL.UpdateCardAmount(amount, loanAmount, cardInfo.Id, 4, out uSuccess); } if ((iSuccess > 0 && info.Id > 0) && ((info.BorrowORLoanType == 2 && uSuccess > 0) || (info.BorrowORLoanType != 2 && uSuccess == 0))) { return(2); } else if ((iSuccess > 0 && info.Id == 0) && ((info.BorrowORLoanType == 2 && uSuccess > 0) || (info.BorrowORLoanType != 2 && uSuccess == 0))) { return(1); } else { return(0); } }
public bool ApplyLoanBL(LoanEntities loan) { if (Regex.IsMatch(loan.CustomerID, "[0-9]{14}$") == false) { throw new InvalidStringException("Customer ID must be of 14 digits!"); } if (loan.AmountApplied < 50000 || loan.AmountApplied > 10000000) { throw new InvalidAmountException("Loan amount must be between Rs.50000 to Rs.10000000 !"); } if (loan.Tenure > 10) { throw new InvalidRangeException("Tenure can be maximum of 10 years!"); } //LoanType loanType; //if(Enum.TryParse(Parse.ToString(loan.Type), out loanType) == true) //{ // for education loan no income bar required if ((int)loan.Type == 1 && loan.Income < 50000) // home loan { throw new InvalidAmountException("For applying home loan you must have minimum income of Rs.50000/month !"); } if ((int)loan.Type == 2 && loan.Income < 30000) //car loan { throw new InvalidAmountException("For applying car loan you must have minimum income of Rs.30000/month !"); } //} //else // throw new InvalidEnumException("Not a valid loan type, must be among HOMELOAN, EDULOAN, CARLOAN"); LoanDAL loanDALobj = new LoanDAL(); return(loanDALobj.ApplyLoanDAL(loan)); }
public AddPayment(int customerID, NL_Payments payment, int userID) { this.strategyArgs = new object[] { customerID, payment, userID }; if (customerID == 0) { Error = NL_ExceptionCustomerNotFound.DefaultMessage; NL_AddLog(LogType.Error, "Strategy Faild", this.strategyArgs, null, Error, null); return; } if (payment == null || payment.LoanID == 0) { Error = NL_ExceptionLoanNotFound.DefaultMessage; NL_AddLog(LogType.Error, "Strategy Faild", this.strategyArgs, null, Error, null); return; } CustomerID = customerID; Payment = payment; UserID = userID; LoanDAL = new LoanDAL(); this.strategyArgs = new object[] { CustomerID, Payment, UserID }; }
/// <summary> /// To Get Loan By Loan ID /// </summary> /// <param name="EncumbranceID"></param> /// <returns></returns> public LoanBO GetLoanByLoanID(int EncumbranceID) { LoanDAL objLoanDAL = new LoanDAL(); return(objLoanDAL.GetLoanByLoanID(EncumbranceID)); }
/// <summary> /// To Update Loan /// </summary> /// <param name="objLoan"></param> /// <returns></returns> public string UpdateLoan(LoanBO objLoan) { LoanDAL objLoanDAL = new LoanDAL(); return(objLoanDAL.UpdateLoan(objLoan)); }
/// <summary> /// To Delete Loan /// </summary> /// <param name="EncumbranceId"></param> /// <returns></returns> public string DeleteLoan(int EncumbranceId) { LoanDAL objLoanDAL = new LoanDAL(); return(objLoanDAL.DeleteLoan(EncumbranceId)); }
/// <summary> /// To Add Loan /// </summary> /// <param name="objLoan"></param> /// <returns></returns> public string AddLoan(LoanBO objLoan) { LoanDAL objLoanDAL = new LoanDAL(); return(objLoanDAL.AddLoan(objLoan)); }
/// <summary> /// To Get Loan /// </summary> /// <param name="LoanName"></param> /// <returns></returns> public LoanList GetLoan(string LoanName) { LoanDAL objLoanDAL = new LoanDAL(); return(objLoanDAL.GetLoan(LoanName)); }
private LoanBusinessEntity GenerateLoanNo(LoanBusinessEntity loanBusinessEntity) { LoanDAL loanDAL = new LoanDAL(); return(loanDAL.GetLoanNo(loanBusinessEntity)); }
public LoanBusinessEntity GetCustName(LoanBusinessEntity loanBusinessEntity) { LoanDAL loanDAL = new LoanDAL(); return(loanDAL.GetCustName(loanBusinessEntity)); }
/// <summary> /// Initializes a new instance of the LoanController class /// </summary> public LoanController() { this._loanDAL = new LoanDAL(); }
public List <LoanBusinessEntity> GetLoans() { LoanDAL loanDAL = new LoanDAL(); return(loanDAL.GetLoans()); }
public static BorrowORLoanCollection GetLoanList(List <QueryElement> list) { return(LoanDAL.GetLoanList(list)); }
public static BorrowORLoanInfo GetLoanById(int id) { return(LoanDAL.GetLoanById(id)); }