Beispiel #1
0
        public void load()
        {
            lb_TenMon.ForeColor  = Color.Black;
            lb_GiaTien.ForeColor = Color.Black;
            lb_MoTa.ForeColor    = Color.Black;
            lb_DanhMuc.ForeColor = Color.Black;
            txtTenMon.ResetText();
            txtMoTa.ResetText();
            txtGiaTien.ResetText();
            SQLAction LayDanhMuc = new SQLAction();
            DataSet   table      = LayDanhMuc.GetCategory();

            for (int i = 0; i < table.Tables[0].Rows.Count; i++)
            {
                cbb_DanhMuc.Items.Add(table.Tables[0].Rows[i][0].ToString());
            }
        }
Beispiel #2
0
        private void load()
        {
            SQLAction laydanhmuc = new SQLAction();
            DataSet   table      = laydanhmuc.GetCategory();


            if (table.Tables[0].Rows.Count > 0 && table.Tables.Count > 0)
            {
                for (int i = 0; i < table.Tables[0].Rows.Count; i++)
                {
                    Button button = new Button();
                    button.Size = new Size(80, 50);
                    button.Text = table.Tables[0].Rows[i][0].ToString();
                    pl_Chon.Controls.Add(button);
                    string DM = table.Tables[0].Rows[i][0].ToString();

                    button.Click += (sender, args) =>
                    {
                        pl_Menu.Controls.Clear();
                        FlowLayoutPanel pl = new FlowLayoutPanel();
                        pl.Size = new Size(400, 430);

                        DTO_Food food = new DTO_Food();
                        food.DanhMuc = button.Text;
                        SQLAction getfood = new SQLAction();
                        DataSet   result  = new DataSet();
                        result = getfood.GetFoodInfo(food);
                        for (int k = 0; k < result.Tables[0].Rows.Count; k++)
                        {
                            ChooseFood choose = new ChooseFood();
                            choose.TENMON  = result.Tables[0].Rows[k][1].ToString();
                            choose.GIATIEN = int.Parse(result.Tables[0].Rows[k][3].ToString());
                            System.Byte[] arr = (result.Tables[0].Rows[k][4]) as System.Byte[];
                            choose.HINHANH = arr;
                            pl.Controls.Add(choose);
                        }
                        pl_Menu.Controls.Add(pl);
                    };
                }
            }
        }