private void button3_Click(object sender, EventArgs e) { CategoryForm Category = new CategoryForm(); Category.Show(); this.Hide(); }
private void bunifuThinButton21_Click(object sender, EventArgs e) { if (UnameTb.Text == "" || PassTb.Text == "") { MessageBox.Show("Enter username and/or password"); } else { // SelectedIndex returns -1 if no value was selected if (RoleCb.SelectedIndex > -1) { { // if the user chooses "Admin" from the select role combobox and enters the correct uname and pw for admin, it opens the products form and hides the current login form if (RoleCb.SelectedItem.ToString() == "Admin") { if (UnameTb.Text == "Admin" && PassTb.Text == "Admin") { CategoryForm Cate = new CategoryForm(); Cate.Show(); this.Hide(); } else { MessageBox.Show("Enter the correct username and password for admin"); } } else { //MessageBox.Show("You're in the sellers section"); Con.Open(); //searching for the seller account and counting 8 just in case there are multible accounts with the same name and bassword string query = "select count(8) from SellerTable where SellerName ='" + UnameTb.Text + "' and SellerPass ='******'"; //using data adapter to access the first cell by index SqlDataAdapter sda = new SqlDataAdapter(query, Con); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { //to make the name of the seller who loged in from the first form appear in the selling form sellername = UnameTb.Text; //making the selling form appear when the correct user name and password entered SellingForm sell = new SellingForm(); sell.Show(); this.Hide(); } else { MessageBox.Show("Wrong username or password"); } Con.Close(); } } } else { MessageBox.Show("Select a role"); } } }
private void button3_Click(object sender, EventArgs e) { //on cliking on category button we load the category form by making an object from it and then show the form // then we hide any current form is opened CategoryForm cat = new CategoryForm(); cat.Show(); this.Hide(); }