private void Filtrer() { TPlante planteSelectionnee = (TPlante)cbxPlantes.SelectedItem; TObjectifEffet objectifSelectione = (TObjectifEffet)cbxObjectifs.SelectedItem; TIngredientAutre IngredientSelectione = (TIngredientAutre)cbxIngredients.SelectedItem; TMicroOrganisme MicroOrganismeSelectione = (TMicroOrganisme)cbxMicroOrganismes.SelectedItem; TPopulationARisque PopARisqueSelectionee = (TPopulationARisque)cbxPopulationARisque.SelectedItem; TPopulationCible PopCibleSelectionee = (TPopulationCible)cbxPopulationCible.SelectedItem; if (((planteSelectionnee == null || planteSelectionnee.IdPlante == "-1")) && ((objectifSelectione == null || objectifSelectione.ObjectifEffet == "_Tous_")) && ((IngredientSelectione == null || IngredientSelectione.IdentIngredientAutre == "-1")) && ((MicroOrganismeSelectione == null || MicroOrganismeSelectione.IdMicroOrga == "-1")) && ((PopARisqueSelectionee == null || PopARisqueSelectionee.PopulationARisque == "_Toutes_")) && ((PopCibleSelectionee == null || PopCibleSelectionee.PopulationCible == "_Toutes_")) ) { this.BSComplements.DataSource = complements; } else { complementsFiltres.Clear(); this.BSComplements.DataSource = complementsFiltres; foreach (TComplement complement in complements) { if ((planteSelectionnee == null || planteSelectionnee.IdPlante == "-1" || complement.Plantes.Any <TPlante>(elt => elt.NomPlante == planteSelectionnee.NomPlante)) && (objectifSelectione == null || objectifSelectione.ObjectifEffet == "_Tous_" || complement.ObjectifsEffets.Any <TObjectifEffet>(elt => elt.ObjectifEffet == objectifSelectione.ObjectifEffet)) && (IngredientSelectione == null || IngredientSelectione.IdentIngredientAutre == "-1" || complement.IngredientsAutres.Any <TIngredientAutre>(elt => elt.NomIngredientAutre == IngredientSelectione.NomIngredientAutre)) && (MicroOrganismeSelectione == null || MicroOrganismeSelectione.IdMicroOrga == "-1" || complement.MicroOrganismes.Any <TMicroOrganisme>(elt => elt.GenreEspeceMicroOrganisme == MicroOrganismeSelectione.GenreEspeceMicroOrganisme)) && (PopARisqueSelectionee == null || PopARisqueSelectionee.PopulationARisque == "_Toutes_" || complement.PopulationsARisque.Any <TPopulationARisque>(elt => elt.PopulationARisque == PopARisqueSelectionee.PopulationARisque)) && (PopCibleSelectionee == null || PopCibleSelectionee.PopulationCible == "_Toutes_" || complement.PopulationsCible.Any <TPopulationCible>(elt => elt.PopulationCible == PopCibleSelectionee.PopulationCible)) ) { complementsFiltres.Add(complement); } } } gridCtrl.RefreshDataSource(); }
private void LireNoeud_Plante(XmlNode pNode, BindingList <TPlante> pListe) { TPlante Obj = new TPlante(); pListe.Add(Obj); foreach (XmlNode nodeChamp in pNode.ChildNodes) { if (nodeChamp.Name == "IdFamillePlante") { Obj.IdFamillePlante = nodeChamp.ChildNodes[0].InnerText; } if (nodeChamp.Name == "FamillePlante") { Obj.FamillePlante = nodeChamp.ChildNodes[0].InnerText; } if (nodeChamp.Name == "IdPlante") { Obj.IdPlante = nodeChamp.ChildNodes[0].InnerText; } if (nodeChamp.Name == "NomPlante") { Obj.NomPlante = nodeChamp.ChildNodes[0].InnerText; } if (nodeChamp.Name == "IdPartiePlante") { Obj.IdPartiePlante = nodeChamp.ChildNodes[0].InnerText; } if (nodeChamp.Name == "PartiePlante") { Obj.PartiePlante = nodeChamp.ChildNodes[0].InnerText; } } if (!datasourcePlantes.Any <TPlante>(elt => elt.NomPlante == Obj.NomPlante)) { datasourcePlantes.Add(Obj); } }