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