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

160 lines
4.6 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
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;
OnPropertyChanged();
}
}
[DataMember(Name = "affiliation", EmitDefaultValue = false)]
private Equipage? equipage;
public Equipage? Affiliation {
get=>equipage;
set
{
if(equipage == value) return;
equipage = value;
OnPropertyChanged();
}
}
[DataMember(Name = "premierchap")]
private int premierchap;
public int PremierChap
{
get => premierchap;
set
{
if (premierchap == value) return;
premierchap = value;
OnPropertyChanged();
}
}
[DataMember(Name = "premierep")]
private int premierep;
public int PremierEp
{
get => premierep;
set
{
if (premierep == value) return;
premierep = value;
OnPropertyChanged();
}
}
[DataMember(Name = "description")]
private string? description;
public string? Description
{
get => description;
set
{
if (description == value) return;
description = value;
OnPropertyChanged();
}
}
[DataMember(Name = "caracteristique")]
private string? caracteristique;
public string? Caracteristique {
get=> caracteristique;
set
{
if(caracteristique == value) return;
caracteristique = value;
OnPropertyChanged();
}
}
public Bateau(string nom, string nomRomanise, int premierChap, int premierEp, string description, string? caracteristique) : base(nom)
{
if (String.IsNullOrEmpty(nomRomanise))
NomRomanise = "";
else
NomRomanise = nomRomanise;
if (premierEp < 0)
{
PremierEp = 0;
}
else
{
PremierEp = premierEp;
}
if (premierChap < 0 )
{
PremierChap = 0;
}
else
{
PremierChap = premierChap;
}
if (String.IsNullOrEmpty(description))
Description = "Description du bateau ...";
else
Description = description;
if (String.IsNullOrEmpty(caracteristique))
Caracteristique = "Caracteristiques du bateau ...";
else
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)
{
if (String.IsNullOrEmpty(image))
image = "baseimage.png";
Image = image;
}
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;
}
}
}