public void FillForm(string listItem) { txtFIrstName.Text = customer.FirstName; txtLastName.Text = customer.LastName; txtAccountNumber.Text = accountDictionary[listItem].AccountNumber; txtBalance.Text = accountDictionary[listItem].Balance.ToString(); string accountType = accountDictionary[listItem].GetType().ToString(); if (accountDictionary[listItem] is CheckingAccount) { rbtnChecking.Checked = true; CheckingAccount checking = accountDictionary[listItem] as CheckingAccount; txtAccountProperties.Text = checking.MonthlyFee.ToString(); } else if (accountDictionary[listItem] is SavingAccount) { rbtnSaving.Checked = true; SavingAccount saving = accountDictionary[listItem] as SavingAccount; txtAccountProperties.Text = saving.InterestRate.ToString(); } }
public void UpdateAccount(Account account, string accountNumber, double property) { for (int i = 0; i < accounts.Count(); i++) { if (accounts[i] == account) { if (account is CheckingAccount) { CheckingAccount checking = account as CheckingAccount; checking.MonthlyFee = property; accounts[i] = checking; accounts[i].AccountNumber = accountNumber; } else if (account is SavingAccount) { SavingAccount saving = account as SavingAccount; saving.InterestRate = property; accounts[i] = saving; accounts[i].AccountNumber = accountNumber; } } } }