protected void btnCashierLogin_Click(object sender, EventArgs e)
        {
            query = "select * from users03";
            ds    = fn.getData(query);

            if (ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("No User Exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                query = "select * from users03 where username='******' and pass='******'";
                ds    = fn.getData(query);

                if (ds.Tables[0].Rows.Count != 0)
                {
                    //Extracting User Role
                    String role = ds.Tables[0].Rows[0][1].ToString();
                    //Extracting User ID
                    int userID = int.Parse(ds.Tables[0].Rows[0][0].ToString());

                    if (role == "Cashier")
                    {
                        /*Dashboard.MainDashboard dashboard = new Dashboard.MainDashboard("Cashier",txtCashierUsername.Text, userID);
                         * dashboard.Show();
                         * this.Hide();*/

                        Dashboard.PlaceOrderDashboard plor = new Dashboard.PlaceOrderDashboard();
                        plor.Show();
                        this.Hide();
                    }
                    else if (role == "Admin")
                    {
                        Dashboard.MainDashboard dashboard = new Dashboard.MainDashboard(txtCashierUsername.Text, userID);
                        dashboard.Show();
                        this.Hide();
                    }
                }
                else
                {
                    MessageBox.Show("No User Exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#2
0
 private void btnPlaceOrder_Click(object sender, EventArgs e)
 {
     Dashboard.PlaceOrderDashboard plor = new Dashboard.PlaceOrderDashboard();
     plor.Show();
     this.Hide();
 }