public Application SaveLoanConfiguration(LoanConfig loan, string applicationId, string customerId, string officerId) { var applicationInfo = new Application(); var loanConfig = new loan() { //a generate loan number function must be called generated based fbonumbr = customerId, appnumber = applicationId,//must be autogenerated officerid = loan.OfficerId, app_type = "NL", appldate = DateTime.Parse(loan.LoansAppldate), branchid = loan.LoansBranchid, fladescr = loan.LoansFladescr, flaesins = Convert.ToDecimal(loan.LoansFlaesins), flafxins = Convert.ToDecimal(loan.LoansFlafxins), flagptmt = Convert.ToDecimal(loan.LoansFlagptmt), flagpval = Convert.ToDecimal(loan.LoansFlagpval), flaicmet = Convert.ToDecimal(loan.LoansFlaicmet), flaicrat = Convert.ToDecimal(loan.LoansFlaicrat), flainsud = DateTime.Parse(loan.LoansFlainsud), flainsup = Convert.ToDecimal(loan.LoansFlainsup), flalocat = loan.LoansFlalocat, flalpmet = Convert.ToDecimal(loan.LoansFlalpmet), flaltype = Convert.ToDecimal(loan.LoansFlaltype), flaptype = Convert.ToDecimal(loan.LoansFlaptype), flarpmet = loan.LoansFlarpmet, flasecto = loan.LoansFlasecto, flasubsc = loan.LoansFlasubsc, flatloan = Convert.ToDecimal(loan.LoansFlatloan), flatermm = Convert.ToDecimal(loan.LoansFlattermm), flacurncy = loan.LoansFlacurrncy, inquirydate = DateTime.Parse(loan.LoansInquirydate), repay_cycle = loan.LoansRepayCycle, year_length = Convert.ToDecimal(loan.LoansYearLength), refinanceamt = Convert.ToDecimal(loan.LoansRefinanceamt), consolidateamt = Convert.ToDecimal(loan.LoansConsolidateamt), consol_newamtreq = Convert.ToDecimal(loan.LoansConsolNewamtreq), }; using (var dpac = new DPACEntities()) { try { dpac.loans.Add(loanConfig); if (dpac.SaveChanges() > 0) { applicationInfo.ApplicationSuccess = true; applicationInfo.ApplicationId = applicationId; } } catch (DbEntityValidationException e) { applicationInfo.ApplicationSuccess = false; applicationInfo.ErrorMessage = e.Message; } } return(applicationInfo); }
public LoanConfigurationViewModels(LoanConfig config) { if (config == null) { Id = 0; } else { Id = config.Id; DebitInterestRate = config.DebitInterestRate; GlAccount = config.GlAccount; IncomeGlAccountId = config.IncomeGlAccountId; LoanInterestReceivableGlId = config.LoanInterestReceivableGlId; } }
public ActionResult SaveLoanConfig(LoanConfig save) { bool status = false; var interest = Request.Form["Interest"]; var income = Request.Form["Income"]; var receivableIncome = Request.Form["Receive"]; save.DebitInterestRate = Math.Round(Convert.ToDecimal(Request.Form["Interest"], CultureInfo.InvariantCulture), 4); save.IncomeGlAccountId = Convert.ToInt32(Request.Form["Income"]); save.LoanInterestReceivableGlId = Convert.ToInt32(Request.Form["Receive"]); save.Id = Convert.ToInt32(Request.Form["Id"]); if (save.Id == 0) { save.Status = true; _loanLogic.SaveLoanConfig(save); TempData["Message"] = "Configurations Added"; status = true; } else { var configInDb = _loanLogic.GetLoan(save.Id); configInDb.DebitInterestRate = Math.Round(Convert.ToDecimal(interest, CultureInfo.InvariantCulture), 4); configInDb.IncomeGlAccountId = Convert.ToInt32(income); configInDb.LoanInterestReceivableGlId = Convert.ToInt32(receivableIncome); if (interest == null || income == null) { configInDb.Status = false; } configInDb.Status = true; _loanLogic.UpdateLoanConfig(save); TempData["Message"] = "New Configurations Added"; status = true; } ViewBag.Status = status; return(RedirectToAction("LoanConfig", "AccountConfiguration")); }
public LoanCalculationService( IOptions <LoanConfig> loanConfig) { LoanConfig = loanConfig.Value; }
public void UpdateLoanConfig(LoanConfig config) { //Updating database values _loan.Save(config); }
public void SaveLoanConfig(LoanConfig config) { //saving into the database _loan.Add(config); _loan.Save(config); }