From 6536bef530d469112c3386d54ba42c335987900c Mon Sep 17 00:00:00 2001 From: "matheo.thierry" Date: Fri, 5 May 2023 20:11:10 +0200 Subject: [PATCH] MODIF et ajout d'une part des fonctions --- notus/Biblioteque_de_Class/Logo.cs | 8 ++++ notus/Biblioteque_de_Class/Note.cs | 58 ++++++++++++++--------------- notus/Biblioteque_de_Class/Tags.cs | 13 +------ notus/Biblioteque_de_Class/Theme.cs | 6 +-- 4 files changed, 40 insertions(+), 45 deletions(-) diff --git a/notus/Biblioteque_de_Class/Logo.cs b/notus/Biblioteque_de_Class/Logo.cs index 4488779..c666ea5 100644 --- a/notus/Biblioteque_de_Class/Logo.cs +++ b/notus/Biblioteque_de_Class/Logo.cs @@ -10,5 +10,13 @@ namespace Biblioteque_de_Class { public string Nom { get; set; } public string LinkLogo { get; set; } + + public Logo(string nom, string linklogo) + { + Nom = nom; + LinkLogo = linklogo; + } + + public override string ToString() => $"logo -> nom : {Nom}\nlink : {LinkLogo}"; } } diff --git a/notus/Biblioteque_de_Class/Note.cs b/notus/Biblioteque_de_Class/Note.cs index eabda95..8bda883 100644 --- a/notus/Biblioteque_de_Class/Note.cs +++ b/notus/Biblioteque_de_Class/Note.cs @@ -34,47 +34,47 @@ namespace Biblioteque_de_Class owner = uOwner; } -/// public Note RechercherNote(List listeNote, string nom) -/// { -/// List newListNote = new List(); -/// foreach (Note note in listeNote) -/// { -/// if (note.Nom == nom) -/// { -/// -/// } -/// } -/// return newListNote; -/// } - public override string ToString() => $"note -> nom : {Nom}\nlogoPATH : {LogoPATH}\nhow many line : {listeLigneTexte.Count()}"; public void AjouterTag(List listNote, string name) { - foreach(Tags tag in listNote) - { - if(tag.Nom == name) - { - atributionTag.Add(tag); - } + foreach(Tags tag in listNote){ + if(tag.Nom == name) { atributionTag.Add(tag); } } throw new Exception("no tag find with this name"); } - public void SupTag(string name) - { - foreach(Tags tag in atributionTag) - { - if(tag.Nom == name) - { - atributionTag.Remove(tag); - } + public void SupTag(string name){ + foreach(Tags tag in atributionTag){ + if(tag.Nom == name) { atributionTag.Remove(tag); } } throw new Exception("no tag find with this name"); } public bool VerifOwner(Utilisateur user) { - - return ; + if (user == owner) { return true; } + else { return false; } + } + + public void AjouterCoop(Utilisateur user) { + if (VerifOwner(user)) { cooperateurs.Add(user); } + else { throw new Exception("user is not owner"); } + } + + public void SupCoop(Utilisateur user) { + if (VerifOwner(user)) { cooperateurs.Remove(user); } + else { throw new Exception("user is not owner"); } } + + public void AjouterEdit(Utilisateur user) { + if (VerifOwner(user)) { editeurs.Add(user); } + else { throw new Exception("user is not owner"); } + } + + public void SupEdit(Utilisateur user) { + if (VerifOwner(user)) { editeurs.Remove(user); } + else { throw new Exception("user is not owner"); } + } + + } } diff --git a/notus/Biblioteque_de_Class/Tags.cs b/notus/Biblioteque_de_Class/Tags.cs index 4cd45e8..874d43a 100644 --- a/notus/Biblioteque_de_Class/Tags.cs +++ b/notus/Biblioteque_de_Class/Tags.cs @@ -25,17 +25,6 @@ namespace Biblioteque_de_Class Couleur = couleur; } - ///public Tags? RechercherTags(List listtags,string rechercher) - ///{ - /// foreach (Tags tag in listtags) - /// { - /// if (tag.Nom == Nom) - /// { - /// return tag; - /// } - /// } - /// return null; - ///} - + public override string ToString() => $"tag -> nom : {Nom}\ncouleur : {Couleur}"; } } diff --git a/notus/Biblioteque_de_Class/Theme.cs b/notus/Biblioteque_de_Class/Theme.cs index 03af24c..04751c0 100644 --- a/notus/Biblioteque_de_Class/Theme.cs +++ b/notus/Biblioteque_de_Class/Theme.cs @@ -17,6 +17,8 @@ namespace Biblioteque_de_Class ListCouleur = listCouleur; } + public override string ToString() => $"nom : {Nom}\n"; + public List GetColorList() { return ListCouleur; @@ -32,10 +34,6 @@ namespace Biblioteque_de_Class ListCouleur[longueur] = newColor; } } - } - - public override string ToString() => $"nom : {Nom}\n"; - } }