private void HienThiDanhSachBanTheoKhuVuc(int id) { flpDanhSachBan.Controls.Clear(); List <Ban> listTable = ban.HienThiDanhSachBanTheoKhuVuc(id); foreach (Ban table in listTable) { Button btn = new Button() { Width = 100, Height = 100 }; btn.Text = table.tenBan + Environment.NewLine + table.trangThai; btn.Click += btn_Click; btn.Tag = table; if (table.trangThai == "Trống") { btn.BackColor = Color.Green; } else { btn.BackColor = Color.Pink; } flpDanhSachBan.Controls.Add(btn); } }
public void HienThiDanhSachBanTheoKhuVuc(int id) { flpDanhSachBan.Controls.Clear(); List <Ban> listTable = ban.HienThiDanhSachBanTheoKhuVuc(id); if (listTable.Count != 0) { foreach (Ban table in listTable) { Button btn = new Button() { Width = 100, Height = 100 }; btn.Text = table.tenBan + Environment.NewLine + table.trangThai; btn.Click += btn_Click; //btn.MouseDoubleClick += btn_MouseDoubleClick; btn.Tag = table; if (table.trangThai == "Trống") { btn.BackColor = Color.Green; } else { btn.BackColor = Color.Pink; } flpDanhSachBan.Controls.Add(btn); } } else // nếu khu vực chưa có danh sách bàn { // textbox hiển thị bàn sex rỗng txtMaBan.Text = ""; } }
private void DanhSachBanTheoKhuVuc(int id) { cmbBan.Controls.Clear(); cmbBan.DataSource = ban.HienThiDanhSachBanTheoKhuVuc(id); cmbBan.DisplayMember = "tenBan"; cmbBan.ValueMember = "maBan"; }