protected void Page_Load(object sender, EventArgs e) { var account = new Borrower(); account.Find(Session["id"].ToString()); lblUser.Text = $"Welcome, {account.FirstName} {account.LastName}"; lblLoans.Text = $"{account.Loans.FindAll(loan => loan.LoanReturnDate == null).Count.ToString()} / {account.GetBorrowerMaxLoans()}"; lblFines.Text = account.Fines.FindAll(fine => fine.FineStatus.Trim() == "DUE").Sum(fine => fine.FineAmount).ToString("C"); lblResrvation.Text = account.Reservations.FindAll(reservation => reservation.ClearedDate == null).Count .ToString(); rptCurrentLoans.DataSource = account.Loans.FindAll(loan => loan.LoanReturnDate == null); rptCurrentLoans.DataBind(); rptHistoryLoans.DataSource = account.Loans.FindAll(loan => loan.LoanReturnDate != null); rptHistoryLoans.DataBind(); rptCurrentReservations.DataSource = account.Reservations.FindAll(reservation => reservation.ClearedDate == null); rptCurrentReservations.DataBind(); rptHistoryReservations.DataSource = account.Reservations.FindAll(reservation => reservation.ClearedDate != null); rptHistoryReservations.DataBind(); rptCurrentFines.DataSource = account.Fines.FindAll(fine => fine.FineStatus.Trim() == "DUE"); rptCurrentFines.DataBind(); var finesWithPayments = new FineCollection(account.BorrowerId); rptHistoryFines.DataSource = finesWithPayments.FinesWithPayments(); rptHistoryFines.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { var account = new Borrower(); txtUserId.Enabled = false; txtFirstName.Enabled = false; txtLastName.Enabled = false; if (account.Find(Session["id"].ToString())) { if (!Page.IsPostBack) { txtUserId.Text = account.BorrowerId; txtFirstName.Text = account.FirstName; txtLastName.Text = account.LastName; txtAddress1.Text = account.Address1; txtAddress2.Text = account.Address2; txtAddress3.Text = account.Address3; txtTel.Text = account.TelNumber; txtEmail.Text = account.Email; } } }
protected void Page_Load(object sender, EventArgs e) { _borrowerId = Request.QueryString["borrowerId"]; var account = new Borrower(); account.Find(_borrowerId); if (!Page.IsPostBack) { lblId.Text = account.BorrowerId; lblFirstName.Text = account.FirstName; lblLastName.Text = account.LastName; lblTelephone.Text = account.TelNumber; lblEmail.Text = account.Email; lblAccountType.Text = account.GetBorrowerTypeDescription(account.BorrowerType); rdLive.Checked = account.Status.Trim() == "Live"; rdSuspended.Checked = account.Status.Trim() == "Suspended"; rptLoans.DataSource = account.Loans; rptLoans.DataBind(); rptFines.DataSource = account.Fines; rptFines.DataBind(); } }
protected void HandlerFindUser(object sender, EventArgs e) { var account = new Borrower(); if (account.Find(txtStudentNumber.Text.Trim())) { pnUserInfo.Visible = true; _borrowerId = account.BorrowerId; lblUser.Text = $"{account.FirstName} {account.LastName}"; lblLoans.Text = $"{account.Loans.FindAll(loan => loan.LoanReturnDate == null).Count.ToString()} / {account.GetBorrowerMaxLoans()}"; lblFines.Text = account.Fines.FindAll(fine => fine.FineStatus.Trim() == "DUE").Sum(fine => fine.FineAmount).ToString("C"); lblResrvation.Text = account.Reservations.FindAll(reservation => reservation.ClearedDate == null).Count .ToString(); rptCurrentLoans.DataSource = account.Loans.FindAll(loan => loan.LoanReturnDate == null); rptCurrentLoans.DataBind(); rptHistoryLoans.DataSource = account.Loans.FindAll(loan => loan.LoanReturnDate != null); rptHistoryLoans.DataBind(); rptCurrentReservations.DataSource = account.Reservations.FindAll(reservation => reservation.ClearedDate == null); rptCurrentReservations.DataBind(); rptHistoryReservations.DataSource = account.Reservations.FindAll(reservation => reservation.ClearedDate != null); rptHistoryReservations.DataBind(); rptCurrentFines.DataSource = account.Fines.FindAll(fine => fine.FineStatus.Trim() == "DUE"); rptCurrentFines.DataBind(); var finesWithPayments = new FineCollection(account.BorrowerId); rptHistoryFines.DataSource = finesWithPayments.FinesWithPayments(); rptHistoryFines.DataBind(); } }