Ajout de Entite et des classe pour Animal + lien avec Detail animal

pull/18/head
Leana BESSON 2 years ago
parent 776f27764d
commit 186a73320f

@ -1,4 +1,5 @@
using Model; using Model;
using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -63,6 +64,7 @@ class Program
break; break;
case 2: case 2:
Console.Clear(); Console.Clear();
SelectionnerEspece();
break; break;
case 9: case 9:
Console.Clear(); Console.Clear();
@ -74,6 +76,124 @@ class Program
} }
} }
static private void AfficherListeEspece()
{
Console.WriteLine("LISTE DES ESPECES : ");
foreach (Espece espece in Theque.ListeEspeces)
{
Console.WriteLine("\t" + espece.Nom + " (" + espece.NomScientifique + ")");
}
Console.WriteLine("\n");
}
static private void SelectionnerEspece()
{
string choix = "";
while (choix != "-1")
{
AfficherListeEspece();
Console.Write("\n\tEntrer le nom de l'espèce à sélectionner (-1 pour annuler) : ");
choix = Console.ReadLine();
Espece? espece = Theque.RechercherEspece(choix);
if (espece != null)
{
AfficherEspece(espece);
}
else Console.WriteLine("\tChoix incorrect\n");
}
}
static private void AfficherEspece(Espece espece)
{
Console.WriteLine("\n" + espece.Nom);
Console.WriteLine("\tNom scientifique : " + espece.NomScientifique);
Console.WriteLine("\tEspérance de vie : " + espece.EsperanceVie);
Console.WriteLine("\tPoids moyen : " + espece.PoidsMoyen);
Console.WriteLine("\tTaille moyenne : " + espece.TailleMoyenne);
Console.WriteLine("\tComportement : " + espece.Comportement);
Console.WriteLine("\tSanté : " + espece.Sante);
Console.WriteLine("\tEducation : " + espece.Education);
Console.WriteLine("\tEntretien : " + espece.Entretien);
Console.WriteLine("\tCout : " + espece.Cout);
Console.WriteLine("\tConseil : " + espece.Conseil);
AfficherListeRace(espece);
while (true)
{
Console.WriteLine("\n\t1- Sélectionner une race");
Console.WriteLine("\t9- Retour");
Console.Write("\n\tEntrer votre choix : ");
int decision = Convert.ToInt32(Console.ReadLine());
switch (decision)
{
case 1:
SelectionnerRace(espece);
break;
case 9:
return;
default:
Console.WriteLine("\tChoix incorrect\n");
break;
}
}
}
static private void AfficherListeRace(Espece espece)
{
Console.WriteLine("\nLISTE DES RACES : ");
if (espece.ListeRaces != null)
{
foreach (Race race in espece.ListeRaces)
{
Console.WriteLine("\t" + race.Nom + " (" + race.NomScientifique + ")");
}
Console.WriteLine("\n");
}
else Console.WriteLine("\tAucune race connue.\n");
}
static private void SelectionnerRace(Espece espece)
{
string choix = "";
while (choix != "-1")
{
Console.Write("\n\tEntrer le nom de la race à sélectionner (-1 pour annuler) : ");
choix = Console.ReadLine();
if (choix != "-1")
{
Race? race = espece.RechercherRace(choix);
if (race != null)
{
AfficherRace(race);
}
else Console.WriteLine("\tChoix incorrect\n");
}
}
}
static private void AfficherRace(Race race)
{
Console.WriteLine("\n " + race.Nom);
Console.WriteLine("\tNom scientifique : " + race.NomScientifique);
Console.WriteLine("\tEspérance de vie : " + race.EsperanceVie);
Console.WriteLine("\tPoids moyen : " + race.PoidsMoyen);
Console.WriteLine("\tTaille moyenne : " + race.TailleMoyenne);
Console.WriteLine("\tComportement : " + race.Comportement);
Console.WriteLine("\tSante : " + race.Sante);
Console.WriteLine("\tEducation : " + race.Education);
Console.WriteLine("\tEntretien : " + race.Entretien);
Console.WriteLine("\tCout : " + race.Cout);
Console.WriteLine("\tConseil : " + race.Conseil + "\n\n");
}
static private void MenusAnimal() static private void MenusAnimal()
{ {
while (true) while (true)
@ -95,8 +215,12 @@ class Program
break; break;
case 2: case 2:
Console.Clear(); Console.Clear();
Animal animal = Theque.AjouterAnimal();
ModifierAnimal(animal, Theque.ListeEspeces);
break; break;
case 3: case 3:
Console.Clear();
SelectionnerAnimal();
break; break;
case 9: case 9:
Console.Clear(); Console.Clear();
@ -117,18 +241,7 @@ class Program
} }
} }
static private void AfficherListeEspece() static private void SelectionnerAnimal()
{
Console.WriteLine("LISTE DES ESPECES : ");
foreach (Espece espece in Theque.ListeEspeces)
{
Console.WriteLine("\t" + espece.Nom + " (" + espece.NomScientifique + ")");
}
Console.WriteLine("\n");
}
}
/*public void SelectionnerAnimal()
{ {
string choix = ""; string choix = "";
while (choix != "-1") while (choix != "-1")
@ -138,401 +251,189 @@ class Program
Console.Write("\n\tEntrer le nom de l'animal à sélectionner (-1 pour annuler) : "); Console.Write("\n\tEntrer le nom de l'animal à sélectionner (-1 pour annuler) : ");
choix = Console.ReadLine(); choix = Console.ReadLine();
Animal animal = Theque.RechercherAnimal(choix); Animal? animal = Theque.RechercherAnimal(choix);
if (animal != null) if (animal != null)
{ {
animal.AfficherAnimal(Theque.ListeAnimaux); AfficherAnimal(animal, Theque.ListeEspeces);
} }
else Console.WriteLine("\tChoix incorrect\n"); else Console.WriteLine("\tChoix incorrect\n");
} }
}*/
/*public void SelectionnerEspece()
{
string choix = "";
while (choix != "-1")
{
AfficherListeEspece();
Console.Write("\n\tEntrer le nom de l'espèce à sélectionner (-1 pour annuler) : ");
choix = Console.ReadLine();
Espece espece = RechercherEspece(choix);
if (espece != null)
{
espece.AfficherEspece();
}
else Console.WriteLine("\tChoix incorrect\n");
} }
}*/
/*public void AfficherRace() static private void AfficherAnimal(Animal animal, List<Espece> especetheque)
{
Console.WriteLine("\n " + Nom);
Console.WriteLine("\tNom scientifique : " + NomScientifique);
Console.WriteLine("\tEspérance de vie : " + EsperanceVie);
Console.WriteLine("\tPoids moyen : " + PoidsMoyen);
Console.WriteLine("\tTaille moyenne : " + TailleMoyenne);
Console.WriteLine("\tComportement : " + Comportement);
Console.WriteLine("\tSante : " + Sante);
Console.WriteLine("\tEducation : " + Education);
Console.WriteLine("\tEntretien : " + Entretien);
Console.WriteLine("\tCout : " + Cout);
Console.WriteLine("\tConseil : " + Conseil + "\n\n");
}*/
/*public void AfficherAnimal(Zootheque zootheque, Especetheque especetheque)
{
Console.Clear();
while (true)
{ {
Console.WriteLine("\n" + Nom); Console.Clear();
Console.WriteLine("\tEspece : " + Espece.Nom); while (true)
if (Race != null) Console.WriteLine("\tRace : " + Race.Nom);
Console.WriteLine("\tDate de naissance : " + DateNaissance);
Console.WriteLine("\tSexe : " + Sexe);
Console.WriteLine("\tDate d'adoption : " + DateAdoption);
Console.WriteLine("\tTaille : " + Taille);
Console.WriteLine("\tPoids : " + Poids);
Console.WriteLine("\tAlimentation : " + Alimentation);
Console.WriteLine("\n\t1- Modifier");
Console.WriteLine("\t2- Supprimer");
Console.WriteLine("\t9- Retour");
Console.Write("\n\tEntrer votre choix : ");
int decision = Convert.ToInt32(Console.ReadLine());
switch (decision)
{ {
case 1: Console.WriteLine("\n" + animal.Nom);
ModifierAnimal(especetheque); if (animal.Espece != null) Console.WriteLine("\tEspece : " + animal.Espece.Nom);
break; if (animal.Race != null) Console.WriteLine("\tRace : " + animal.Race.Nom);
case 2: Console.WriteLine("\tDate de naissance : " + animal.DateNaissance);
zootheque.SupprimerAnimal(this); Console.WriteLine("\tSexe : " + animal.Sexe);
return; Console.WriteLine("\tDate d'adoption : " + animal.DateAdoption);
case 9: Console.WriteLine("\tTaille : " + animal.Taille);
return; Console.WriteLine("\tPoids : " + animal.Poids);
default: Console.WriteLine("\tAlimentation : " + animal.Alimentation);
Console.WriteLine("\tChoix incorrect\n");
break; Console.WriteLine("\n\t1- Modifier");
} Console.WriteLine("\t2- Supprimer");
} Console.WriteLine("\t9- Retour");
}*/
/*public void ModifierNom() Console.Write("\n\tEntrer votre choix : ");
{ int decision = Convert.ToInt32(Console.ReadLine());
while (Nom == "")
{
Console.Write("\tNom : ");
Nom = Console.ReadLine();
}
}*/
/*public void ModifierEspece(Especetheque especetheque) switch (decision)
{ {
Espece? espece = null; case 1:
while (espece == null) ModifierAnimal(animal, especetheque);
{ break;
Console.Write("\tEspèce : "); case 2:
string nomEspece = Console.ReadLine(); Theque.SupprimerAnimal(animal);
espece = especetheque.RechercherEspece(nomEspece); return;
if (espece == null) case 9:
{ return;
Console.WriteLine("Espece inconnue\n"); default:
Console.WriteLine("\tChoix incorrect\n");
break;
}
} }
} }
Espece = espece; static private void ModifierAnimal(Animal animal, List<Espece> especetheque)
}*/
/*public void ModifierSexe()
{
string sexe = "sexe";
while (sexe != "Male" && sexe != "Femelle" && sexe != "")
{ {
Console.Write("\tSexe [Male|Femelle|] (appuyer sur entrer pour passer) : "); while (true)
sexe = Console.ReadLine(); {
} Console.WriteLine("MODIFIER L'ANIMAL ", animal.Nom);
Sexe = sexe; Console.WriteLine("\t1- Nom");
}*/ Console.WriteLine("\t2- Espece");
Console.WriteLine("\t3- Race");
/*public void ModifierTaille() Console.WriteLine("\t4- Date de naissance");
{ Console.WriteLine("\t5- Sexe");
Console.Write("\tTaille (appuyer sur entrer pour passer) : "); Console.WriteLine("\t6- Date d'adoption");
string taille = Console.ReadLine(); Console.WriteLine("\t7- Taille");
if (taille == "") Taille = null; Console.WriteLine("\t8- Poids");
else Taille = Single.Parse(taille); Console.WriteLine("\t9- Alimentation");
}*/ Console.WriteLine("\t19- Retour");
/*public void ModifierPoids()
{
Console.Write("\tPoids (appuyer sur entrer pour passer) : ");
string poids = Console.ReadLine();
if (poids == "") Poids = null;
else Poids = Single.Parse(poids);
}*/
/*public void ModifierAlimentation()
{
Console.Write("\tAlimentation (appuyer sur entrer pour passer) : ");
Alimentation = Console.ReadLine();
}*/
/*public void ModifierDateNaissance()
{
Console.Write("\tDate de naissance (appuyer sur entrer pour passer) : ");
DateNaissance = Console.ReadLine();
}*/
/*public void ModifierDateAdoption()
{
Console.Write("\tDate d'adoption (appuyer sur entrer pour passer) : ");
DateAdoption = Console.ReadLine();
}*/
/*public void ModifierRace() Console.Write("\n\tEntrer votre choix : ");
{ int decision = Convert.ToInt32(Console.ReadLine());
Console.Write("\tRace (appuyer sur entrer pour passer) : ");
string nomRace = Console.ReadLine();
Race = Espece.RechercherRace(nomRace);
}*/
/*public void ModifierAnimal(Especetheque especetheque) switch (decision)
{
while (true)
{
Console.WriteLine("MODIFIER L'ANIMAL ", Nom);
Console.WriteLine("\t1- Nom");
Console.WriteLine("\t2- Espece");
Console.WriteLine("\t3- Race");
Console.WriteLine("\t4- Date de naissance");
Console.WriteLine("\t5- Sexe");
Console.WriteLine("\t6- Date d'adoption");
Console.WriteLine("\t7- Taille");
Console.WriteLine("\t8- Poids");
Console.WriteLine("\t9- Alimentation");
Console.WriteLine("\t19- Retour");
Console.Write("\n\tEntrer votre choix : ");
int decision = Convert.ToInt32(Console.ReadLine());
switch (decision)
{
case 1:
ModifierNom();
break;
case 2:
ModifierEspece(especetheque);
break;
case 3:
ModifierRace();
break;
case 4:
ModifierDateNaissance();
break;
case 5:
ModifierSexe();
break;
case 6:
ModifierDateAdoption();
break;
case 7:
ModifierTaille();
break;
case 8:
ModifierPoids();
break;
case 9:
ModifierAlimentation();
break;
case 19:
return;
default:
Console.WriteLine("\tChoix incorrect\n");
break;
}
}
}*/
/*internal void AffficherListeRace()
{
Console.WriteLine("\nLISTE DES RACES : ");
if (ListeRaces != null)
{
foreach (Race race in ListeRaces)
{ {
Console.WriteLine("\t" + race.Nom + " (" + race.NomScientifique + ")"); case 1:
ModifierNom(animal);
break;
case 2:
ModifierEspece(animal, especetheque);
break;
case 3:
ModifierRace(animal);
break;
case 4:
ModifierDateNaissance(animal);
break;
case 5:
ModifierSexe(animal);
break;
case 6:
ModifierDateAdoption(animal);
break;
case 7:
ModifierTaille(animal);
break;
case 8:
ModifierPoids(animal);
break;
case 9:
ModifierAlimentation(animal);
break;
case 19:
return;
default:
Console.WriteLine("\tChoix incorrect\n");
break;
} }
Console.WriteLine("\n");
} }
else Console.WriteLine("\tAucune race connue.\n"); }
}*/
/*public void AfficherEspece() static private void ModifierNom(Animal animal)
{
Console.WriteLine("\n" + Nom);
Console.WriteLine("\tNom scientifique : " + NomScientifique);
Console.WriteLine("\tEspérance de vie : " + EsperanceVie);
Console.WriteLine("\tPoids moyen : " + PoidsMoyen);
Console.WriteLine("\tTaille moyenne : " + TailleMoyenne);
Console.WriteLine("\tComportement : " + Comportement);
Console.WriteLine("\tSanté : " + Sante);
Console.WriteLine("\tEducation : " + Education);
Console.WriteLine("\tEntretien : " + Entretien);
Console.WriteLine("\tCout : " + Cout);
Console.WriteLine("\tConseil : " + Conseil);
AffficherListeRace();
while (true)
{ {
Console.WriteLine("\n\t1- Sélectionner une race"); while (animal.Nom == "")
Console.WriteLine("\t9- Retour");
Console.Write("\n\tEntrer votre choix : ");
int decision = Convert.ToInt32(Console.ReadLine());
switch (decision)
{ {
case 1: Console.Write("\tNom : ");
SelectionnerRace(); animal.Nom = Console.ReadLine();
break;
case 9:
return;
default:
Console.WriteLine("\tChoix incorrect\n");
break;
} }
} }
}*/
/*public Race? RechercherRace(string choix) static private void ModifierEspece(Animal animal, List<Espece> especetheque)
{
if (ListeRaces != null && choix != "")
{ {
foreach (Race race in ListeRaces) Espece? espece = null;
while (espece == null)
{ {
if (race.Nom == choix) Console.Write("\tEspèce : ");
string nomEspece = Console.ReadLine();
espece = Theque.RechercherEspece(nomEspece);
if (espece == null)
{ {
return race; Console.WriteLine("Espece inconnue\n");
} }
} }
Console.WriteLine("\n");
animal.Espece = espece;
} }
return null;
}*/
/*public void SelectionnerRace () static private void ModifierSexe(Animal animal)
{
string choix = "";
while (choix != "-1")
{ {
Console.Write("\n\tEntrer le nom de la race à sélectionner (-1 pour annuler) : "); string sexe = "sexe";
choix = Console.ReadLine(); while (sexe != "Male" && sexe != "Femelle" && sexe != "")
if (choix != "-1")
{ {
Race race = RechercherRace(choix); Console.Write("\tSexe [Male|Femelle|] (appuyer sur entrer pour passer) : ");
sexe = Console.ReadLine();
if (race != null)
{
race.AfficherRace();
}
else Console.WriteLine("\tChoix incorrect\n");
} }
animal.Sexe = sexe;
} }
}*/
/*internal void AffficherListeRace() static private void ModifierTaille(Animal animal)
{
Console.WriteLine("\nLISTE DES RACES : ");
if (ListeRaces != null)
{ {
foreach (Race race in ListeRaces) Console.Write("\tTaille (appuyer sur entrer pour passer) : ");
{ string taille = Console.ReadLine();
Console.WriteLine("\t" + race.Nom + " (" + race.NomScientifique + ")"); if (taille == "") animal.Taille = null;
} else animal.Taille = Single.Parse(taille);
Console.WriteLine("\n");
} }
else Console.WriteLine("\tAucune race connue.\n");
}*/
/*public void AfficherEspece() static private void ModifierPoids(Animal animal)
{
Console.WriteLine("\n" + Nom);
Console.WriteLine("\tNom scientifique : " + NomScientifique);
Console.WriteLine("\tEspérance de vie : " + EsperanceVie);
Console.WriteLine("\tPoids moyen : " + PoidsMoyen);
Console.WriteLine("\tTaille moyenne : " + TailleMoyenne);
Console.WriteLine("\tComportement : " + Comportement);
Console.WriteLine("\tSanté : " + Sante);
Console.WriteLine("\tEducation : " + Education);
Console.WriteLine("\tEntretien : " + Entretien);
Console.WriteLine("\tCout : " + Cout);
Console.WriteLine("\tConseil : " + Conseil);
AffficherListeRace();
while (true)
{ {
Console.WriteLine("\n\t1- Sélectionner une race"); Console.Write("\tPoids (appuyer sur entrer pour passer) : ");
Console.WriteLine("\t9- Retour"); string poids = Console.ReadLine();
if (poids == "") animal.Poids = null;
Console.Write("\n\tEntrer votre choix : "); else animal.Poids = Single.Parse(poids);
int decision = Convert.ToInt32(Console.ReadLine());
switch (decision)
{
case 1:
SelectionnerRace();
break;
case 9:
return;
default:
Console.WriteLine("\tChoix incorrect\n");
break;
}
} }
}*/
/*public Race? RechercherRace(string choix) static private void ModifierAlimentation(Animal animal)
{
if (ListeRaces != null && choix != "")
{ {
foreach (Race race in ListeRaces) Console.Write("\tAlimentation (appuyer sur entrer pour passer) : ");
{ animal.Alimentation = Console.ReadLine();
if (race.Nom == choix)
{
return race;
}
}
Console.WriteLine("\n");
} }
return null;
}
}*/
/*public void SelectionnerRace() static private void ModifierDateNaissance(Animal animal)
{
string choix = "";
while (choix != "-1")
{ {
Console.Write("\n\tEntrer le nom de la race à sélectionner (-1 pour annuler) : "); Console.Write("\tDate de naissance (appuyer sur entrer pour passer) : ");
choix = Console.ReadLine(); animal.DateNaissance = Console.ReadLine();
if (choix != "-1") }
{
Race race = RechercherRace(choix); static private void ModifierDateAdoption(Animal animal)
{
Console.Write("\tDate d'adoption (appuyer sur entrer pour passer) : ");
animal.DateAdoption = Console.ReadLine();
if (race != null)
{
race.AfficherRace();
}
else Console.WriteLine("\tChoix incorrect\n");
}
} }
}*/
static private void ModifierRace(Animal animal)
{
Console.Write("\tRace (appuyer sur entrer pour passer) : ");
string nomRace = Console.ReadLine();
animal.Race = animal.Espece.RechercherRace(nomRace);
}
}

@ -127,6 +127,71 @@ namespace Model
} }
private Race? race; private Race? race;
public Veterinaire? Veterinaire
{
get => veterinaire;
set
{
if(veterinaire == value)
return;
veterinaire = value;
OnPropertyChanged(nameof(Veterinaire));
}
}
private Veterinaire? veterinaire = new Veterinaire();
public Chenil? Chenil
{
get => chenil;
set
{
if (chenil == value)
return;
chenil = value;
OnPropertyChanged(nameof(Chenil));
}
}
private Chenil? chenil = new Chenil();
public MagasinAlimentaire? MagasinAlimentaire
{
get => magasinAlimentaire;
set
{
if (magasinAlimentaire == value)
return;
magasinAlimentaire = value;
OnPropertyChanged(nameof(MagasinAlimentaire));
}
}
private MagasinAlimentaire? magasinAlimentaire = new MagasinAlimentaire();
public Provenance? Provenance
{
get => provenance;
set
{
if (provenance == value)
return;
provenance = value;
OnPropertyChanged(nameof(Petsitter));
}
}
private Provenance? provenance = new Provenance();
public Petsitter? Petsitter
{
get => petsitter;
set
{
if (petsitter == value)
return;
petsitter = value;
OnPropertyChanged(nameof(Petsitter));
}
}
private Petsitter? petsitter = new Petsitter();
public Animal(string nom = "", string dateNaissance = "Inconnue", string sexe = "Inconnu", string dateAdpotion = "Inconnue", float? taille = null, float? poids = null, string alimentation = "Inconnue", Race? race = null) public Animal(string nom = "", string dateNaissance = "Inconnue", string sexe = "Inconnu", string dateAdpotion = "Inconnue", float? taille = null, float? poids = null, string alimentation = "Inconnue", Race? race = null)
{ {
Nom = nom; Nom = nom;
@ -137,6 +202,7 @@ namespace Model
Poids = poids; Poids = poids;
Alimentation = alimentation; Alimentation = alimentation;
Race = race; Race = race;
Petsitter = petsitter;
} }
void OnPropertyChanged(string propertyName) void OnPropertyChanged(string propertyName)

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class Chenil : Entite
{
public Entite Entite { get; set; }
public Chenil()
{
Entite = new Entite();
}
}
}

@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.IO.Pipes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class Entite : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
public string Nom
{
get => nom;
set
{
if (nom == value)
return;
nom = value;
OnPropertyChanged(nameof(Nom));
}
}
private string nom;
public string Adresse
{
get => adresse;
set
{
if (adresse == value)
return;
adresse = value;
OnPropertyChanged(nameof(Adresse));
}
}
private string adresse;
public int? CodePostal
{
get => codePostal;
set
{
if (codePostal == value)
return;
codePostal = value;
OnPropertyChanged(nameof(CodePostal));
}
}
private int? codePostal;
public string Ville
{
get => ville;
set
{
if (ville == value)
return;
ville = value;
OnPropertyChanged(nameof(Ville));
}
}
private string ville;
public int? NumTel
{
get => numTel;
set
{
if(numTel == value)
return;
numTel = value;
OnPropertyChanged(nameof(NumTel));
}
}
private int? numTel;
public Entite(string nom = "", string adresse = "", int? codePostal = null, string ville = "", int? numTel = null)
{
Nom = nom;
Adresse = adresse;
CodePostal = codePostal;
Ville = ville;
NumTel = numTel;
}
void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}

@ -16,7 +16,7 @@ namespace Model
public string EsperanceVie { get; } public string EsperanceVie { get; }
public string PoidsMoyen { get; } public string PoidsMoyen { get; }
public string TailleMoyenne { get; } public string TailleMoyenne { get; }
public HashSet<Race>? ListeRaces { get; } = new HashSet<Race>(); public List<Race>? ListeRaces { get; } = new List<Race>();
public string Comportement { get; } public string Comportement { get; }
public string Sante { get; } public string Sante { get; }
public string Education { get; } public string Education { get; }
@ -24,7 +24,7 @@ namespace Model
public string Cout { get; } public string Cout { get; }
public string Conseil { get; } public string Conseil { get; }
public Espece(string nom = "", string nomScientifique = "", string image = "", string esperanceVie = "", string poidsMoyen = "", string tailleMoyenne = "", HashSet<Race>? races = null, string comportement = "", string sante = "", string education = "", string entretien = "", string cout = "", string conseil = "") public Espece(string nom = "", string nomScientifique = "", string image = "", string esperanceVie = "", string poidsMoyen = "", string tailleMoyenne = "", List<Race>? races = null, string comportement = "", string sante = "", string education = "", string entretien = "", string cout = "", string conseil = "")
{ {
Nom = nom; Nom = nom;
NomScientifique = nomScientifique; NomScientifique = nomScientifique;
@ -45,5 +45,21 @@ namespace Model
{ {
return Nom; return Nom;
} }
public Race? RechercherRace(string choix)
{
if (ListeRaces != null && choix != "")
{
foreach (Race race in ListeRaces)
{
if (race.Nom == choix)
{
return race;
}
}
Console.WriteLine("\n");
}
return null;
}
} }
} }

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class MagasinAlimentaire : Entite
{
public Entite Entite { get; set; }
public MagasinAlimentaire()
{
Entite = new Entite();
}
}
}

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class Petsitter : Entite
{
public Entite Entite { get; set; }
public Petsitter()
{
Entite = new Entite();
}
}
}

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class Provenance : Entite
{
public Entite Entite { get; set; }
public Provenance()
{
Entite = new Entite();
}
}
}

@ -34,5 +34,9 @@ namespace Model
Cout = cout; Cout = cout;
Conseil = conseil; Conseil = conseil;
} }
public override string ToString()
{
return Nom;
}
} }
} }

@ -11,7 +11,7 @@ namespace Model
public static List<Espece> LoadEspecetheque() public static List<Espece> LoadEspecetheque()
{ {
List<Espece> ListeEspeces = new List<Espece>(); List<Espece> ListeEspeces = new List<Espece>();
HashSet<Race> Races = new HashSet<Race>(); List<Race> Races = new List<Race>();
Races.Add(new("Abyssin")); Races.Add(new("Abyssin"));
Races.Add(new("American curl")); Races.Add(new("American curl"));

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class Veterinaire : Entite
{
public Entite Entite { get; set; }
//public string Clinique
//{
// get => clinique;
//set
//{
// if(clinique == value)
// return;
// clinique = value;
//}
// }
private string clinique;
public Veterinaire()
{
Entite = new Entite();
}
}
}

@ -43,7 +43,7 @@
<VerticalStackLayout Grid.Column="1"> <VerticalStackLayout Grid.Column="1">
<Label Text="{Binding Nom}" <Label Text="{Binding Nom}"
FontSize="Large"/> FontSize="Large"/>
<Label Text="{Binding NomScientifique}" <Label Text="{Binding Espece}"
FontSize="12"/> FontSize="12"/>
</VerticalStackLayout> </VerticalStackLayout>
</Grid> </Grid>

@ -35,21 +35,21 @@
<Label Grid.Row="1" <Label Grid.Row="1"
FontAttributes="Bold" FontAttributes="Bold"
Text="Sexe"/> Text="Sexe"/>
<Entry Grid.Column="2" <Entry Grid.Column="1"
Grid.Row="1" Grid.Row="1"
HorizontalOptions="End" HorizontalOptions="End"
Text="{Binding Sexe}"/> Text="{Binding Sexe}"/>
<Label Grid.Row="2" <Label Grid.Row="2"
FontAttributes="Bold" FontAttributes="Bold"
Text="Date d'adoption"/> Text="Date d'adoption"/>
<Entry Grid.Column="2" <Entry Grid.Column="1"
Grid.Row="2" Grid.Row="2"
HorizontalOptions="End" HorizontalOptions="End"
Text="{Binding DateAdoption}"/> Text="{Binding DateAdoption}"/>
<Label Grid.Row="3" <Label Grid.Row="3"
FontAttributes="Bold" FontAttributes="Bold"
Text="Taille"/> Text="Taille"/>
<HorizontalStackLayout Grid.Column="2" <HorizontalStackLayout Grid.Column="1"
Grid.Row="3" Grid.Row="3"
HorizontalOptions="End"> HorizontalOptions="End">
<Entry Text="{Binding Taille}"/> <Entry Text="{Binding Taille}"/>
@ -96,7 +96,7 @@
Grid.Column="1" Grid.Column="1"
ColumnDefinitions="*" ColumnDefinitions="*"
RowDefinitions="Auto, Auto"> RowDefinitions="Auto, Auto">
<Label Text="{Binding Alimentation}" <Label Text="{Binding Race}"
VerticalOptions="Start" VerticalOptions="Start"
HorizontalOptions="End"/> HorizontalOptions="End"/>
<Picker Grid.Row="1" <Picker Grid.Row="1"
@ -107,7 +107,242 @@
</Picker> </Picker>
</Grid> </Grid>
</Grid> </Grid>
</Border> </Border>
</VerticalStackLayout>
<VerticalStackLayout
Margin="20">
<Label Text="Petsitter"
FontSize="Large"/>
<Border Stroke="{StaticResource Secondary}"
StrokeThickness="2"
Padding="10"
Background="{StaticResource Primary}">
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto"
ColumnDefinitions="*, *">
<Label FontAttributes="Bold"
Text="Nom"/>
<Entry Grid.Column="1"
HorizontalOptions="End"
Text="{Binding Petsitter.Entite.Nom}"/>
<Label Grid.Row="1"
FontAttributes="Bold"
Text="Adresse"/>
<Entry Grid.Column="1"
Grid.Row="1"
HorizontalOptions="End"
Text="{Binding Petsitter.Entite.Adresse}"/>
<Label Grid.Row="2"
FontAttributes="Bold"
Text="Code postal"/>
<Entry Grid.Column="1"
Grid.Row="2"
HorizontalOptions="End"
Text="{Binding Petsitter.Entite.CodePostal}"/>
<Label Grid.Row="3"
FontAttributes="Bold"
Text="Ville"/>
<Entry Grid.Column="1"
Grid.Row="3"
HorizontalOptions="End"
Text="{Binding Petsitter.Entite.Ville}"/>
<Label Grid.Row="4"
FontAttributes="Bold"
Text="Numéro de téléphone"/>
<Entry Grid.Column="1"
Grid.Row="4"
HorizontalOptions="End"
Text="{Binding Petsitter.Entite.NumTel}"/>
</Grid>
</Border>
</VerticalStackLayout>
<VerticalStackLayout
Margin="20">
<Label Text="Chenil"
FontSize="Large"/>
<Border Stroke="{StaticResource Secondary}"
StrokeThickness="2"
Padding="10"
Background="{StaticResource Primary}">
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto"
ColumnDefinitions="*, *">
<Label FontAttributes="Bold"
Text="Nom"/>
<Entry Grid.Column="1"
HorizontalOptions="End"
Text="{Binding Chenil.Entite.Nom}"/>
<Label Grid.Row="1"
FontAttributes="Bold"
Text="Adresse"/>
<Entry Grid.Column="1"
Grid.Row="1"
HorizontalOptions="End"
Text="{Binding Chenil.Entite.Adresse}"/>
<Label Grid.Row="2"
FontAttributes="Bold"
Text="Code postal"/>
<Entry Grid.Column="1"
Grid.Row="2"
HorizontalOptions="End"
Text="{Binding Chenil.Entite.CodePostal}"/>
<Label Grid.Row="3"
FontAttributes="Bold"
Text="Ville"/>
<Entry Grid.Column="1"
Grid.Row="3"
HorizontalOptions="End"
Text="{Binding Chenil.Entite.Ville}"/>
<Label Grid.Row="4"
FontAttributes="Bold"
Text="Numéro de téléphone"/>
<Entry Grid.Column="1"
Grid.Row="4"
HorizontalOptions="End"
Text="{Binding Chenil.Entite.NumTel}"/>
</Grid>
</Border>
</VerticalStackLayout>
<VerticalStackLayout
Margin="20">
<Label Text="Vétérinaire"
FontSize="Large"/>
<Border Stroke="{StaticResource Secondary}"
StrokeThickness="2"
Padding="10"
Background="{StaticResource Primary}">
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto"
ColumnDefinitions="*, *">
<Label FontAttributes="Bold"
Text="Nom"/>
<Entry Grid.Column="1"
HorizontalOptions="End"
Text="{Binding Veterinaire.Entite.Nom}"/>
<Label Grid.Row="1"
FontAttributes="Bold"
Text="Adresse"/>
<Entry Grid.Column="1"
Grid.Row="1"
HorizontalOptions="End"
Text="{Binding Veterinaire.Entite.Adresse}"/>
<Label Grid.Row="2"
FontAttributes="Bold"
Text="Code postal"/>
<Entry Grid.Column="1"
Grid.Row="2"
HorizontalOptions="End"
Text="{Binding Veterinaire.Entite.CodePostal}"/>
<Label Grid.Row="3"
FontAttributes="Bold"
Text="Ville"/>
<Entry Grid.Column="1"
Grid.Row="3"
HorizontalOptions="End"
Text="{Binding Veterinaire.Entite.Ville}"/>
<Label Grid.Row="4"
FontAttributes="Bold"
Text="Numéro de téléphone"/>
<Entry Grid.Column="1"
Grid.Row="4"
HorizontalOptions="End"
Text="{Binding Veterinaire.Entite.NumTel}"/>
</Grid>
</Border>
</VerticalStackLayout>
<VerticalStackLayout
Margin="20">
<Label Text="Magasin alimentaire"
FontSize="Large"/>
<Border Stroke="{StaticResource Secondary}"
StrokeThickness="2"
Padding="10"
Background="{StaticResource Primary}">
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto"
ColumnDefinitions="*, *">
<Label FontAttributes="Bold"
Text="Nom"/>
<Entry Grid.Column="1"
HorizontalOptions="End"
Text="{Binding MagasinAlimentaire.Entite.Nom}"/>
<Label Grid.Row="1"
FontAttributes="Bold"
Text="Adresse"/>
<Entry Grid.Column="1"
Grid.Row="1"
HorizontalOptions="End"
Text="{Binding MagasinAlimentaire.Entite.Adresse}"/>
<Label Grid.Row="2"
FontAttributes="Bold"
Text="Code postal"/>
<Entry Grid.Column="1"
Grid.Row="2"
HorizontalOptions="End"
Text="{Binding MagasinAlimentaire.Entite.CodePostal}"/>
<Label Grid.Row="3"
FontAttributes="Bold"
Text="Ville"/>
<Entry Grid.Column="1"
Grid.Row="3"
HorizontalOptions="End"
Text="{Binding MagasinAlimentaire.Entite.Ville}"/>
<Label Grid.Row="4"
FontAttributes="Bold"
Text="Numéro de téléphone"/>
<Entry Grid.Column="1"
Grid.Row="4"
HorizontalOptions="End"
Text="{Binding MagasinAlimentaire.Entite.NumTel}"/>
</Grid>
</Border>
</VerticalStackLayout>
<VerticalStackLayout
Margin="20">
<Label Text="Refuge, élevage, chenil de provenance"
FontSize="Large"/>
<Border Stroke="{StaticResource Secondary}"
StrokeThickness="2"
Padding="10"
Background="{StaticResource Primary}">
<Grid RowDefinitions="Auto, Auto, Auto, Auto, Auto"
ColumnDefinitions="*, *">
<Label FontAttributes="Bold"
Text="Nom"/>
<Entry Grid.Column="1"
HorizontalOptions="End"
Text="{Binding Provenance.Entite.Nom}"/>
<Label Grid.Row="1"
FontAttributes="Bold"
Text="Adresse"/>
<Entry Grid.Column="1"
Grid.Row="1"
HorizontalOptions="End"
Text="{Binding Provenance.Entite.Adresse}"/>
<Label Grid.Row="2"
FontAttributes="Bold"
Text="Code postal"/>
<Entry Grid.Column="1"
Grid.Row="2"
HorizontalOptions="End"
Text="{Binding Provenance.Entite.CodePostal}"/>
<Label Grid.Row="3"
FontAttributes="Bold"
Text="Ville"/>
<Entry Grid.Column="1"
Grid.Row="3"
HorizontalOptions="End"
Text="{Binding Provenance.Entite.Ville}"/>
<Label Grid.Row="4"
FontAttributes="Bold"
Text="Numéro de téléphone"/>
<Entry Grid.Column="1"
Grid.Row="4"
HorizontalOptions="End"
Text="{Binding Provenance.Entite.NumTel}"/>
</Grid>
</Border>
</VerticalStackLayout>
</VerticalStackLayout>
</ScrollView> </ScrollView>
</ContentPage> </ContentPage>

@ -20,6 +20,7 @@ public partial class DetailAnimal : ContentPage
private void EspeceClic(object sender, EventArgs e) private void EspeceClic(object sender, EventArgs e)
{ {
(App.Current as App).AnimalSelectionner.Espece = (sender as Picker).SelectedItem as Espece; (App.Current as App).AnimalSelectionner.Espece = (sender as Picker).SelectedItem as Espece;
(App.Current as App).AnimalSelectionner.Race = null;
} }
private void RaceClic(object sender, EventArgs e) private void RaceClic(object sender, EventArgs e)

Loading…
Cancel
Save