private async void frmBorrowers_Load(object sender, EventArgs e) { if (operation == "view") { BorrowerModel b = await borrower.GetSingle(id); txtFirstName.Text = b.FirstName; txtLastname.Text = b.LastName; txtMiddlename.Text = b.MiddleName; txtAddress.Text = b.Address; txtContacts.Text = b.ContactNumber; cboCivilStatus.Text = b.CivilStatus; optFemale.Checked = (b.Gender == "FEMALE"); optMale.Checked = (b.Gender == "MALE"); txtBday.Text = $"{b.Birthday.Month:00}/{b.Birthday.Day:00}/{b.Birthday.Year}"; txtMonthlySalary.Text = b.MonthlySalary.ToString(); txtOccupation.Text = b.Occupation; txtAge.Text = borrower.ComputeAge(b.Birthday).ToString(); picImage.Image = Image.FromFile(b.Image); _image = b.Image; pnlBorrower.Enabled = false; btnSave.Enabled = false; if (frmDashboard.user.UserType == "admin") { btnDelete.Visible = true; } btnUpdate.Visible = true; } }
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 async Task choose() { int id = int.Parse(lstBorrowers.SelectedValue.ToString()); BorrowerModel output = await b.GetSingle(id); string borrowerId = output.BorrowerID; string name = output.FullName; borrower(borrowerId, name); this.Close(); }