protected void updateNormalLoanRepayment(BNEWNORMALLOAN loan, int repaymentTimes, decimal newAmount, DateTime? activateDate) { NormalLoanRepaymentRepository facade = new NormalLoanRepaymentRepository(); BNEWNORMALLOAN_REPAYMENT existLoanRepay = facade.FindRepaymentAmount(loan.Code, repaymentTimes).FirstOrDefault(); if (existLoanRepay != null) { BNEWNORMALLOAN_REPAYMENT existLoanRepayOld = facade.FindRepaymentAmount(loan.Code, repaymentTimes).FirstOrDefault(); existLoanRepay.LoanAmount = newAmount; facade.Update(existLoanRepayOld, existLoanRepay); } else { existLoanRepay = new BNEWNORMALLOAN_REPAYMENT(); existLoanRepay.RepaymentTimes = repaymentTimes; existLoanRepay.ActivatedDate = activateDate; existLoanRepay.LoanAmount = newAmount; existLoanRepay.Code = loan.Code; facade.Add(existLoanRepay); } facade.Commit(); }
private void updateRepaymentAmount(BNEWNORMALLOAN loan, decimal newAmount) { NormalLoanRepaymentRepository facade = new NormalLoanRepaymentRepository(); BNEWNORMALLOAN_REPAYMENT existLoanRepay = facade.FindRepaymentAmount(loan.Code, int.Parse(hfRepaymentTimes.Value)).FirstOrDefault(); if (existLoanRepay != null) { BNEWNORMALLOAN_REPAYMENT existLoanRepayOld = facade.FindRepaymentAmount(loan.Code, int.Parse(hfRepaymentTimes.Value)).FirstOrDefault(); existLoanRepay.LoanAmount = newAmount; facade.Update(existLoanRepayOld, existLoanRepay); } else { existLoanRepay = new BNEWNORMALLOAN_REPAYMENT(); existLoanRepay.RepaymentTimes = int.Parse(hfRepaymentTimes.Value); existLoanRepay.ActivatedDate = DateTime.Now; existLoanRepay.LoanAmount = newAmount; existLoanRepay.Code = loan.Code; facade.Add(existLoanRepay); } facade.Commit(); }