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.
Ohara_MAUI/Sources/Model/Classes/Bateau.cs

143 lines
4.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Model.Classes
{
[DataContract(Name = "bateau")]
public class Bateau : ObjetOhara
{
[DataMember(Name = "nomromanise")]
private string nomromanise;
public string NomRomanise {
get=>nomromanise;
set
{
if(nomromanise == value) return;
nomromanise = value;
}
}
[DataMember(Name = "affiliation", EmitDefaultValue = false)]
private Equipage? equipage;
public Equipage? Affiliation {
get=>equipage;
set
{
if(equipage == value) return;
equipage = value;
}
}
[DataMember(Name = "premierchap")]
private int premierchap;
public int PremierChap
{
get => premierchap;
set
{
if (premierchap == value) return;
premierchap = value;
}
}
[DataMember(Name = "premierep")]
private int premierep;
public int PremierEp
{
get => premierep;
set
{
if (premierep == value) return;
premierep = value;
}
}
[DataMember(Name = "description")]
private string description;
public string Description
{
get => description;
set
{
if (description == value) return;
description = value;
}
}
[DataMember(Name = "caracteristique")]
private string caracteristique;
public string Caracteristique {
get=> caracteristique;
set
{
if(caracteristique == value) return;
caracteristique = value;
}
}
public Bateau(string nom, string nomRomanise, int premierChap, int premierEp, string description, string caracteristique) : base(nom)
{
NomRomanise = nomRomanise;
if (premierEp < 0)
{
PremierEp = 0;
}
else
{
PremierEp = premierEp;
}
if (premierChap < 0)
{
premierChap = 0;
}
else
{
PremierChap = premierChap;
}
Description = description;
Caracteristique = caracteristique;
}
public Bateau(string nom, string nomRomanise, int premierChap, int premierEp, string description, string caracteristique, string image) : this(nom, nomRomanise, premierChap, premierEp, description, caracteristique)
{
Image = image;
}
public Bateau(string nom, string nomRomanise, Equipage affiliation, int premierChap, int premierEp, string description, string caracteristique, string image) : this(nom, nomRomanise, premierChap, premierEp, description, caracteristique, image)
{
Affiliation = affiliation;
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
if (this.GetType() != obj.GetType())
{
return false;
}
else
{
Bateau o = (Bateau)obj;
return o.Nom == Nom;
}
}
public override int GetHashCode()
{
return HashCode.Combine(NomRomanise, Affiliation, PremierChap, PremierEp, Description, Caracteristique);
}
public override string ToString()
{
return "Bateau :" + Nom +" "+EstFavori +" " + NomRomanise + " " + Affiliation + " " + PremierChap + " " + PremierEp + " " + Description + " " + Caracteristique +" "+ Image;
}
}
}