Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            ProductForm product = new ProductForm();

            this.Hide();
            product.Show();
        }
 private void submit_Login_Click(object sender, EventArgs e)
 {
     if (userName.Text == String.Empty || userPass.Text == String.Empty)
     {
         MessageBox.Show("Please fill in all the fields");
     }
     else
     {
         if (roleCMB.SelectedIndex > -1)
         {
             if (roleCMB.SelectedItem.ToString() == "Admin")
             {
                 if (userName.Text == "Admin" && userPass.Text == "Admin")
                 {
                     ProductForm prod = new ProductForm();
                     prod.Show();
                     this.Hide();
                 }
                 else
                 {
                     MessageBox.Show("Admin access only");
                 }
             }
             else if (roleCMB.SelectedItem.ToString() == "Cashier")
             {
                 connect.Open();
                 SqlDataAdapter sda = new SqlDataAdapter("Select count(8) from cashierTbl where cashName='" + userName.Text + "' and cashPass='******'", connect);
                 DataTable      dt  = new DataTable();
                 sda.Fill(dt);
                 if (dt.Rows[0][0].ToString() == "1")
                 {
                     CashierPOS cash = new CashierPOS();
                     this.Hide();
                     CashName = userName.Text;
                     cash.Show();
                 }
                 else
                 {
                     MessageBox.Show("No matching account");
                 }
                 connect.Close();
             }
         }
         else
         {
             MessageBox.Show("Please select a role");
         }
     }
 }