public FormulaireVilleVM() { this.repoVille = new Repository<Ville>(this._context); this.CurrentVille = new Ville(); this.UCParentCode = CodesUC.ConsultationVilles; }
public static ICollection<ReportRepartitionAdherentsAge> InscriptionsToReportRepartitionAdherentsAge(ICollection<TrancheAge> tranchesAge, Ville villeResident, ICollection<Inscription> inscriptions) { var result = new List<ReportRepartitionAdherentsAge>(); foreach (var tranche in tranchesAge) { var item = new ReportRepartitionAdherentsAge() { Libelle = tranche.ToString() }; item.NbHommesResident = inscriptions.Count(i => i.Adherent.Sexe.LibelleCourt.Equals("M") && i.Adherent.Ville.ID == villeResident.ID && i.Adherent.Age >= tranche.AgeInf && i.Adherent.Age <= tranche.AgeSup ); item.NbFemmesResident = inscriptions.Count(i => i.Adherent.Sexe.LibelleCourt.Equals("F") && i.Adherent.Ville.ID == villeResident.ID && i.Adherent.Age >= tranche.AgeInf && i.Adherent.Age <= tranche.AgeSup ); item.NbHommesExterieur = inscriptions.Count(i => i.Adherent.Sexe.LibelleCourt.Equals("M") && i.Adherent.Ville.ID != villeResident.ID && i.Adherent.Age >= tranche.AgeInf && i.Adherent.Age <= tranche.AgeSup ); item.NbFemmesExterieur = inscriptions.Count(i => i.Adherent.Sexe.LibelleCourt.Equals("F") && i.Adherent.Ville.ID != villeResident.ID && i.Adherent.Age >= tranche.AgeInf && i.Adherent.Age <= tranche.AgeSup ); result.Add(item); } return result; }