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.
118 lines
3.2 KiB
118 lines
3.2 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections;
|
|
using System.Collections.ObjectModel;
|
|
using System.Threading.Tasks;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace MCTGLib
|
|
{
|
|
/// <summary>
|
|
/// 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
|
|
/// </summary>
|
|
public class User
|
|
{
|
|
#region Private Attributes
|
|
|
|
private string name;
|
|
private string surname;
|
|
private string mail;
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
private string picture;
|
|
/// <summary>
|
|
/// For now, we define the ProfilPict as a string which is "PhotoParDefaut"
|
|
/// when the value is null.
|
|
/// </summary>
|
|
public string ProfilPict
|
|
{
|
|
get => picture;
|
|
set
|
|
{
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
{
|
|
throw new ArgumentNullException("Erreur pour la photo d'utilisateur!");
|
|
}
|
|
|
|
|
|
}
|
|
/// <summary>
|
|
/// Property to get Name of users and a setter
|
|
/// </summary>
|
|
/// <exception cref="ArgumentNullException" >Setter have Exception which is trigger when Name is null</exception>
|
|
public string Name
|
|
{
|
|
get { return name; }
|
|
private set
|
|
{
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
{
|
|
throw new ArgumentNullException("Il y a une erreur de Nom d'utilisateur!");
|
|
}
|
|
name = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Property to get Surname of users and a setter
|
|
/// </summary>
|
|
/// <exception cref="ArgumentNullException" >Setter have Exception which is trigger when Surname is null</exception>
|
|
public string Surname
|
|
{
|
|
get { return surname; }
|
|
private set
|
|
{
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
{
|
|
throw new ArgumentNullException("Il y a une erreur de Prénom d'utilisateur");
|
|
}
|
|
surname = value;
|
|
}
|
|
}
|
|
public string Mail
|
|
{
|
|
get { return mail; }
|
|
private set { mail = value; }
|
|
}
|
|
|
|
|
|
private List<Priority> priorities;
|
|
public List<Priority> Priorities
|
|
{
|
|
get => priorities;
|
|
set=> priorities = value;
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region Constructors
|
|
|
|
/// <summary>
|
|
/// Construtors of user.
|
|
/// </summary>
|
|
public User(string name, string surname, string mail)
|
|
{
|
|
Name = name;
|
|
Surname = surname;
|
|
Mail = mail;
|
|
priorities = new List<Priority> {
|
|
Priority.Gourmet,
|
|
Priority.Economic,
|
|
Priority.Fast,
|
|
Priority.Light,
|
|
Priority.Easy};
|
|
ProfilPict = picture;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|