am doing an ATM project using C# and it was required from my teacher to complete this task with out using a database so I created a class which contains a list to store all the data in while creating a new account, but the problem is that I cant use the data for login (I don't know how to do the bool coding thing to determines if the item is in the list)
Note:in login you should enter your name and pin code to login
here is my create account form code
public partial class NewAccountForm : Form
{
public NewAccountForm()
{
InitializeComponent();
}
Accounts account1;
private void btnCreate_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
Form1 login = new Form1();
this.Hide();
login.Show();
}
private void btncreate_Click(object sender, EventArgs e)
{
int interest = 0;
char type = '0';
double amount = 0 ;
double balance = 0;
switch (cboType.SelectedIndex)
{
case 0: type = '1'; break;
case 1: type = '2'; break;
}
Saveing account1 = new Saveing(interest, txtName.Text, txtContact.Text,
txtpinCode.Text, type, amount,balance);
Data.CSaveing.Add(account1); //SList shows because its static if remove static will not appears
}
private void NewAccountForm_Load(object sender, EventArgs e)
{
}
}
and this is my login form
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Data Accounts;
bool validCode = false;
private void Form1_Load(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Accounts.name = txtname.Text;
Accounts.code = txtCode.Text;
if (string.IsNullOrWhiteSpace(txtname.Text))
{
MessageBox.Show("Please Type your full name");
}
if (string.IsNullOrWhiteSpace(txtCode.Text))
{
MessageBox.Show("Please Enter a correct account Pin Code");
}
else if ((Accounts.name == txtname.Text)) ;
else if ((Accounts.code != txtCode.Text)) ;
{
int i;
progressBar1.Maximum = 100;
progressBar1.Minimum = 0;
progressBar1.Step = 1;
timer1.Start();
for (i = 0; i <= 50; i++)
progressBar1.Value = i;
}
}
private void button2_Click(object sender, EventArgs e)
{
NewAccountForm naf = new NewAccountForm();
this.Hide();
naf.Show();
}
private void timer1_Tick(object sender, EventArgs e)
{
progressBar1.PerformStep();
if (progressBar1.Value == 99)
{
LoginForm login = new LoginForm();
this.Hide();
login.Show();
}
}
private void label3_Click(object sender, EventArgs e)
{
}
private void label4_Click(object sender, EventArgs e)
{
}
}