//Bàn void LoadDsBan() { BanBUS ban = new BanBUS(); dtgvBan.AutoGenerateColumns = false; dtgvBan.DataSource = ban.LoadDsBan(); }
public void LoadDsBan(BanDTO banglobal) { flpBan.Controls.Clear(); List <BanDTO> dsBan = banBUS.LoadDsBan(); foreach (BanDTO item in dsBan) { Button button = new Button() { Width = Instance.ChieuDaiBan, Height = Instance.ChieuRongBan }; button.Click += button_Click; button.Tag = item; button.Image = Image.FromFile(Instance.HinhAnhBan); button.ImageAlign = ContentAlignment.MiddleLeft; button.TextAlign = ContentAlignment.MiddleRight; if (item.Trangthai == 1) { button.Text = item.Tenban + Instance.BanTrong; if (banglobal.Soban != item.Soban) { button.BackColor = Color.LightGreen; } else { button.BackColor = Color.SkyBlue; } } else if (item.Trangthai == 2) { button.Text = item.Tenban + Instance.BanKhongTrong; if (banglobal.Soban != item.Soban) { button.BackColor = Color.LightPink; } else { button.BackColor = Color.SkyBlue; } } flpBan.Controls.Add(button); } }
public void LoadDsBan(BanDTO banglobal) { HoaDonTamBUS hdtBUS = new HoaDonTamBUS(); flpBan.Controls.Clear(); List <BanDTO> dsBan = banBUS.LoadDsBan(); if (dsBan.Count > 0) { foreach (BanDTO item in dsBan) { Button button = new Button() { Width = 120, Height = 120 }; button.Click += button_Click; button.Image = Image.FromFile("../../../Image/caiBan.png"); button.Tag = item; //if(item.Trangthai == 1) //{ // button.Text = item.Tenban + "\nTrống"; // if (banglobal.Soban != item.Soban) // button.BackColor = Color.LightGreen; // else // button.BackColor = Color.SkyBlue; //} //else if (item.Trangthai == 2) //{ // button.Text = item.Tenban + "\nCó người"; // if (banglobal.Soban != item.Soban) // button.BackColor = Color.LightPink; // else // button.BackColor = Color.SkyBlue; //} if (hdtBUS.LayHDTamTheoMaBan(item.Soban, ListHDTam) == null) { button.Text = item.Tenban + "\nTrống"; if (banglobal.Soban != item.Soban) { button.BackColor = Color.LightGreen; } else { button.BackColor = Color.SkyBlue; } } else { button.Text = item.Tenban + "\nCó người"; if (banglobal.Soban != item.Soban) { button.BackColor = Color.LightPink; } else { button.BackColor = Color.SkyBlue; } } flpBan.Controls.Add(button); } } }