private void button1_Click(object sender, EventArgs e) { SqlConnection connection = new SqlConnection(connectionString); SqlDataAdapter adapter = new SqlDataAdapter("SELECT password FROM ADMIN WHERE login = "******"'" + textBox1.Text + "'", connection); DataSet dataset = new DataSet(); adapter.Fill(dataset, "Admin"); foreach (DataRow row in dataset.Tables["Admin"].Rows) { if (Manager.GetHashString(textBox2.Text) == row["password"].ToString()) { MessageBox.Show("Entered succesfully"); AdminPanel panel = new AdminPanel(); panel.ShowDialog(); } else { MessageBox.Show("Try again!"); } } connection.Close(); }
private void btnBack_Click(object sender, EventArgs e) { this.Visible = false; AdminPanel ap = new AdminPanel(); ap.Visible = true; }
private void btnLogin_Click(object sender, EventArgs e) { string sql = "select * from tbl_user where user_name = '" + txtUserName.Text.Trim() + "' and password = '******'"; Console.WriteLine(sql); this.Ds = this.Da.ExecuteQuery(sql); if (this.Ds.Tables[0].Rows.Count == 1 && this.Ds.Tables[0].Rows[0][6].ToString() == "Admin") { //MessageBox.Show("Admin"); this.Visible = false; AdminPanel ap = new AdminPanel(); ap.Visible = true; } else if (this.Ds.Tables[0].Rows.Count == 1 && this.Ds.Tables[0].Rows[0][6].ToString() == "Sale") { //MessageBox.Show("Sale"); this.Visible = false; WFAMenu wfaMenu = new WFAMenu(); wfaMenu.Visible = true; } else if (this.Ds.Tables[0].Rows.Count == 1 && this.Ds.Tables[0].Rows[0][6].ToString() == "Accountant") { //MessageBox.Show("Accountant"); this.Visible = false; Accountant ac = new Accountant(); ac.Visible = true; } }