using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations.Schema; using System.IO.Pipes; using System.Linq; using System.Runtime.Serialization; using System.Security; using System.Text; using System.Threading.Tasks; namespace Model { [DataContract(Name = "entite")] public class Entite : INotifyPropertyChanged { public event PropertyChangedEventHandler? PropertyChanged; [DataMember(Name = "nom")] public string? Nom { get => nom; set { if (nom == value) return; nom = value; OnPropertyChanged(nameof(Nom)); } } private string? nom; [DataMember(Name = "adresse")] public string? Adresse { get => adresse; set { if (adresse == value) return; adresse = value; OnPropertyChanged(nameof(Adresse)); } } private string? adresse; [DataMember(Name = "codePostal")] public int? CodePostal { get => codePostal; set { if (codePostal == value) return; codePostal = value; OnPropertyChanged(nameof(CodePostal)); } } private int? codePostal; [DataMember(Name = "ville")] public string? Ville { get => ville; set { if (ville == value) return; ville = value; OnPropertyChanged(nameof(Ville)); } } private string? ville; [DataMember(Name = "numTel")] public int? NumTel { get => numTel; set { if(numTel == value) return; numTel = value; OnPropertyChanged(nameof(NumTel)); } } private int? numTel; public Entite() { Nom = ""; Adresse = ""; CodePostal = null; Ville = ""; NumTel = null; } public void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } public bool CodePostalValidate(string? codePostal) { if ((codePostal != null && !Theque.IntValidate(codePostal)) || (codePostal != null && Theque.IntValidate(codePostal) && Convert.ToInt32(codePostal) < 10000 && Convert.ToInt32(codePostal) > 99999)) return false; return true; } } }