private async void LoadLoan() { LoanModel l = await loans.GetSingle(loanId); BorrowerModel b = await borrowers.GetSingle(l.BorrowerId); txtId.Text = b.BorrowerID; txtName.Text = b.FirstName + " " + b.MiddleName[0] + ". " + b.LastName; txtLoanId.Text = l.LoanId; txtDuration.Text = l.Duration.ToString(); txtEffectiveDate.Text = ConvertDate(l.EffectiveDate); txtInterest.Text = l.Interest.ToString(); txtMaturityDate.Text = ConvertDate(l.MaturityDate); txtPerRemittance.Text = l.PerRemittance.ToString(); txtPrincipal.Text = l.PrincipalLoan.ToString(); txtMaturityValue.Text = l.MaturityValue.ToString(); txtTotalBalance.Text = l.TotalBalance.ToString(); cboPaymentTerm.SelectedValue = l.InterestId; txtCollector.Text = users.GetSingle(" ", l.CollectorId).Name; gName.Text = l.Guarantor.Name; gAddress.Text = l.Guarantor.Address; gContacts.Text = l.Guarantor.ContactNumber; gRelation.Text = l.Guarantor.Relationship; cValue.Text = l.Collateral.Value.ToString(); cItem.Text = l.Collateral.Item; cDescription.Text = l.Collateral.Description; btnPrint.Visible = true; int _id = int.Parse(cboPaymentTerm.SelectedValue.ToString()); double interest = interests.getInterest(_id); txtInterestRate.Text = $"{interest: ##.##}%"; Generate(); }
private void cboPaymentTerm_SelectedIndexChanged(object sender, EventArgs e) { if (isLoad) { double rate = interests.getInterest(int.Parse(cboPaymentTerm.SelectedValue.ToString())); txtInterest.Text = rate.ToString(); } }