public void update_ban(int id, FlowLayoutPanel flp) { DAL_BAN ds = new DAL_BAN(); List <BEL_BAN> getban = ds.Upate_Ban(id); foreach (BEL_BAN item in getban) { Button btn = new Button() { Width = dai, Height = Cao }; btn.Text = item.Tenban + "\n" + item.Trangthai; btn.Click += btn_Click; btn.Tag = item; switch (item.Trangthai) { case "Trống": btn.BackColor = Color.Aqua; break; default: btn.BackColor = Color.Red; break; } /*flp.Controls.Add(btn);*/ } }
public void getDSban(FlowLayoutPanel flp1, ListView lv, TextBox tx) { DAL_BAN ds = new DAL_BAN(); List <BEL_BAN> getban = ds.loadDsBan(); foreach (BEL_BAN item in getban) { Button btn = new Button() { Width = dai, Height = Cao }; btn.Text = item.Tenban + "\n" + item.Trangthai; btn.Click += btn_Click; btn.Tag = item; switch (item.Trangthai) { case "Trống": btn.BackColor = Color.Aqua; break; default: btn.BackColor = Color.Red; break; } flp1.Controls.Add(btn); } view = lv; tb = tx; flp = flp1; }