public void LoadDanhSachLop() { var dao = new LopDAO(); var lst = dao.GetAll(); cbbDanhSachLop.Properties.DataSource = lst; cbbDanhSachLop.Properties.ValueMember = "MaLop"; cbbDanhSachLop.Properties.DisplayMember = "TenLop"; }
/// <summary> /// Lay tat ca record /// </summary> /// <returns>List lop</returns> public List <Lop> GetAll() { LopDAO context = new LopDAO(); try { List <Lop> lstLop = context.GetAll(); return(lstLop); } catch (Exception ex) { Console.WriteLine(ex); return(null); } }
public void LoadDanhSachLop() { gcDanhSach.DataSource = null; gcDanhSach.Controls.Clear(); var dao = new LopDAO(); var lst = new List <Lop>(); var ids = string.Join(",", cbbDanhSachKhoa.Properties.Items.GetCheckedValues()); var ser = txtSearch.Text; if (string.IsNullOrEmpty(ids)) { lst = dao.GetAll(ser); } else { lst = dao.GetAllByMaKhoa(ids, ser); } gcDanhSach.DataSource = lst; }