private void button1_Click(object sender, EventArgs e) //Back Button { string position = LoginForm.position; if (position == "Owner") { OwnerForm w = new OwnerForm(); w.Show(); this.Hide(); } else if (position == "Receptionist") { Coffee_Shop_Management_System.CafeBilling w = new Coffee_Shop_Management_System.CafeBilling(); w.Show(); this.Hide(); } else if (position == "Cook") { Coffee_Shop_Management_System.CoffeeDetails w = new Coffee_Shop_Management_System.CoffeeDetails(); w.Show(); this.Hide(); } }
private void Login_button_Click(object sender, EventArgs e) { if (ID_taxtbox.Text == "") { id = 0; } else { id = Convert.ToInt32(ID_taxtbox.Text); } pass = Pass_textBox.Text; if (id == 0) { Coffee_Shop_Management_System.WelcomePage b = new Coffee_Shop_Management_System.WelcomePage(); b.Show(); this.Hide(); } string qurey = "Select * from AllUser Where ID ='" + id + "'AND Password ='******'"; db.readDatathroughAdapter(qurey, TampTable); if (TampTable.Rows.Count == 1) { position = TampTable.Rows[0]["Position"].ToString(); ID = TampTable.Rows[0]["ID"].ToString(); if (position == "Owner") { OwnerForm w = new OwnerForm(); w.Show(); this.Hide(); } else if (position == "Receptionist") { Coffee_Shop_Management_System.CafeBilling w = new Coffee_Shop_Management_System.CafeBilling(); w.Show(); this.Hide(); } else if (position == "Cook") { Coffee_Shop_Management_System.CoffeeDetails w = new Coffee_Shop_Management_System.CoffeeDetails(); w.Show(); this.Hide(); } } else { MessageBox.Show("Wrong Password or ID!", "Warnning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Pass_textBox__KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { if (ID_taxtbox.Text == "") { id = 0; } else { id = Convert.ToInt32(ID_taxtbox.Text); } pass = Pass_textBox.Text; if (id == 0 && pass == "0") { Coffee_Shop_Management_System.WelcomePage b = new Coffee_Shop_Management_System.WelcomePage(); b.Show(); this.Hide(); } else { string qurey = "Select * from AllUser Where ID ='" + id + "'AND Password ='******'"; db.readDatathroughAdapter(qurey, TampTable); if (TampTable.Rows.Count == 1) { position = TampTable.Rows[0]["Position"].ToString(); ID = TampTable.Rows[0]["ID"].ToString(); if (position == "Owner") { OwnerForm w = new OwnerForm(); w.Show(); this.Hide(); } else if (position == "Receptionist") { Coffee_Shop_Management_System.CafeBilling w = new Coffee_Shop_Management_System.CafeBilling(); w.Show(); this.Hide(); } else if (position == "Cook") { Coffee_Shop_Management_System.CoffeeDetails w = new Coffee_Shop_Management_System.CoffeeDetails(); w.Show(); this.Hide(); } } else if (e.KeyChar == (char)Keys.Escape) { ID_taxtbox.Text = ""; Pass_textBox.Text = ""; } } } }