private void Button_Selling_Click(object sender, EventArgs e) { SellingForm selling = new SellingForm(); selling.Show(); this.Hide(); }
private void Button_login_Click(object sender, EventArgs e) { if (TextBox_username.Text == "" || TextBox_password.Text == "") { MessageBox.Show("Please Enter username and password", "Missing infomation", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (ComboBox_role.SelectedIndex > -1) { if (ComboBox_role.SelectedItem.ToString() == "ADMIN") { if (TextBox_username.Text == "ADMIN" && TextBox_password.Text == "123456") { ProductFrom product = new ProductFrom(); product.Show(); this.Hide(); } else { MessageBox.Show("If you are ADMIN", "Please Enter the corect ID and Password", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { string selectQuery = "SELECT * FROM Seller WHERE SellerName= '" + TextBox_username.Text + "'AND SellerPass='******'"; DataTable table = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(selectQuery, dBCon.Getcon()); adapter.Fill(table); if (table.Rows.Count > 0) { sellerName = TextBox_username.Text; SellingForm selling = new SellingForm(); selling.Show(); this.Hide(); } else { MessageBox.Show("Wrong User or Password", "Wrong infomation", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("Plese Select Role", "Wrong Infomation", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }