Exemplo n.º 1
0
        private void LayDanhSachLoaiMon()
        {
            List <LoaiMonDTO> dsLoaiMon = LoaiMonBUS.LayDanhSachLoaiMon();

            foreach (LoaiMonDTO loaiMon in dsLoaiMon)
            {
                MaterialFlatButton btn = new MaterialFlatButton();
                btn.Text     = loaiMon.TenLoaiMon + " (" + MonBUS.LaySoLuongMonTheoLoai(loaiMon.MaLoaiMon) + ")";
                btn.Name     = loaiMon.MaLoaiMon.ToString();
                btn.AutoSize = false;
                btn.Size     = new Size(140, 60);
                btn.Dock     = DockStyle.Left;
                btn.Tag      = loaiMon;
                btn.Click   += new EventHandler(ChonLoai);
                panelLoai.Controls.Add(btn);
                btn.BringToFront();
            }

            MaterialFlatButton btnTatCa = new MaterialFlatButton();

            btnTatCa.Text     = "Tất cả" + " (" + MonBUS.LaySoLuongMonTheoLoai(0) + ")";;
            btnTatCa.Name     = "0";
            btnTatCa.AutoSize = false;
            btnTatCa.Size     = new Size(140, 60);
            btnTatCa.Dock     = DockStyle.Left;
            btnTatCa.Tag      = new LoaiMonDTO();
            btnTatCa.Click   += new EventHandler(ChonLoai);
            panelLoai.Controls.Add(btnTatCa);
        }