/// <summary> /// The <c>CreateAccount</c> method. /// This finds the account given the account number. /// </summary> /// <param name="acctName">The account name</param> /// <param name="acctPin">The account pin</param> /// <param name="acctBalance">Optional starting balance</param> /// <returns>A Current Account</returns> public static CurrentAccount CreateAccount(string acctName, string acctPin, double acctBalance = 0) { var userAccount = new CurrentAccount(); userAccount.acctName = acctName; userAccount.acctPin = acctPin; userAccount.acctBalance = acctBalance; userAccounts.Add(userAccount.acctNo, userAccount); count += 1; MessageBox.Show("Thanks for opening a Current account at Dolphin Bank\nAccount name: " + userAccount.acctName + "\nAccount number: " + userAccount.acctNo + "\nAccount balance: " + userAccount.acctBalance + "\n"); return userAccount; }
private void createBtn_Click(object sender, EventArgs e) { BankAccount x; if (accttypeBox.SelectedIndex == 0) { x = CurrentAccount.CreateAccount(nametxtBox.Text, pintxtBox.Text, Convert.ToDouble(amttxtBox.Text)); } else { x = SavingsAccount.CreateAccount(nametxtBox.Text, pintxtBox.Text, Convert.ToDouble(amttxtBox.Text)); } depositBtn.Visible = false; acctnotxtBox.Text = BankAccount.GetAccountNumber(x); acctnoLbl.Visible = true; acctnotxtBox.Visible = true; createBtn.Enabled = false; }