-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
79 lines (71 loc) · 2.71 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* Gavin Rodgers
* 3309 ATM Project
* This class handles the code form the account entry form
* Last edited: 10/13/18
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using ATM;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ATM
{
public partial class frmForm1 : Form
{
//initializes the account entry form
public frmForm1()
{
InitializeComponent();
}
//handles the find me button and searches for an account match, loads form 2 if match found
private void btnFindMe_Click(object sender, EventArgs e)
{
GlobalDataClass.ATMBank.Tries();
if (txtAccountNumber.Text.Length == GlobalDataClass.ATMBank.checkAccountLength())
{
string account = txtAccountNumber.Text;
btnFindMe.Enabled = false;
Boolean found = false;
GlobalDataClass.ATMBank.findCustomerRecord(account, ref found);
if (found)
{
GlobalDataClass.ATMBank.CountReset();
this.Hide();
Form Form1 = new frmPinIDEntry();
Form1.ShowDialog();
this.Visible = false;
this.Close();
}
else if (!found)
{
btnFindMe.Enabled = true;
txtAccountNumber.Text = "";
MessageBox.Show("Please reenter Account Number\n" + "Remaining Tries: "
+ GlobalDataClass.ATMBank.remainingTries().ToString(), "Account Not Found");
}
}
else if(txtAccountNumber.Text.Length != GlobalDataClass.ATMBank.checkAccountLength())
{
MessageBox.Show("Please Enter a valid 5 digit account number\n" + "Remaining Tries: "
+ GlobalDataClass.ATMBank.remainingTries().ToString(), "Entry Invalid");
txtAccountNumber.Text = "";
txtAccountNumber.Focus();
}
if (GlobalDataClass.ATMBank.accountTry() == true)
{
MessageBox.Show("Please See Manager", "Account Locked");
this.Close();
}
GlobalDataClass.ATMBank.rewindFiles();
}
//empty event handler
private void txtAccountNumber_TextChanged(object sender, EventArgs e)
{
}
}
}