You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
3.5 KiB
110 lines
3.5 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Modèle
|
|
{
|
|
public class Requin : IEquatable<Requin>
|
|
{
|
|
public string Nom { get; private set; }
|
|
public string NomSci { get; private set; }
|
|
public string Description { get; private set; }
|
|
public string Photo { get; private set; }
|
|
public string Video { get; private set; }
|
|
public string PhotoCarte { get; private set; }
|
|
public Conservation StatutCons { get; private set; }
|
|
public string FunFact { get; private set; }
|
|
public List<Zone> Repartition { get; private set; }
|
|
|
|
|
|
public Requin(string nom, string nomSci, string description, string photo, string video, string photoCarte, Conservation statutCons, List<Zone> repartition, string funFact) {
|
|
Nom = nom;
|
|
NomSci = nomSci;
|
|
Description = description;
|
|
Photo = photo;
|
|
Video = video;
|
|
PhotoCarte = photoCarte;
|
|
StatutCons = statutCons;
|
|
Repartition = repartition;
|
|
FunFact = funFact;
|
|
}
|
|
|
|
public Requin(string nom, string nomSci, string description, string photo, string video, string photoCarte, Conservation statutCons, List<Zone> repartition, List<string> funFacts)
|
|
{
|
|
Random rnd = new Random();
|
|
int num = rnd.Next(funFacts.Count());
|
|
Nom = nom;
|
|
NomSci = nomSci;
|
|
Description = description;
|
|
Photo = photo;
|
|
Video = video;
|
|
PhotoCarte = photoCarte;
|
|
StatutCons = statutCons;
|
|
Repartition = repartition;
|
|
FunFact = funFacts[num];
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Nom + " " + NomSci + " " + Description + " " + StatutCons + " " + FunFact + " " + Photo;
|
|
}
|
|
|
|
|
|
public void ModiferRequin(string description, string photo, string video, string photoCarte, Conservation statutCons, List<Zone> repartition, string funFact)
|
|
{
|
|
if (! string.IsNullOrWhiteSpace(description))
|
|
{
|
|
Description = description;
|
|
}
|
|
if(! string.IsNullOrWhiteSpace(photo))
|
|
{
|
|
Photo = photo;
|
|
}
|
|
if(!string.IsNullOrWhiteSpace(video))
|
|
{
|
|
Video = video;
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(photoCarte))
|
|
{
|
|
Photo = photoCarte;
|
|
}
|
|
if (statutCons != Conservation.NE)
|
|
{
|
|
StatutCons = statutCons;
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(funFact))
|
|
{
|
|
FunFact = funFact;
|
|
}
|
|
if (repartition.Count()!= 0){
|
|
Repartition.Clear();
|
|
foreach(Zone z in repartition)
|
|
{
|
|
Repartition.Add(z);
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool Equals(Requin r)
|
|
{
|
|
return r.Nom == Nom && r.NomSci == NomSci;
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (ReferenceEquals(obj, null)) return false;
|
|
if (ReferenceEquals(obj, this)) return true;
|
|
if (GetType() != obj.GetType()) return false;
|
|
return Equals(obj as Requin);
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return Nom.GetHashCode() ^ NomSci.GetHashCode();
|
|
}
|
|
}
|
|
|
|
}
|