private void backbutton_Click(object sender, EventArgs e) { this.Hide(); ManagerControler m = new ManagerControler(); m.ShowDialog(); this.Close(); }
private void saveButton_Click_1(object sender, EventArgs e) { string loc = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=E:\visualstudio\CafeShop\CafeShop\Database1.mdf;Integrated Security=True"; SqlConnection con = new SqlConnection(loc); con.Open(); string query = "select * from manager where pass='******';"; SqlCommand cmd = new SqlCommand(query, con); SqlDataReader reader; reader = cmd.ExecuteReader(); int count = 0; while (reader.Read()) { count++; } if (count == 1) { if (Textbox1.Text == "" || Textbox2.Text == "") { MessageBox.Show("FILL THE BOX", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string loc1 = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=E:\visualstudio\CafeShop\CafeShop\Database1.mdf;Integrated Security=True"; SqlConnection con1 = new SqlConnection(loc1); con1.Open(); string query1 = "update manager set pass='******' where pass='******';"; SqlCommand cmd1 = new SqlCommand(query1, con1); cmd1.ExecuteNonQuery(); MessageBox.Show("Saved"); this.Hide(); ManagerControler mc = new ManagerControler(); mc.ShowDialog(); this.Close(); } } else { MessageBox.Show("Old Password is Wrong", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { try { this.Hide(); ManagerControler m = new ManagerControler(); m.ShowDialog(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void bunifuTileButton1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(Program.loc); con.Open(); string query = "Select * from manager where name='" + bnutextbox1.Text + "' and pass='******';"; SqlCommand cmd = new SqlCommand(query, con); SqlDataReader reader; reader = cmd.ExecuteReader(); int count = 0; while (reader.Read()) { count++; } if (count == 1) { try { this.Hide(); ManagerControler mc = new ManagerControler(); mc.ShowDialog(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { SqlConnection con1 = new SqlConnection(Program.loc); con1.Open(); string query1 = "select * from emp_pass where name='" + bnutextbox1.Text + "' and password='******' ; "; SqlCommand cmd1 = new SqlCommand(query1, con1); SqlDataReader reader1; reader1 = cmd1.ExecuteReader(); int count1 = 0; string s_name = ""; while (reader1.Read()) { count1++; s_name = reader1["name"].ToString(); } if (count1 == 1) { loginhistory(); this.Hide(); ProductInfo f1 = new ProductInfo(s_name); f1.ShowDialog(); this.Close(); } else { MessageBox.Show("Wrong Username or Password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }