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

            label9.Text = user.getUname();
            FillMyOrdeers();
        }
        private void Home_Load(object sender, EventArgs e)
        {
            FillComboBox();
            ItemList    = "";
            TotalPrice  = 0;
            UpdateQuery = "";

            userdetail user = new userdetail();

            label9.Text = user.getUname();
        }
        private void loginButtonClicked(object sender, EventArgs e)
        {
            try
            {
                String username = tfUsername.Text.Trim();
                String password = Secret.MD5Hash(tfPassword.Text.Trim());

                SQLiteConnection conn = new SQLiteConnection(DbConfig.CONNECTION_STRING);
                conn.Open();
                string query = "select usertype from users where username='******'and password='******'";

                SQLiteCommand    cmd    = new SQLiteCommand(query, conn);
                SQLiteDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    String userType = reader.GetString(0);
                    Console.WriteLine(userType);
                    conn.Close();

                    userdetail userdetail = new userdetail();
                    userdetail.setUname(username);

                    if (userType.Equals("member"))
                    {
                        Home home = new Home();
                        home.Show();
                        this.Hide();
                    }
                    else if (userType.Equals("manager"))
                    {
                        Manager_home manager = new Manager_home();
                        manager.Show();
                        this.Hide();
                    }
                    else if (userType.Equals("admin"))
                    {
                        Admin_home admin = new Admin_home();
                        admin.Show();
                        this.Hide();
                    }
                }
            }
            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=talight;");
                string          query = "INSERT INTO `orders`(`user`,`details`,`price`) VALUES('" + user.getUname() + "','" + MyParent.ItemList + "'," + 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());
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                userdetail user = new userdetail();

                //SqliteConnection conn = new SqliteConnection(DbConfig.CONNECTION_STRING);
                //string query = "INSERT INTO `orders`(`user`,`details`,`price`) VALUES('"+user.getUname()+"','"+MyParent.ItemList+"',"+MyParent.TotalPrice+");"+MyParent.UpdateQuery+"";
                //SqliteCommand cmd = new SqliteCommand(query, conn);
                //conn.Open();
                //Console.WriteLine(query);
                //cmd.ExecuteNonQuery();
                //conn.Close();
                //MessageBox.Show("Success");
                //button1_Click(sender, e);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #6
0
        private void Home_Load(object sender, EventArgs e)
        {
            userdetail user = new userdetail();

            lblUsername.Text = user.getUname();
        }