private void LoadLookups() { this.module.Model.Priorite = LookupData.OrderBy(p => p.Priorite).Select(p => p.Priorite).Distinct().ToList(); this.module.Model.Gravite = LookupData.OrderBy(p => p.Gravite).Select(p => p.Gravite).Distinct().ToList(); this.module.Model.Statut = LookupData.OrderBy(p => p.Statut).Select(p => p.Statut).Distinct().ToList(); this.module.Model.Createur = LookupData.OrderBy(p => p.CreateurDeLaFiche).Select(p => p.CreateurDeLaFiche).Distinct().ToList(); this.module.Model.Diagnostiqueur = LookupData.OrderBy(p => p.Diagnostiqueur).Select(p => p.Diagnostiqueur).Distinct().ToList(); this.module.Model.Correcteur = LookupData.OrderBy(p => p.Correcteur).Select(p => p.Correcteur).Distinct().ToList(); this.module.Model.Site = LookupData.OrderBy(p => p.Site).Select(p => p.Site).Distinct().ToList(); this.module.Model.Responsable = new List <string>() { "", "André MACHADO", "Catherine BARRAULT", "Christophe BODA", "Hugo OLIVEIRA", "João SILVA", "Tomaz SILVA", "Wallace DAMIÃO" }; this.module.Model.BlocsAplicatifsACorriger = AllMCOData.OrderBy(p => p.BlocsAplicatifsACorriger).Select(p => p.BlocsAplicatifsACorriger).Distinct().ToList(); this.module.Model.NatureDeLaMaintenance = AllMCOData.OrderBy(p => p.NatureDeLaMaintenance).Select(p => p.NatureDeLaMaintenance).Distinct().ToList(); this.module.Model.NatureDeLaFiche = AllMCOData.OrderBy(p => p.NatureDeLaFiche).Select(p => p.NatureDeLaFiche).Distinct().ToList(); this.module.Model.Version = AllMCOData.OrderBy(p => p.Version).Select(p => p.Version).Distinct().ToList(); this.module.Model.TypeMaintenance = LookupData.OrderBy(p => p.TypeMaintenance).Select(p => p.TypeMaintenance).Distinct().ToList(); this.module.Model.DirectionResponsable = AllMCOData.OrderBy(p => p.DirectionResponsable).Select(p => p.DirectionResponsable).Distinct().ToList(); this.module.Model.SecteurDeRecette = AllMCOData.OrderBy(p => p.SecteurDeRecette).Select(p => p.SecteurDeRecette).Distinct().ToList(); this.module.Model.DomaineDeDetection = AllMCOData.OrderBy(p => p.DomaineDeDetection).Select(p => p.DomaineDeDetection).Distinct().ToList(); this.module.Model.DomaineCorrection = LookupData.OrderBy(p => p.DomaineCorrection).Select(p => p.DomaineCorrection).Distinct().ToList(); this.module.Model.SecteurCorrection = LookupData.OrderBy(p => p.SecteurCorrection).Select(p => p.SecteurCorrection).Distinct().ToList(); this.module.Model.SousSecteur = AllMCOData.OrderBy(p => p.SousSecteur).Select(p => p.SousSecteur).Distinct().ToList(); this.module.Model.Gamme = AllMCOData.OrderBy(p => p.Gamme).Select(p => p.Gamme).Distinct().ToList(); this.module.Model.Report = new List <string>() { "", "M19B", "M20A", "M20B", "M21A", "M21B", "M22A", "M22B" }; this.module.Model.SelectedResponsable = "João SILVA"; }
public ObservableCollection <FilterModel> CreateColumnFilters(int colIndex) { currentFilterValues = new ObservableCollection <FilterModel>(); List <string> items = new List <string>(); switch (colIndex) { case 0: items.AddRange(AllMCOData.Select(p => p.NoFiche).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 1: items.AddRange(AllMCOData.Select(p => p.Priorite).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 2: items.AddRange(AllMCOData.Select(p => p.Ticket.Gravite).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 3: items.AddRange(AllMCOData.Select(p => p.Statut).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 4: items.AddRange(AllMCOData.Select(p => p.Libelle).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 5: items.AddRange(AllMCOData.Select(p => p.Ticket.DateCreation.HasValue ? p.Ticket.DateCreation.Value.ToString("yyyy-MM-dd") : "").Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 6: items.AddRange(AllMCOData.Select(p => p.Ticket.CreateurDeLaFiche).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 7: items.AddRange(AllMCOData.Select(p => p.Ticket.Diagnostiqueur).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 8: items.AddRange(AllMCOData.Select(p => p.Ticket.Correcteur).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 9: items.AddRange(AllMCOData.Select(p => p.Ticket.Site).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 10: items.AddRange(AllMCOData.Select(p => p.Traitement.Responsable).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 11: items.AddRange(AllMCOData.Select(p => p.Traitement.Analyse.HasValue ? p.Traitement.Analyse.Value.ToString("yyyy-MM-dd") : "").Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 12: items.AddRange(AllMCOData.Select(p => p.Traitement.AnalyseFin.HasValue ? p.Traitement.AnalyseFin.Value.ToString("yyyy-MM-dd") : "").Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 13: items.AddRange(AllMCOData.Select(p => p.Traitement.Dev.HasValue ? p.Traitement.Dev.Value.ToString("yyyy-MM-dd") : "").Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 14: items.AddRange(AllMCOData.Select(p => p.Traitement.DevFin.HasValue ? p.Traitement.DevFin.Value.ToString("yyyy-MM-dd") : "").Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 15: items.AddRange(AllMCOData.Select(p => p.Traitement.Recette.HasValue ? p.Traitement.Recette.Value.ToString("yyyy-MM-dd") : "").Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 16: items.AddRange(AllMCOData.Select(p => p.Traitement.RecetteFin.HasValue ? p.Traitement.RecetteFin.Value.ToString("yyyy-MM-dd") : "").Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 17: items.AddRange(AllMCOData.Select(p => p.Traitement.Prod.HasValue ? p.Traitement.Prod.Value.ToString("yyyy-MM-dd") : "").Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 18: items.AddRange(AllMCOData.Select(p => p.BlocsAplicatifsACorriger).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 19: items.AddRange(AllMCOData.Select(p => p.NatureDeLaMaintenance).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 20: items.AddRange(AllMCOData.Select(p => p.NatureDeLaFiche).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 21: items.AddRange(AllMCOData.Select(p => p.Version).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 22: items.AddRange(AllMCOData.Select(p => p.Niveu0).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 23: items.AddRange(AllMCOData.Select(p => p.Niveu1).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 24: items.AddRange(AllMCOData.Select(p => p.TypeMaintenance).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 25: items.AddRange(AllMCOData.Select(p => p.DirectionResponsable).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 26: items.AddRange(AllMCOData.Select(p => p.SecteurDeRecette).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 27: items.AddRange(AllMCOData.Select(p => p.DomaineDeDetection).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 28: items.AddRange(AllMCOData.Select(p => p.Ticket.DomaineCorrection).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 29: items.AddRange(AllMCOData.Select(p => p.Ticket.SecteurCorrection).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 30: items.AddRange(AllMCOData.Select(p => p.SousSecteur).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 31: items.AddRange(AllMCOData.Select(p => p.Gamme).Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 32: items.AddRange(AllMCOData.Select(p => p.Ticket.ModifieLe.HasValue ? p.Ticket.ModifieLe.Value.ToString("yyyy-MM-dd") : "").Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 33: items.AddRange(AllMCOData.Select(p => p.Ticket.FinDeCloture.HasValue ? p.Ticket.FinDeCloture.Value.ToString("yyyy-MM-dd") : "").Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 34: items.AddRange(AllMCOData.Select(p => p.Ticket.DateDeDerniereAffectation.HasValue ? p.Ticket.DateDeDerniereAffectation.Value.ToString("yyyy-MM-dd") : "").Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; case 35: items.AddRange(AllMCOData.Select(p => p.Traitement.Report ? "Oui" : "Non").Distinct().SkipWhile(p => string.IsNullOrEmpty(p))); break; } ObservableCollection <FilterModel> filters = new ObservableCollection <FilterModel>(); bool colIsFiltered = activeFilters.ContainsKey(colIndex); if (colIsFiltered) { filters = activeFilters[colIndex]; } items.Sort(); foreach (string s in items) { var model = new FilterModel(s, !colIsFiltered); if (colIsFiltered) { model.Checked = filters.Any(p => p.Text == s && p.Checked); } currentFilterValues.Add(model); } // Ajout option "Vides" par defaut currentFilterValues.Add(new FilterModel("Vides", !colIsFiltered)); return(currentFilterValues); }