private void button1_Click(object sender, EventArgs e) { ProductForm prod = new ProductForm(); prod.Show(); this.Hide(); }
private void btn_Click(object sender, EventArgs e) { if (UnameTb.Text == "" || PassTb.Text == "") { MessageBox.Show("Enter The Username and Password"); } else { if (RoleCb.SelectedIndex > -1) { if (RoleCb.SelectedItem.ToString() == "ADMIN") { if (UnameTb.Text == "Admin" && PassTb.Text == "Admin") { ProductForm prod = new ProductForm(); prod.Show(); this.Hide(); } else { MessageBox.Show("If you are the admin, enter the correct id and password"); } } else if (RoleCb.SelectedItem.ToString() == "SELLER") { //MessageBox.Show("You are a Seller"); Con.Open(); SqlDataAdapter sda = new SqlDataAdapter("select count(8) from SellerTb1 where SellerName='" + UnameTb.Text + "' and SellerPass='******'", Con); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { Sellername = UnameTb.Text; SellingForm sell = new SellingForm(); sell.Show(); this.Hide(); Con.Close(); } else { MessageBox.Show("Wrong Username or Password"); } Con.Close(); } } else { MessageBox.Show("Select a Role"); } } }