private void Form3_Load(object sender, EventArgs e) { db = new ufrEntities(); List <Personnel> personnel = db.Personnel.Where(p => !p.Departement.Any(d => d.id == this.departementID)).ToList(); cbSelectEns.DataSource = personnel; cbSelectEns.ValueMember = "id"; cbSelectEns.DisplayMember = "identite"; }
private void Form2_Load(object sender, EventArgs e) { db = new ufrEntities(); List <UEDepartement> ueDepartement = db.UEDepartement.Where(ued => ued.departementID == this.departementID).ToList(); List <UE> ues = db.UE.ToList(); ues = ues.Where(ue => ueDepartement.Any(ued => ued.ueID == ue.id)).ToList(); cbUESelection.DataSource = ues; cbUESelection.ValueMember = "id"; cbUESelection.DisplayMember = "detail"; }