private void MyOrders_Load(object sender, EventArgs e)
        {
            userdetail user = new userdetail();

            label9.Text = user.getUname();
            FillMyOrdeers();
        }
示例#2
0
        private void Home_Load(object sender, EventArgs e)
        {
            FillComboBox();
            Array.Clear(ItemList, 0, 5);
            TotalPrice  = 0;
            UpdateQuery = "";

            userdetail user = new userdetail();

            label9.Text = user.getUname();
        }
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlConnection  conn = new MySqlConnection(@"datasource=127.0.0.1;port=3306;SslMode=none;username=root;password=;database=wicrama;");
                MySqlDataAdapter sda  = new MySqlDataAdapter("select * from users where username='******'and password='******'", conn);
                DataTable        dt   = new DataTable();
                sda.Fill(dt);
                if (dt.Rows.Count == 1)
                {
                    MySqlCommand cmd = new MySqlCommand("select * from users where username='******'and password='******'", conn);
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    MySqlDataReader reader;
                    reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        userdetail user = new userdetail();
                        user.setUname((string)reader["username"].ToString());

                        if ((string)reader["usertype"].ToString() == "member")
                        {
                            Home home = new Home();
                            this.Hide();
                            home.Show();
                        }
                        if ((string)reader["usertype"].ToString() == "manager")
                        {
                            Manager_home manager = new Manager_home();
                            this.Hide();
                            manager.Show();
                        }
                        if ((string)reader["usertype"].ToString() == "admin")
                        {
                            Admin_home admin = new Admin_home();
                            this.Hide();
                            admin.Show();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Check Again");
                }
            }
            catch (Exception x)
            {
                MessageBox.Show(x.ToString());
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                userdetail user = new userdetail();

                MySqlConnection conn  = new MySqlConnection(@"datasource=127.0.0.1;port=3306;SslMode=none;username=root;password=;database=wicrama;");
                string          query = "INSERT INTO `orders`(`user`,`details`,`price`) VALUES('" + user.getUname() + "','" + ArrayToString() + "'," + MyParent.TotalPrice + ");" + MyParent.UpdateQuery + "";
                MySqlCommand    cmd   = new MySqlCommand(query, conn);
                conn.Open();
                cmd.ExecuteNonQuery();
                conn.Close();
                MessageBox.Show("Success");
                button1_Click(sender, e);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }