Finalisation de la fonction de filtrage

This commit is contained in:
2020-12-02 23:27:43 +01:00
parent b95e14a29f
commit b56f785e3d
7 changed files with 85 additions and 29 deletions

View File

@ -28,7 +28,9 @@ namespace Hermes.Model {
private DateTime _dateCreation;
private DateTime _dateModification;
public int Id { get => _id; set => _id = value; }
public int Id {
get => _id; set => _id = value;
}
public string Civilite {
get => _civilite;
set {
@ -179,7 +181,9 @@ namespace Hermes.Model {
}
[NotMapped]
public string TypeResidenceLabel { get => TypeResidence == false ? "Principale" : "Secondaire"; }
public string TypeResidenceLabel {
get => TypeResidence == false ? "Principale" : "Secondaire";
}
[NotMapped]
public string Age {
@ -196,11 +200,21 @@ namespace Hermes.Model {
} else {
try {
DateNaissance = new DateTime(DateTime.Now.Year - Int32.Parse(value), 1, 1);
} catch(Exception) {}
} catch(Exception) { }
}
}
}
[NotMapped]
public int? AgeInt {
get {
if(DateNaissance.HasValue) {
return DateTime.Now.Year - DateNaissance.Value.Year;
}
return null;
}
}
[NotMapped]
public string AdresseCP => ModelContext.Getinstance().Preferences.Local[0].VilleCP;

View File

@ -19,7 +19,11 @@ namespace Hermes.Model {
base.OnModelCreating(modelBuilder);
}
public virtual DbSet<Citoyen> CitoyenSet { get; set; }
public virtual DbSet<Preferences> Preferences { get; set; }
public virtual DbSet<Citoyen> CitoyenSet {
get; set;
}
public virtual DbSet<Preferences> Preferences {
get; set;
}
}
}

View File

@ -2,9 +2,17 @@
namespace Hermes.Model {
public class Preferences {
public int Id { get; set; }
public string VilleCP { get; set; }
public string Ville { get; set; }
public string SmsApiKey { get; set; }
public int Id {
get; set;
}
public string VilleCP {
get; set;
}
public string Ville {
get; set;
}
public string SmsApiKey {
get; set;
}
}
}