private void button3_Click(object sender, EventArgs e) { shm.Show(); this.Hide(); }
private void button1_Click(object sender, EventArgs e) { string identi = textBox1.Text; int l = textBox1.Text.Length; int l1 = textBox2.Text.Length; if (l == 5 || l == 6 || l == 7) { SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=D:\C# pro\try table with\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30"); con.Open(); SqlCommand s1 = new SqlCommand("SELECT * FROM Admininfo where AId = '" + textBox1.Text + "' and password = '******'", con); SqlDataReader dt; dt = s1.ExecuteReader(); int c = 0; while (dt.Read()) { c += 1; } if (c == 1) { Admin_Home ah = new Admin_Home(identi); ah.Show(); this.Hide(); } else if (c > 0) { MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } textBox1.Text = textBox1.Text; textBox2.Clear(); } else if (l == 8 || l == 9 || l == 10 || l == 11) { SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=D:\C# pro\try table with\Super_shop_test_1.mdf;Integrated Security=True;Connect Timeout=30"); con.Open(); SqlCommand s1 = new SqlCommand("SELECT * FROM Salesmaninfo where SId = '" + textBox1.Text + "' and password = '******'", con); SqlDataReader dt; dt = s1.ExecuteReader(); int c = 0; while (dt.Read()) { c += 1; } if (c == 1) { Salesman_Home sh = new Salesman_Home(identi); sh.Show(); this.Hide(); } else if (c > 0) { MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } textBox1.Text = textBox1.Text; textBox2.Clear(); } else { MessageBox.Show("Wrong User Id or password", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }