correction of the last merge
continuous-integration/drone/push Build is failing Details

pull/44/head^2
Roxane ROSSETTO 2 years ago
parent 190e35b54b
commit a93132f712

@ -1,114 +1,114 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections; using System.Collections;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Text; using System.Text;
namespace Model namespace Model
{ {
/// <summary> /// <summary>
/// A user is an entity with a name, a surname, mail, profilePict and a list of priority. /// A user is an entity with a name, a surname, mail, profilePict and a list of priority.
/// This user can login with a Id and password /// This user can login with an Id and a password
/// </summary> /// </summary>
public class User : IEquatable<User> public class User : IEquatable<User>
{ {
#region Private Attributes #region Private Attributes
private string name=""; private string name="";
private string surname=""; private string surname="";
private string mail = ""; private string mail = "";
private string picture = ""; private string picture = "";
private int password ; private int password ;
private List<Priority> priorities; private List<Priority> priorities;
#endregion #endregion
#region Properties #region Properties
/// <summary> /// <summary>
/// Property to get Name of users and a setter /// Property to get Name of users and a setter
/// </summary> /// </summary>
/// <exception cref="ArgumentException" >Setter have Exception which is trigger when Name is null</exception> /// <exception cref="ArgumentException" >Setter have Exception which is trigger when Name is null</exception>
public string Name public string Name
{ {
get { return name; } get { return name; }
private set private set
{ {
if (string.IsNullOrWhiteSpace(value)) if (string.IsNullOrWhiteSpace(value))
{ {
throw new ArgumentException("Impossible d'avoir un champ Nom vide!"); throw new ArgumentException("Impossible d'avoir un champ Nom vide!");
} }
name = value; name = value;
} }
} }
/// <summary> /// <summary>
/// Property to get Surname of users and a setter /// Property to get Surname of users and a setter
/// </summary> /// </summary>
/// <exception cref="ArgumentException" >Setter have Exception which is trigger when Surname is null</exception> /// <exception cref="ArgumentException" >Setter have Exception which is trigger when Surname is null</exception>
public string Surname public string Surname
{ {
get { return surname; } get { return surname; }
private set private set
{ {
if (string.IsNullOrWhiteSpace(value)) if (string.IsNullOrWhiteSpace(value))
{ {
throw new ArgumentException("Impossible d'avoir un champ Prénom vide!"); throw new ArgumentException("Impossible d'avoir un champ Prénom vide!");
} }
surname = value; surname = value;
} }
} }
/// <summary> /// <summary>
/// Property to get mail of users and a setter /// Property to get mail of users and a setter
/// </summary> /// </summary>
/// <exception cref="ArgumentException" >User's mail will serve to log the user. So there's no setter, just an init. User will enter one time his email at his /// <exception cref="ArgumentException" >User's mail will serve to log the user. So there's no setter, just an init. User will enter one time his email at his
/// account creation.</exception> /// account creation.</exception>
public string Mail public string Mail
{ {
get { return mail; } get { return mail; }
private init private init
{ {
if (string.IsNullOrWhiteSpace(value)) if (string.IsNullOrWhiteSpace(value))
{ {
throw new ArgumentException("Impossible d'avoir un champ Email vide!"); throw new ArgumentException("Impossible d'avoir un champ Email vide!");
} }
mail = value; mail = value;
} }
} }
public int Password public int Password
{ {
get => password; get => password;
set => password = value; set => password = value;
} }
/// <summary> /// <summary>
/// For now, we define the ProfilPict as a string which is "PhotoParDefaut" /// For now, we define the ProfilPict as a string which is "PhotoParDefaut"
/// when the value is null. /// when the value is null.
/// </summary> /// </summary>
public string ProfilPict public string ProfilPict
{ {
get => picture; get => picture;
set => picture = value; set => picture = value;
} }
/// <summary> /// <summary>
/// This is the list of priorities specific tu the user. This list is initiate /// This is the list of priorities specific tu the user. This list is initiate
/// by default. User could change it at will. /// by default. User could change it at will.
/// </summary> /// </summary>
public List<Priority> Priorities public List<Priority> Priorities
{ {
get => priorities; get => priorities;
set=> priorities = value; set=> priorities = value;
} }
public override bool Equals(object? other) public override bool Equals(object? other)
{ {
if (other == null) return false; if (other == null) return false;
@ -117,41 +117,47 @@ namespace Model
} }
public bool Equals(User? other) public bool Equals(User? other)
{ {
if (other == null) return false; if (other == null) return false;
return Name.Equals(other.Name) && Surname.Equals(other.Surname) && Mail.Equals(other.Mail); return Name.Equals(other.Name) && Surname.Equals(other.Surname) && Mail.Equals(other.Mail);
} }
public override int GetHashCode()
#endregion {
throw new NotImplementedException();
}
#region Constructors
#endregion
/// <summary>
/// Construtors of user.
/// </summary> #region Constructors
/// <param name="name">The name of the user</param>
/// <param name="surname">The surname of the user</param> /// <summary>
/// <param name="mail">The user needs an email to login. </param> /// Construtors of user.
/// </summary>
/// <param name="name">The name of the user</param>
/// <param name="surname">The surname of the user</param>
/// <param name="mail">The user needs an email to login. </param>
public User(string name, string surname, string mail, int password) public User(string name, string surname, string mail, int password)
{ {
Name = name; Name = name;
Surname = surname; Surname = surname;
Mail = mail; Mail = mail;
Password = password; Password = password;
priorities = new List<Priority> { priorities = new List<Priority> {
Priority.Gourmet, Priority.Gourmet,
Priority.Economic, Priority.Economic,
Priority.Fast, Priority.Fast,
Priority.Light, Priority.Light,
Priority.Easy}; Priority.Easy};
ProfilPict = picture; ProfilPict = picture;
} }
#endregion
#endregion
}
}
}
}

Loading…
Cancel
Save