transfers francais à englais

pull/17/head
Matheo THIERRY 2 years ago
parent 317b9441bd
commit aff1a84ff1

@ -10,89 +10,81 @@ namespace Biblioteque_de_Class
{
public class Database
{
private List<Logo> ListDefaultLogo;
private List<Theme> ListTheme;
private List<Utilisateur> ListUtilisateur;
private List<Logo> DefaultLogoList;
private List<Theme> ThemeList;
private List<User> UserList;
public Database()
{
ListDefaultLogo = new List<Logo>();
ListTheme = new List<Theme>();
ListUtilisateur = new List<Utilisateur>();
public Database()
{
DefaultLogoList = new List<Logo>();
ThemeList = new List<Theme>();
UserList = new List<User>();
}
public List<Logo> GetListDefaultLogo() { return ListDefaultLogo; }
public List<Theme> GetListTheme() { return ListTheme; }
public List<Utilisateur> GetListUtilisateur() { return ListUtilisateur; }
public List<Logo> GetDefaultLogoList() { return DefaultLogoList; }
public List<Theme> GetThemeList() { return ThemeList; }
public List<User> GetUserList() { return UserList; }
/// <summary>
/// recherche un utilisateur dans la liste d'utilisateur
/// </summary>
public List<Utilisateur> RechercherUtilisateur(string name)
public List<User> SearchUser(string name)
{
List<Utilisateur> ListUserSearch = new List<Utilisateur>();
List<User> searchedUsers = new List<User>();
string search = name.ToLower();
foreach (Utilisateur user in ListUtilisateur)
foreach (User user in UserList)
{
if (user.GetPseudo().ToLower().Contains(search)) { ListUserSearch.Add(user); }
if (user.GetUsername().ToLower().Contains(search)) { searchedUsers.Add(user); }
}
return ListUserSearch;
return searchedUsers;
}
/// <summary>
/// récupérer le lien d'un logo
/// </summary>
public string GetLinkLogo(string Name)
public string GetLogoLink(string name)
{
foreach (Logo logo in ListDefaultLogo)
foreach (Logo logo in DefaultLogoList)
{
if (logo.GetNom() == Name) { return logo.GetNom(); }
}throw new Exception("no logo link find");
if (logo.GetName() == name) { return logo.GetLink(); }
}
throw new Exception("No logo link found.");
}
/// <summary>
/// récupérer un utilisateur
/// </summary>
public Utilisateur GetUtilisateur(string Name)
{
foreach(Utilisateur user in ListUtilisateur){
if(user.GetPseudo() == Name)
public User GetUser(string name)
{
foreach (User user in UserList)
{
if (user.GetUsername() == name)
{
return user;
}
}throw new Exception("no user find with this pseudo");
}
throw new Exception("No user found with this username.");
}
/// <summary>
/// comparer le mot de passe entré avec celui de l'utilisateur
/// </summary>
public bool CorrespondPassword(Utilisateur user, string Psd)
public bool ComparePassword(User user, string password)
{
if (user.GetPassword() == Psd)
{
return true;
}
else
{
return false;
}
return user.GetPassword() == password;
}
/// <summary>
/// rechercher un mail dans la liste d'utilisateur
/// </summary>
public bool TrouverMail(string mail)
public bool FindEmail(string email)
{
foreach (Utilisateur Mail in ListUtilisateur)
foreach (User user in UserList)
{
if (string.Equals(mail,Mail))
if (string.Equals(user.GetEmail(), email))
{
return true;
}
else
{
return false;
}
}
return false;
}
@ -100,137 +92,115 @@ namespace Biblioteque_de_Class
/// <summary>
/// ajouter un utilisateur dans la liste d'utilisateur
/// </summary>
public void AjouterUtilisateur(Utilisateur user)
public void AddUser(User user)
{
foreach (Utilisateur user1 in ListUtilisateur)
foreach (User existingUser in UserList)
{
if (user1.GetPseudo() == user.GetPseudo())
{
throw new Exception("Pseudo déjà utilisé");
}
else if (user1.GetMail() == user.GetMail())
if (existingUser.GetUsername() == user.GetUsername())
{
throw new Exception("Mail déjà utilisé");
throw new Exception("Username already used.");
}
else
else if (existingUser.GetEmail() == user.GetEmail())
{
ListUtilisateur.Add(user);
throw new Exception("Email already used.");
}
}
UserList.Add(user);
}
/// <summary>
/// supprimer un utilisateur dans la liste d'utilisateur
/// </summary>
public void SupUtilisateur(Utilisateur user)
public void RemoveUser(User user)
{
foreach (Utilisateur user1 in ListUtilisateur)
if (UserList.Contains(user))
{
if (user1.GetPseudo() == user.GetPseudo())
{
ListUtilisateur.Remove(user);
}
else
{
throw new Exception("Utilisateur non trouvé");
}
UserList.Remove(user);
}
else
{
throw new Exception("User not found.");
}
}
/// <summary>
/// ajouter un theme dans la liste de theme
/// </summary>
public void AjouterTheme(Theme stheme)
public void AddTheme(Theme theme)
{
List<Theme> ListTheme = GetListTheme();
foreach (Theme theme in ListTheme)
foreach (Theme existingTheme in ThemeList)
{
if (theme.GetNom() == stheme.GetNom())
{
throw new Exception("Theme déjà utilisé");
}
else
if (existingTheme.GetName() == theme.GetName())
{
ListTheme.Add(stheme);
throw new Exception("Theme already used.");
}
}
ThemeList.Add(theme);
}
/// <summary>
/// supprimer un theme dans la liste de theme
/// </summary>
public void SupTheme(Theme stheme)
public void RemoveTheme(Theme theme)
{
List<Theme> ListTheme = GetListTheme();
foreach (Theme theme in ListTheme)
if (ThemeList.Contains(theme))
{
if (theme.GetNom() == stheme.GetNom())
{
ListTheme.Remove(theme);
}
else
{
throw new Exception("Theme non trouvé");
}
ThemeList.Remove(theme);
}
else
{
throw new Exception("Theme not found.");
}
}
/// <summary>
/// récupérer un theme
/// </summary>
public Theme GetTheme(string Name)
public Theme GetTheme(string name)
{
List<Theme> ListTheme = GetListTheme();
foreach (Theme theme in ListTheme)
foreach (Theme theme in ThemeList)
{
if (theme.GetNom() == Name)
if (theme.GetName() == name)
{
return theme;
}
}
throw new Exception("no theme find with this name");
throw new Exception("No theme found with this name.");
}
/// <summary>
/// modifier le nom d'un theme
/// </summary>
public void ModifierNomTheme( Theme stheme, string NewName)
public void ModifyThemeName(Theme theme, string newName)
{
foreach (Theme theme1 in ListTheme)
foreach (Theme existingTheme in ThemeList)
{
if (theme1.GetNom() == stheme.GetNom())
{
theme1.SetNom(NewName);
}
else
if (existingTheme.GetName() == theme.GetName())
{
throw new Exception("Theme non trouvé");
existingTheme.SetName(newName);
return;
}
}
throw new Exception("Theme not found.");
}
/// <summary>
/// modifier la liste de couleur d'un theme
/// </summary>
public void ModifierColorListTheme(Theme stheme, List<string> NewColorList)
public void ModifyThemeColorList(Theme theme, List<string> newColorList)
{
foreach (Theme theme1 in ListTheme)
foreach (Theme existingTheme in ThemeList)
{
if (theme1.GetNom() == stheme.GetNom())
if (existingTheme.GetName() == theme.GetName())
{
for (int i = 0; i < 3; i++)
{
theme1.ChangeColor(theme1.GetColor(i), NewColorList[i]);
existingTheme.ChangeColor(existingTheme.GetColor(i), newColorList[i]);
}
}
else
{
throw new Exception("Theme non trouvé");
return;
}
}
throw new Exception("Theme not found.");
}
}
}
}

@ -8,18 +8,18 @@ namespace Biblioteque_de_Class
{
public class Logo
{
private string Nom { get; set; }
private string LinkLogo { get; set; }
public Logo(string nom, string linklogo)
private string Name { get; set; }
private string LogoLink { get; set; }
public Logo(string name, string logoLink)
{
Nom = nom;
LinkLogo = linklogo;
Name = name;
LogoLink = logoLink;
}
public string GetNom() { return Nom; }
public string GetLinkLogo() { return LinkLogo; }
public string GetName() { return Name; }
public string GetLogoLink() { return LogoLink; }
public override string ToString() => $"logo -> nom : {Nom}\nlink : {LinkLogo}";
public override string ToString() => $"Logo -> Name: {Name}\nLink: {LogoLink}";
}
}

@ -8,130 +8,130 @@ namespace Biblioteque_de_Class
{
public class Note
{
private string Nom
private string Name
{
get { return Nom; }
set { if (value == null) { Nom = "Note sans nom"; } else { Nom = value; } }
get { return Name; }
set { if (value == null) { Name = "Unnamed Note"; } else { Name = value; } }
}
///private string Text { get; set; } Attribut pour le texte de la note
private string LogoPATH
private string LogoPath
{
get { return LogoPATH; }
set { if (value == null) { LogoPATH = "PATH TO DEFAULT LOGO"; } else { LogoPATH = value; } }
get { return LogoPath; }
set { if (value == null) { LogoPath = "PATH TO DEFAULT LOGO"; } else { LogoPath = value; } }
}
private DateOnly DateCreation { get;}
private DateOnly DateModif { get; set; }
private List<NoteImage> listeImage;
private List<String> listeLigneTexte;
private List<Utilisateur> cooperateurs;
private List<Utilisateur> editeurs;
private Utilisateur owner;
public Note(string nom, string logoPATH, Utilisateur uOwner)
private DateOnly CreationDate { get; }
private DateOnly ModificationDate { get; set; }
private List<NoteImage> ImageList;
private List<string> TextLineList;
private List<User> Collaborators;
private List<User> Editors;
private User Owner;
public Note(string name, string logoPath, User owner)
{
Nom = nom;
LogoPATH = logoPATH;
DateCreation = DateOnly.FromDateTime(DateTime.Now);
DateModif = DateOnly.FromDateTime(DateTime.Now);
listeImage = new List<NoteImage>();
listeLigneTexte = new List<String>();
cooperateurs = new List<Utilisateur>();
editeurs = new List<Utilisateur>();
owner = uOwner;
Name = name;
LogoPath = logoPath;
CreationDate = DateOnly.FromDateTime(DateTime.Now);
ModificationDate = DateOnly.FromDateTime(DateTime.Now);
ImageList = new List<NoteImage>();
TextLineList = new List<string>();
Collaborators = new List<User>();
Editors = new List<User>();
Owner = owner;
}
public string GetNom() { return Nom; }
public string GetLogoPATH() { return LogoPATH; }
public DateOnly GetDateCreation() { return DateCreation; }
public DateOnly GetDateModif() { return DateModif; }
public List<NoteImage> GetListeImage() { return listeImage; }
public List<string> GetListeLigneTexte() { return listeLigneTexte; }
public List<Utilisateur> GetCooperateurs() { return cooperateurs; }
public List<Utilisateur> GetEditeurs() { return editeurs; }
public Utilisateur GetOwner() { return owner; }
public string GetName() { return Name; }
public string GetLogoPath() { return LogoPath; }
public DateOnly GetCreationDate() { return CreationDate; }
public DateOnly GetModificationDate() { return ModificationDate; }
public List<NoteImage> GetImageList() { return ImageList; }
public List<string> GetTextLineList() { return TextLineList; }
public List<User> GetCollaborators() { return Collaborators; }
public List<User> GetEditors() { return Editors; }
public User GetOwner() { return Owner; }
public override string ToString() => $"note -> nom : {Nom}\nlogoPATH : {LogoPATH}\nhow many line : {listeLigneTexte.Count()}";
public override string ToString() => $"Note -> Name: {Name}\nLogoPath: {LogoPath}\nNumber of lines: {TextLineList.Count()}";
public void ModifNom(string nom) { Nom = nom; }
public void ModifLogoPATH(string logoPATH) { LogoPATH = logoPATH; }
public void ModifDateModif() { DateModif = DateOnly.FromDateTime(DateTime.Now); }
public void ModifyName(string name) { Name = name; }
public void ModifyLogoPath(string logoPath) { LogoPath = logoPath; }
public void ModifyModificationDate() { ModificationDate = DateOnly.FromDateTime(DateTime.Now); }
/// <summary>
/// vérifier si l'utilisateur est le propriétaire de la note
/// </summary>
public bool VerifOwner(Utilisateur user)
public bool VerifyOwner(User user)
{
if (user == owner) { return true; }
else { return false; }
return user == Owner;
}
public void AjouterImage(string linkImage, string position)
public void AddImage(string imageLink, string position)
{
foreach (NoteImage image in this.GetListeImage())
foreach (NoteImage image in ImageList)
{
if (image.GetLinkImage() == linkImage)
if (image.GetImageLink() == imageLink)
{
/// Do something
}
}
}
public void SuppImage(string image)
public void RemoveImage(string image)
{
/// il faut une nouvelle structure pour pouvoir stocker les images
/// Need a new data structure to store images
}
/// <summary>
/// vérifier si l'utilisateur est un éditeur de la note
/// </summary>
public bool VerifPriviledge(Utilisateur user)
public bool VerifyPrivilege(User user)
{
if (editeurs.Contains(user))
if (Editors.Contains(user))
{
return true;
}
else
{
throw new Exception("user is not editeur");
throw new Exception("User is not an editor");
}
}
/// <summary>
/// ajouter un utilisateur en tant que coopérateur
/// </summary>
public void AjouterCoop(Utilisateur owner, Utilisateur user)
public void AddCollaborator(User owner, User user)
{
if (VerifOwner(owner)) { cooperateurs.Add(user); }
else { throw new Exception("user is not owner"); }
if (VerifyOwner(owner)) { Collaborators.Add(user); }
else { throw new Exception("User is not the owner"); }
}
/// <summary>
/// supprimer un utilisateur en tant que coopérateur
/// </summary>
public void SupCoop(Utilisateur owner, Utilisateur user)
public void RemoveCollaborator(User owner, User user)
{
if (VerifOwner(owner)) { cooperateurs.Remove(user); }
else { throw new Exception("user is not owner"); }
if (VerifyOwner(owner)) { Collaborators.Remove(user); }
else { throw new Exception("User is not the owner"); }
}
/// <summary>
/// passer un coopérateur en tant qu'éditeur
/// </summary>
public void AjouterEdit(Utilisateur owner, Utilisateur user)
public void AddEditor(User owner, User user)
{
if (VerifOwner(owner)) { editeurs.Add(user); }
else { throw new Exception("user is not owner"); }
if (VerifyOwner(owner)) { Editors.Add(user); }
else { throw new Exception("User is not the owner"); }
}
/// <summary>
/// supprimer un coopérateur de la liste des éditeurs
/// </summary>
public void SupEdit(Utilisateur owner, Utilisateur user)
public void RemoveEditor(User owner, User user)
{
if (VerifOwner(owner)) { editeurs.Remove(user); }
else { throw new Exception("user is not owner"); }
if (VerifyOwner(owner)) { Editors.Remove(user); }
else { throw new Exception("User is not the owner"); }
}
}
}

@ -8,22 +8,21 @@ namespace Biblioteque_de_Class
{
public class NoteImage
{
private string Nom { get; set; }
private string LinkImage { get; set; }
private string Name { get; set; }
private string ImageLink { get; set; }
private string Position { get; set; }
public NoteImage(string nom, string linkimage, string position)
public NoteImage(string name, string imageLink, string position)
{
Nom = nom;
LinkImage = linkimage;
Name = name;
ImageLink = imageLink;
Position = position;
}
public string GetNom() { return Nom; }
public string GetLinkImage() { return LinkImage; }
public string GetName() { return Name; }
public string GetImageLink() { return ImageLink; }
public string GetPosition() { return Position; }
public override string ToString() => $"image -> nom : {Nom}\nlink : {LinkImage}";
public override string ToString() => $"image -> name: {Name}\nlink: {ImageLink}";
}
}

@ -8,19 +8,18 @@ namespace Biblioteque_de_Class
{
public class Tags
{
private string Nom { get; set; }
private string Couleur { get; set; }
public Tags(string nom, string couleur)
private string Name { get; set; }
private string Color { get; set; }
public Tags(string name, string color)
{
Nom = nom;
Couleur = couleur;
Name = name;
Color = color;
}
public string GetNom() { return Nom; }
public string GetCouleur() { return Couleur; }
public string GetName() { return Name; }
public string GetColor() { return Color; }
public override string ToString() => $"tag -> nom : {Nom}\ncouleur : {Couleur}";
public override string ToString() => $"tag -> name: {Name}\ncolor: {Color}";
}
}

@ -8,32 +8,32 @@ namespace Biblioteque_de_Class
{
public class Theme
{
private string Nom { get; set; }
private List<string> ListCouleur;
private string Name { get; set; }
private List<string> ColorList;
public Theme(string nom, List<string> listCouleur)
public Theme(string name, List<string> colorList)
{
Nom = nom;
ListCouleur = listCouleur;
Name = name;
ColorList = colorList;
}
public string GetNom() { return Nom; }
public void SetNom(string nom) { Nom = nom; }
public List<string> GetColorList() { return ListCouleur; }
public string GetColor(int code) { return ListCouleur[code]; }
public string GetName() { return Name; }
public void SetName(string name) { Name = name; }
public List<string> GetColorList() { return ColorList; }
public string GetColor(int index) { return ColorList[index]; }
public override string ToString() => $"nom : {Nom} color 1: {ListCouleur[0]}\ncolor 2: {ListCouleur[1]}\ncolor 3: {ListCouleur[2]}\n";
public override string ToString() => $"name: {Name}\ncolor 1: {ColorList[0]}\ncolor 2: {ColorList[1]}\ncolor 3: {ColorList[2]}\n";
/// <summary>
/// changer la couleur spécifique d'un theme
/// Change a specific color of the theme.
/// </summary>
public void ChangeColor(string color, string newColor)
{
for (int i = 0; i < ListCouleur.Count; i++)
for (int i = 0; i < ColorList.Count; i++)
{
if (ListCouleur[i] == color)
if (ColorList[i] == color)
{
ListCouleur[i] = newColor;
ColorList[i] = newColor;
}
}
}

@ -0,0 +1,230 @@
using Microsoft.VisualBasic.FileIO;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace Biblioteque_de_Class
{
public class User
{
private string Username { get; set; }
private string Email { get; set; }
private string Password { get; set; }
private List<Note> NoteList;
private List<Tags> TagList;
private List<Note> FavList;
private bool IsConnected { get; set; }
private Dictionary<Note, List<Tags>> NoteTagged;
public User(string username, string email, string password)
{
Username = username;
Email = email;
Password = password;
NoteList = new List<Note>();
TagList = new List<Tags>();
FavList = new List<Note>();
NoteTagged = new Dictionary<Note, List<Tags>>();
}
public string GetUsername() { return Username; }
public string GetEmail() { return Email; }
public string GetPassword() { return Password; }
public List<Note> GetNoteList() { return NoteList; }
public List<Tags> GetTagList() { return TagList; }
public List<Note> GetFavList() { return FavList; }
public bool GetIsConnected() { return IsConnected; }
public Dictionary<Note, List<Tags>> GetNoteTagged() { return NoteTagged; }
public override string ToString() => $"username: {Username}\nemail: {Email}\npassword: {Password}\nOwned notes: {NoteList.Count}";
/// <summary>
/// rechercher une note dans la liste de note de l'utilisateur
/// </summary>
public List<Note> SearchNoteByName(string name)
{
List<Note> searchedNotes = new List<Note>();
string search = name.ToLower();
foreach (Note note in NoteList)
{
if (note.GetName().ToLower().Contains(search))
{
searchedNotes.Add(note);
}
}
return searchedNotes;
}
/// <summary>
/// rechercher une note dans la liste de note favoris de l'utilisateur
/// </summary>
public List<Note> SearchFavoriteNoteByName(string name)
{
List<Note> searchedNotes = new List<Note>();
string search = name.ToLower();
foreach (Note note in FavList)
{
if (note.GetName().ToLower().Contains(search))
{
searchedNotes.Add(note);
}
}
return searchedNotes;
}
/// <summary>
/// rechercher un tag dans la liste de tag de l'utilisateur
/// </summary>
public List<Tags> SearchTagByName(string name)
{
List<Tags> searchedTags = new List<Tags>();
string search = name.ToLower();
foreach (Tags tag in TagList)
{
if (tag.GetName().ToLower().Contains(search))
{
searchedTags.Add(tag);
}
}
return searchedTags;
}
/// <summary>
/// ajouter une note dans la liste de note favorite de l'utilisateur
/// </summary>
public void AddFavorite(Note note)
{
if (FavList.Contains(note))
{
throw new Exception("Note already in favorites");
}
FavList.Add(note);
}
/// <summary>
/// supprimer une note dans la liste de note favorite de l'utilisateur
/// </summary>
public void RemoveFavorite(Note note)
{
if (FavList.Contains(note))
{
FavList.Remove(note);
}
else
{
throw new Exception("Note not found");
}
}
/// <summary>
///creer une note
/// </summary>
public void CreateNote(string name, string imagePath)
{
foreach (Note existingNote in NoteList)
{
if (existingNote.GetName() == name)
{
throw new Exception("Note already exists");
}
}
Note note = new Note(name, imagePath, this);
NoteList.Add(note);
NoteTagged.Add(note, new List<Tags>());
}
/// <summary>
/// supprimer une note
/// </summary>
public void DeleteNote(Note note)
{
if (NoteList.Contains(note))
{
NoteList.Remove(note);
NoteTagged.Remove(note);
}
else
{
throw new Exception("Note not found");
}
}
/// <summary>
/// creer un tag
/// </summary>
public void CreateTag(string name, string color)
{
foreach (Tags tag in TagList)
{
if (tag.GetName() == name)
{
throw new Exception("Tag already exists");
}
}
TagList.Add(new Tags(name, color));
}
/// <summary>
/// supprimer un tag
/// </summary>
public void DeleteTag(string name)
{
foreach (Tags tag in TagList)
{
if (tag.GetName() == name)
{
TagList.Remove(tag);
return;
}
}
}
/// <summary>
/// ajouter un tag a une note
/// </summary>
public void AddTagToNoteList(Note note, Tags tagToAdd)
{
if (!TagList.Contains(tagToAdd))
{
throw new Exception("Tag not found");
}
if (!NoteList.Contains(note))
{
throw new Exception("Note not found");
}
NoteTagged[note].Add(tagToAdd);
}
/// <summary>
/// supprimer un tag a une note
/// </summary>
public void RemoveTagFromNoteList(Note note, Tags tagToRemove)
{
if (!TagList.Contains(tagToRemove))
{
throw new Exception("Tag not found");
}
if (!NoteList.Contains(note))
{
throw new Exception("Note not found");
}
NoteTagged[note].Remove(tagToRemove);
}
/// <summary>
/// ajouter plusieur tag a une note
/// </summary>
public void AddTagsToNoteList(Note note, List<Tags> tags)
{
NoteTagged.Add(note, tags);
}
/// <summary>
///supprimer tout les tags d'une note
/// </summary>
public void RemoveTagsFromNoteList(Note note)
{
NoteTagged.Remove(note);
}
}
}

@ -1,202 +0,0 @@
using Microsoft.VisualBasic.FileIO;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace Biblioteque_de_Class
{
public class Utilisateur
{
private string Pseudo { get; set; }
private string Mail { get; set; }
private string Password { get; set; }
private List<Note> NoteList;
private List<Tags> TagList;
private List<Note> FavList;
private bool connecte { get; set; }
private Dictionary<Note, List<Tags>> NoteTaged;
public Utilisateur(string Upseudo, string Umail, string Upassword)
{
Pseudo = Upseudo;
Mail = Umail;
Password = Upassword;
NoteList = new List<Note>();
TagList = new List<Tags>();
FavList = new List<Note>();
NoteTaged = new Dictionary<Note, List<Tags>>();
}
public string GetPseudo() { return Pseudo; }
public string GetMail() { return Mail; }
public string GetPassword() { return Password; }
public List<Note> GetNoteList() { return NoteList; }
public List<Tags> GetTagList() { return TagList; }
public List<Note> GetFavList() { return FavList; }
public bool GetConnecte() { return connecte; }
public Dictionary<Note, List<Tags>> GetNoteTaged() { return NoteTaged; }
public override string ToString() => $"pseudo : {Pseudo}\nmail : {Mail}\npassword : {Password}\nNote possédé : {NoteList.Count}";
/// <summary>
/// rechercher une note dans la liste de note de l'utilisateur
/// </summary>
public List<Note> RechercherNote(string name)
{
List<Note> ListNotesearch = new List<Note>();
string search = name.ToLower();
foreach(Note note in NoteList){
if(note.GetNom().ToLower().Contains(search)) { ListNotesearch.Add(note); }
}return ListNotesearch;
}
/// <summary>
/// rechercher une note dans la liste de note favoris de l'utilisateur
/// </summary>
public List<Note> RechercherNoteFav(string name)
{
List<Note> ListNotesearch = new List<Note>();
string search = name.ToLower();
foreach(Note note in FavList){
if(note.GetNom().ToLower().Contains(search)) { ListNotesearch.Add(note); }
}return ListNotesearch;
}
/// <summary>
/// rechercher un tag dans la liste de tag de l'utilisateur
/// </summary>
public List<Tags> RechercherTags(string name)
{
List<Tags> ListTagssearch = new List<Tags>();
string search = name.ToLower();
foreach(Tags tag in TagList){
if(tag.GetNom().ToLower().Contains(search)) { ListTagssearch.Add(tag); }
}
return ListTagssearch;
}
/// <summary>
/// ajouter une note dans la liste de note favorite de l'utilisateur
/// </summary>
public void AddFav(Note note)
{
foreach(Note notefav in FavList)
{
if (notefav.Equals(note))
{
throw new Exception("Note already in favorite");
}
}
FavList.Add(note);
}
/// <summary>
/// supprimer une note dans la liste de note favorite de l'utilisateur
/// </summary>
public void SupFav(Note note)
{
foreach(Note notefav in FavList)
{
if (notefav.Equals(note))
{
FavList.Remove(note);
}
}
throw new Exception("Note not found");
}
/// <summary>
///creer une note
/// </summary>
public void CreateNote(string nom, string LogoPath)
{
foreach (Note eachnote in NoteList)
{
if (eachnote.GetNom() == nom)
{
throw new Exception("Note already exist");
}
}
Note note = new Note(nom, LogoPath,this);
NoteList.Add(note);
NoteTaged.Add(note, new List<Tags>());
}
/// <summary>
/// supprimer une note
/// </summary>
public void DeleteNote(Note note)
{
if (NoteList.Contains(note))
{
NoteList.Remove(note);
NoteTaged.Remove(note);
}
else
throw new Exception("Note not found");
}
/// <summary>
/// creer un tag
/// </summary>
public void CreateTag(string name, string color)
{
foreach(Tags tag in TagList){
if(tag.GetNom() == name) { throw new Exception("Tag already exist"); }
}
TagList.Add(new Tags(name, color));
}
/// <summary>
/// supprimer un tag
/// </summary>
public void DeleteTag(string name)
{
foreach(Tags tag in TagList){
if(tag.GetNom() == name) { TagList.Remove(tag); }
}
}
/// <summary>
/// ajouter un tag a une note
/// </summary>
public void AddOneTagToNoteList(Note note, Tags tagtoadd)
{
if (TagList.Contains(tagtoadd) == false) { throw new Exception("Tag not found"); }
if(NoteList.Contains(note) == false) { throw new Exception("Note not found"); }
else
{
NoteTaged[note].Add(tagtoadd);
}
}
/// <summary>
/// supprimer un tag a une note
/// </summary>
public void SupOneTagToNoteList(Note note, Tags tagtosup)
{
if (TagList.Contains(tagtosup) == false) { throw new Exception("Tag not found"); }
if(NoteList.Contains(note) == false) { throw new Exception("Note not found"); }
else
{
NoteTaged[note].Remove(tagtosup);
}
}
/// <summary>
/// ajouter plusieur tag a une note
/// </summary>
public void AddTagToNoteList(Note note, List<Tags> listTags)
{
NoteTaged.Add(note, listTags);
}
/// <summary>
///supprimer tout les tags d'une note
/// </summary>
public void SupTagToNoteList(Note note)
{
NoteTaged.Remove(note);
}
}
}

@ -25,10 +25,10 @@ string linkimage = "u";
List <string> NewColorList;
List <string> listCouleurs;
Utilisateur user = new Utilisateur(Upseudo, Umail, Upassword);
User user = new User(Upseudo, Umail, Upassword);
NoteImage image = new NoteImage(nom2, linkimage, position);
Database db= new Database();
Utilisateur u = new Utilisateur(Upseudo, Umail, Upassword);
User u = new User(Upseudo, Umail, Upassword);
Note n = new Note(nom, logoPath, u);
Tags t = new Tags(name, couleur);
@ -100,7 +100,7 @@ while (boucle == 0){
Umail = Console.ReadLine();
Console.WriteLine("Saisissez un mot de passe");
Upassword = Console.ReadLine();
Utilisateur u1 = new Utilisateur(Upseudo, Umail, Upassword);
User u1 = new User(Upseudo, Umail, Upassword);
db.AjouterUtilisateur(u1);
break;

Loading…
Cancel
Save