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.
SAE-2.01/MCTG/MCTGLib/User.cs

108 lines
2.6 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
{
picture = value;
if (picture == null)
{
picture = "PhotoParDefaut";
}
}
}
/// <summary>
/// Property to get Name of users, without setter because we don't want users
/// to change their Name.
/// </summary>
public string Name
{
get { return name; }
private set
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentNullException();
}
name = value;
}
}
public string Surname
{
get { return surname; }
private set { 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
}
}