// Loads new transaction entry form for a new transaction, and closes transaction complete form. private void btnNewTransaction_Click(object sender, EventArgs e) { Form frmTransactionEntry = new frmTransactionEntry(); frmTransactionEntry.Show(); Close(); }
// Validates inputs are valid and checks if the user input matches what is on record. // Closes form if number of login attempts exceeds 3. private void btnVerifyAcc_Click(object sender, EventArgs e) { try { string customerName = txtVerifyName.Text; decimal customerPin = Convert.ToDecimal(txtVerifyPin.Text); if (GlobalData.ATMBank.maxAttemptsYet(loginAttempts)) { if (customerName.Equals(GlobalData.customer.getCustomerName()) && customerPin == Convert.ToInt32(GlobalData.customer.getCustomerPin())) { Form frmTransactionEntry = new frmTransactionEntry(); frmTransactionEntry.Show(); Close(); } else { if (!customerName.Equals(GlobalData.customer.getCustomerName())) { MessageBox.Show("Please enter the correct name.", "Error"); txtVerifyName.Text = ""; customerName = ""; txtVerifyName.Focus(); loginAttempts++; } else if (!customerPin.Equals(GlobalData.customer.getCustomerPin())) { MessageBox.Show("Please enter the correct PIN number.", "Error"); txtVerifyPin.Text = ""; customerPin = 0; txtVerifyPin.Focus(); loginAttempts++; } } } else { MessageBox.Show("You have reached the maximum login attempts.", "Account Locked"); Application.Exit(); } } catch { MessageBox.Show("Please enter valid verification information.", "Error"); txtVerifyPin.Text = ""; txtVerifyName.Text = ""; txtVerifyName.Focus(); } }