|
|
|
@ -13,7 +13,7 @@ namespace Biblioteque_de_Class
|
|
|
|
|
private List<Tags> TagList;
|
|
|
|
|
private List<Note> FavList;
|
|
|
|
|
private bool connecte { get; set; }
|
|
|
|
|
private Map<Note, List<Tags>> NoteTaged;
|
|
|
|
|
private Dictionary<Note, List<Tags>> NoteTaged;
|
|
|
|
|
|
|
|
|
|
public Utilisateur(string Upseudo, string Umail, string Upassword)
|
|
|
|
|
{
|
|
|
|
@ -30,9 +30,9 @@ namespace Biblioteque_de_Class
|
|
|
|
|
public List<Tags> GetTagList() { return TagList; }
|
|
|
|
|
public List<Note> GetFavList() { return FavList; }
|
|
|
|
|
public bool GetConnecte() { return connecte; }
|
|
|
|
|
public Map<Note, List<Tags>> GetNoteTaged() { return NoteTaged; }
|
|
|
|
|
public Dictionary<Note, List<Tags>> GetNoteTaged() { return NoteTaged; }
|
|
|
|
|
|
|
|
|
|
public override string ToString() => $"pseudo : {Pseudo}\nmail : {Mail}\npassword : {Mdp}\nNote possédé : {NoteList.Count}";
|
|
|
|
|
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
|
|
|
|
@ -40,9 +40,9 @@ namespace Biblioteque_de_Class
|
|
|
|
|
public List<Note> RechercherNote(string name)
|
|
|
|
|
{
|
|
|
|
|
List<Note> ListNotesearch = new List<Note>();
|
|
|
|
|
string search = name.Tolower();
|
|
|
|
|
string search = name.ToLower();
|
|
|
|
|
foreach(Note note in NoteList){
|
|
|
|
|
if(note.Nom.Tolower().Contains(search)) { ListNotesearch.Add(note.Nom); }
|
|
|
|
|
if(note.GetNom().ToLower().Contains(search)) { ListNotesearch.Add(note); }
|
|
|
|
|
}return ListNotesearch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -52,22 +52,23 @@ namespace Biblioteque_de_Class
|
|
|
|
|
public List<Note> RechercherNoteFav(string name)
|
|
|
|
|
{
|
|
|
|
|
List<Note> ListNotesearch = new List<Note>();
|
|
|
|
|
string search = name.Tolower();
|
|
|
|
|
string search = name.ToLower();
|
|
|
|
|
foreach(Note note in FavList){
|
|
|
|
|
if(note.Nom.Tolower().Contains(search)) { ListNotesearch.Add(note.Nom); }
|
|
|
|
|
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 Tags RechercherTags(string name)
|
|
|
|
|
public List<Tags> RechercherTags(string name)
|
|
|
|
|
{
|
|
|
|
|
List<Tags> ListTagssearch = new List<Tags>();
|
|
|
|
|
string search = name.Tolower();
|
|
|
|
|
string search = name.ToLower();
|
|
|
|
|
foreach(Tags tag in TagList){
|
|
|
|
|
if(tag.Nom.Tolower().Contains(search)) { ListTagssearch.Add(tag.Nom); }
|
|
|
|
|
}return ListTagssearch;
|
|
|
|
|
if(tag.GetNom().ToLower().Contains(search)) { ListTagssearch.Add(tag); }
|
|
|
|
|
}
|
|
|
|
|
return ListTagssearch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -105,9 +106,11 @@ namespace Biblioteque_de_Class
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void CreateNote(string nom, string LogoPath)
|
|
|
|
|
{
|
|
|
|
|
List<Note> NoteList = this.GetNoteList();
|
|
|
|
|
Dictionary<Note, List<Tags>> NoteTaged = this.GetNoteTaged();
|
|
|
|
|
foreach (Note note in NoteList)
|
|
|
|
|
{
|
|
|
|
|
if (note.Nom == nom)
|
|
|
|
|
if (note.GetNom() == nom)
|
|
|
|
|
{
|
|
|
|
|
throw new Exception("Note already exist");
|
|
|
|
|
}
|
|
|
|
@ -137,7 +140,7 @@ namespace Biblioteque_de_Class
|
|
|
|
|
public void CreateTag(string name, string color)
|
|
|
|
|
{
|
|
|
|
|
foreach(Tags tag in TagList){
|
|
|
|
|
if(tag.Nom == name) { throw new Exception("Tag already exist"); }
|
|
|
|
|
if(tag.GetNom() == name) { throw new Exception("Tag already exist"); }
|
|
|
|
|
}
|
|
|
|
|
TagList.Add(new Tags(name, color));
|
|
|
|
|
}
|
|
|
|
@ -148,7 +151,7 @@ namespace Biblioteque_de_Class
|
|
|
|
|
public void DeleteTag(string name)
|
|
|
|
|
{
|
|
|
|
|
foreach(Tags tag in TagList){
|
|
|
|
|
if(tag.Nom == name) { TagList.Remove(tag); }
|
|
|
|
|
if(tag.GetNom() == name) { TagList.Remove(tag); }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -157,7 +160,8 @@ namespace Biblioteque_de_Class
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void AddOneTagToNoteList(Note note, Tags tagtoadd)
|
|
|
|
|
{
|
|
|
|
|
if(ListTags.Contains(tagtoadd) == false) { throw new Exception("Tag not found"); }
|
|
|
|
|
List<Tags> ListTags = this.GetTagList();
|
|
|
|
|
if (ListTags.Contains(tagtoadd) == false) { throw new Exception("Tag not found"); }
|
|
|
|
|
if(NoteList.Contains(note) == false) { throw new Exception("Note not found"); }
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -170,7 +174,8 @@ namespace Biblioteque_de_Class
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void SupOneTagToNoteList(Note note, Tags tagtosup)
|
|
|
|
|
{
|
|
|
|
|
if(ListTags.Contains(tagtosup) == false) { throw new Exception("Tag not found"); }
|
|
|
|
|
List<Tags> ListTags = this.GetTagList();
|
|
|
|
|
if (ListTags.Contains(tagtosup) == false) { throw new Exception("Tag not found"); }
|
|
|
|
|
if(NoteList.Contains(note) == false) { throw new Exception("Note not found"); }
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|