private void button3_Click(object sender, EventArgs e)
        {
            VenteForm prod = new VenteForm();

            prod.Show();
            this.Hide();
        }
Example #2
0
 private void bunifuThinButton21_Click(object sender, EventArgs e)
 {
     if (UsernameTb.Text == "" || PassTb.Text == "")
     {
         MessageBox.Show("Enter the username and password");
     }
     else
     {
         if (RoleCb.SelectedIndex > -1)
         {
             if (RoleCb.SelectedItem.ToString() == "ADMIN")
             {
                 if (UsernameTb.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
             {
                 // MessageBox.Show("you are in the seller section");
                 Con.Open();
                 SqlDataAdapter sda = new SqlDataAdapter("select count(8) from ClientTbl where ClientName='" + UsernameTb.Text + "'and ClientPass='******'", Con);
                 DataTable      dt  = new DataTable();
                 sda.Fill(dt);
                 if (dt.Rows[0][0].ToString() == "1")
                 {
                     ClientName = UsernameTb.Text;
                     VenteForm sell = new VenteForm();
                     sell.Show();
                     this.Hide();
                     Con.Close();
                 }
                 else
                 {
                     MessageBox.Show("wrong username or password");
                 }
                 Con.Close();
             }
         }
         else
         {
             MessageBox.Show("select a Role");
         }
     }
 }