Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string accountNum = txtAccountNumber.Text;
            double properties = Convert.ToDouble(txtAccountProperties.Text);

            if (!accountDictionary.ContainsKey(accountNum))
            {
                if (rbtnSaving.Checked)
                {
                    SavingAccount saving = new SavingAccount(accountNum, properties);
                    customer.AddAccount(saving);
                }
                else if (rbtnChecking.Checked)
                {
                    CheckingAccount checking = new CheckingAccount(accountNum, properties);
                    customer.AddAccount(checking);
                }
                ShowAccounts();
                lstAccounts.SelectedIndex = accountList.Count() - 1;
            }
            else
            {
                MessageBox.Show("Customer with such number is already in the system! Try again...");
            }
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
 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;
             }
         }
     }
 }