private void InitLoaiHopDong() { var listLoaiHopDong = loaiHopDongServices.GettAllLoaiHopDong(); if (listLoaiHopDong.Count != 0) { foreach (var loaiHd in loaiHopDongServices.GettAllLoaiHopDong()) { if (loaiHd.idCha != 0) { foreach (var removeHd in listLoaiHopDong) { if (loaiHd.idCha == removeHd.idLoaiHopDong) { listLoaiHopDong.Remove(removeHd); break; } } } } } cbLoaiHopDong.DataSource = listLoaiHopDong; cbLoaiHopDong.DisplayMember = "loaiHopDong1"; cbLoaiHopDong.ValueMember = "idLoaiHopDong"; }
private void InitLoaiHopDong() { LoaiHopDong firstItem = new LoaiHopDong { idLoaiHopDong = 0, idCha = 0, loaiHopDong1 = "Tất Cả", HopDongLaoDongs = null }; var listLoaiHopDong = new List <LoaiHopDong>(); listLoaiHopDong.Add(firstItem); listLoaiHopDong.AddRange(loaiHopDongServices.GettAllLoaiHopDong().ToList()); if (listLoaiHopDong.Count != 0) { foreach (var loaiHd in loaiHopDongServices.GettAllLoaiHopDong()) { if (loaiHd.idCha != 0 && loaiHd.idLoaiHopDong != 0) { foreach (var removeHd in listLoaiHopDong) { if (loaiHd.idCha == removeHd.idLoaiHopDong) { listLoaiHopDong.Remove(removeHd); break; } } } } } cbLoaiHopDong.DataSource = listLoaiHopDong; cbLoaiHopDong.DisplayMember = "loaiHopDong1"; cbLoaiHopDong.ValueMember = "idLoaiHopDong"; }
private void InitLoaiHopDong() { LoaiHopDong firstItem = new LoaiHopDong { idLoaiHopDong = 0, idCha = 0, loaiHopDong1 = "Tất Cả", HopDongLaoDongs = null }; var listLoaiHopDong = loaiHopDongServices.GettAllLoaiHopDong(); if (listLoaiHopDong.Count != 0) { foreach (var loaiHd in loaiHopDongServices.GettAllLoaiHopDong()) { if (loaiHd.idCha != 0) { foreach (var removeHd in listLoaiHopDong) { if (loaiHd.idCha == removeHd.idLoaiHopDong) { listLoaiHopDong.Remove(removeHd); break; } } } } } listLoaiHopDong.Add(firstItem); comboLoaiHD.DataSource = listLoaiHopDong.OrderBy(hd => hd.idLoaiHopDong).ToList(); comboLoaiHD.DisplayMember = "loaiHopDong1"; comboLoaiHD.ValueMember = "idLoaiHopDong"; }