Esempio n. 1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            string user1 = "ADMINISTRATOR";
            string user2 = "CHEF";
            string user3 = "CASHIER";
            string type  = "";

            connection.Open();
            string           CmdString = "select * from digidatabase.users where user_name='" + txtLName.Text + "' and user_password='******'";
            MySqlDataAdapter sda       = new MySqlDataAdapter(CmdString, connection);
            DataSet          ds        = new DataSet();

            sda.Fill(ds, "users");
            if (ds.Tables[0].Rows.Count > 0)
            {
                type = ds.Tables[0].Rows[0][3].ToString();
                MessageBox.Show("" + type);
            }
            else
            {
                MessageBox.Show("Invalid User...");
            }

            connection.Close();
            if (type.ToUpper() == user1)
            {
                Dashboard g = new Dashboard();

                g.Show();
            }
            else if (type.ToUpper() == user2)
            {
                currentorder co = new currentorder();
                co.Show();
            }
            else if (type.ToUpper() == user3)
            {
                cashier c = new cashier();
                c.Show();
            }
            else
            {
            }
            txtLName.Text     = "";
            txtLPassword.Text = "";
            type = "";
            //connection.Open();
            //string CmdString = "select * from login where names='" + textBox1.Text + "' and passwords='" + textBox2.Text + "'";
            //MySqlDataAdapter sda = new MySqlDataAdapter(CmdString, connection);
            //DataSet ds = new DataSet();
            //sda.Fill(ds, "login");
            //if (ds.Tables[0].Rows.Count > 0)
            //{

            // username=textBox1.Text;
            //MessageBox.Show("Welcome '" + textBox1.Text + "'");
            //if (s == "cashier")
            //{
            //    cashier c = new cashier();
            //    c.Show();
            //    textBox1.Text = "";
            //    textBox2.Text = "";
            //    this.Hide();
            //}
            //else if (s == "Admin")
            //{
            //    Dashboard g = new Dashboard();
            //    g.Show();


            //    textBox1.Text = "";
            //    textBox2.Text = "";
            //    this.Hide();
            //}
            //}
            //else
            //{
            //    MessageBox.Show("You entered wrong username or password..");

            //    textBox1.Text = "";
            //    textBox2.Text = "";
            //}
            //con.Close();
        }
        private void button8_Click(object sender, EventArgs e)
        {
            currentorder co = new currentorder();

            co.Show();
        }