ADD and MODIF rajout de possiblement tout les méthodes et modif des noms et contenu de méthode

vSonar_test
Matheo THIERRY 2 years ago
parent a69e678340
commit 8a533beec2

File diff suppressed because it is too large Load Diff

@ -32,7 +32,7 @@ namespace Biblioteque_de_Class
return ListUserSearch;
}
public string? GetLinkLogo(string Name)
public string GetLinkLogo(string Name)
{
foreach (Logo logo in ListDefaultLogo)
{
@ -40,9 +40,10 @@ namespace Biblioteque_de_Class
}throw new Exception("no logo link find");
}
public Utilisateur GetUtilisateur(string Name) {
public Utilisateur GetUtilisateur(string Name)
{
foreach(Utilisateur user in ListUtilisateur){
if(user.Pseudo.get == Name)
if(user.Pseudo == Name)
{
return user;
}
@ -51,9 +52,9 @@ namespace Biblioteque_de_Class
public bool CorrespondPassword(string Psd)
{
foreach (Utilisateur Mdp in ListUtilisateur)
foreach (Utilisateur user in ListUtilisateur)
{
if (string.Equals(Psd, Mdp))
if (string.Equals(Psd, user.Password))
{
return true;
}
@ -80,5 +81,112 @@ namespace Biblioteque_de_Class
}
return false;
}
public void AjouterUtilisateur(Utilisateur user)
{
foreach (Utilisateur user1 in ListUtilisateur)
{
if (user1.Pseudo == user.Pseudo)
{
throw new Exception("Pseudo déjà utilisé");
}
else if (user1.Mail == user.Mail)
{
throw new Exception("Mail déjà utilisé");
}
else
{
ListUtilisateur.Add(user);
}
}
}
public void SupUtilisateur(Utilisateur user)
{
foreach (Utilisateur user1 in ListUtilisateur)
{
if (user1.Pseudo == user.Pseudo)
{
ListUtilisateur.Remove(user);
}
else
{
throw new Exception("Utilisateur non trouvé");
}
}
}
public void AjouterTheme(Theme stheme)
{
foreach (Theme theme in ListTheme)
{
if (theme.Nom == stheme.Nom)
{
throw new Exception("Theme déjà utilisé");
}
else
{
ListTheme.Add(stheme);
}
}
}
public void SupTheme(Theme stheme)
{
foreach (Theme theme in ListTheme)
{
if (theme.Nom == stheme.Nom)
{
ListTheme.Remove(theme);
}
else
{
throw new Exception("Theme non trouvé");
}
}
}
public Theme GetTheme(string Name)
{
foreach (Theme theme in ListTheme)
{
if (theme.Nom == Name)
{
return theme;
}
}
throw new Exception("no theme find with this name");
}
public void ModifierNomTheme( Theme stheme, string NewName)
{
foreach (Theme theme1 in ListTheme)
{
if (theme1.Nom == stheme.Nom)
{
theme1.Nom = NewName;
}
else
{
throw new Exception("Theme non trouvé");
}
}
}
public void ModifierColorListTheme(Theme stheme, List<string> NewColorList)
{
foreach (Theme theme1 in ListTheme)
{
if (theme1.Nom == stheme.Nom)
{
theme1.ListCouleur = NewColorList;
}
else
{
throw new Exception("Theme non trouvé");
}
}
}
}
}

@ -21,8 +21,7 @@ namespace Biblioteque_de_Class
set { if (value == null) { LogoPATH = "PATH TO DEFAULT LOGO"; } else { LogoPATH = value; } }
}
private DateOnly DateCreation { get;}
public List<Tags> atributionTag;
private DateOnly DateModif { get; set; }
public List<String> listeImage;
public List<String> listeLigneTexte;
public List<String> listePosiImage;
@ -35,96 +34,65 @@ namespace Biblioteque_de_Class
Nom = nom;
LogoPATH = logoPATH;
DateCreation = DateOnly.FromDateTime(DateTime.Now);
DateModif = DateOnly.FromDateTime(DateTime.Now);
owner = uOwner;
}
public override string ToString() => $"note -> nom : {Nom}\nlogoPATH : {LogoPATH}\nhow many line : {listeLigneTexte.Count()}";
public void AjouterTag(List<Tags> listNote, string name) {
foreach(Tags tag in listNote){
if(tag.Nom == name) { atributionTag.Add(tag); }
}
throw new Exception("no tag find with this name");
}
public void EnleverTag(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) {
public bool VerifOwner(Utilisateur user)
{
if (user == owner) { return true; }
else { return false; }
}
public bool ModifRole(Utilisateur user,int choix)
{
if (editeurs.Contains(user))
{
editeurs.Remove(user);
cooperateurs.Add(user);
return true;
}
if (cooperateurs.Contains(user) && choix==1)
{
cooperateurs.Remove(user);
editeurs.Add(user);
return true;
}
else
{
cooperateurs.Remove(user);
}
return false;
}
public bool AjouterImage(string image)
public void AjouterImage(string image)
{
if (listeImage.Contains(image))
{
return false;
}
else
{
return true;
}
}
public bool SuppImage(string image)
public void SuppImage(string image)
{
}
public bool VerifPriviledge(Utilisateur user)
{
if (listeImage.Contains(image))
if (editeurs.Contains(user))
{
listeImage.Remove(image);
return true;
return True;
}
else
else
{
return false;
throw new Exception("user is not editeur");
}
}
public void AjouterCoop(Utilisateur user) {
if (VerifOwner(user)) { cooperateurs.Add(user); }
public void AjouterCoop(Utilisateur owner, Utilisateur user)
{
if (VerifOwner(owner)) { cooperateurs.Add(user); }
else { throw new Exception("user is not owner"); }
}
public void SupCoop(Utilisateur user) {
if (VerifOwner(user)) { cooperateurs.Remove(user); }
public void SupCoop(Utilisateur owner, Utilisateur user)
{
if (VerifOwner(owner)) { cooperateurs.Remove(user); }
else { throw new Exception("user is not owner"); }
}
public void AjouterEdit(Utilisateur user) {
if (VerifOwner(user)) { editeurs.Add(user); }
public void AjouterEdit(Utilisateur owner, Utilisateur user)
{
if (VerifOwner(owner)) { editeurs.Add(user); }
else { throw new Exception("user is not owner"); }
}
public void SupEdit(Utilisateur user) {
if (VerifOwner(user)) { editeurs.Remove(user); }
public void SupEdit(Utilisateur owner, Utilisateur user)
{
if (VerifOwner(owner)) { editeurs.Remove(user); }
else { throw new Exception("user is not owner"); }
}
}
}

@ -8,23 +8,15 @@ namespace Biblioteque_de_Class
{
public class Tags
{
public string Nom { get; set; }
public string Couleur { get; set; }
private string Nom { get; set; }
private string Couleur { get; set; }
public Tags(string nom, string couleur)
{
Nom = nom;
Couleur = couleur;
}
public void ChangerNom(string nom)
{
Nom = nom;
}
public void ChangerCouleur(string couleur)
{
Couleur = couleur;
}
public override string ToString() => $"tag -> nom : {Nom}\ncouleur : {Couleur}";
}

@ -9,27 +9,22 @@ namespace Biblioteque_de_Class
public class Theme
{
public string Nom { get; set; }
List<String> ListCouleur;
List<string> ListCouleur;
public Theme(string nom, List<String> listCouleur)
public Theme(string nom, List<string> listCouleur)
{
Nom = nom;
ListCouleur = List<String> listCouleur;
ListCouleur = List<string>({ "#red", "#blue", "#green" });
}
public override string ToString() => $"nom : {Nom} color 1: {Listcouleur[0]}\ncolor 2: {Listcouleur[1]}\ncolor 3: {Listcouleur[2]}\n";
public List<String> GetColorList()
public List<string> GetColorList()
{
return ListCouleur;
}
public void ModifListColor(List<String> listColor)
{
ListCouleur = listColor;
}
public void ChangeColor(String color, String newColor)
public void ChangeColor(string color, string newColor)
{
int longueur = 0;
for (longueur = ListCouleur.Count; longueur != 0; longueur-- )

@ -2,33 +2,31 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
///https://learn.microsoft.com/fr-fr/windows/apps/design/
///https://learn.microsoft.com/fr-fr/windows/apps/design/layout/
///https://raw.githubusercontent.com/dotnet-architecture/eBooks/main/current/maui/Enterprise-Application-Patterns-Using-.NET-MAUI.pdf
///
namespace Biblioteque_de_Class
{
public class Utilisateur
{
private string Pseudo { get; set; }
private string Mail { get; set; }
private string Mdp { get; set; }
private string Password { get; set; }
private List<Note> NoteList;
private List<Tags> TagList;
private List<Note> FavList;
private bool connecté { get; set; }
private Map<Note, List<Tags>> NoteTaged;
public Utilisateur(string Upseudo, string Umail, string Upassword)
{
Pseudo = Upseudo;
Mail = Umail;
Mdp = Upassword;
Password = Upassword;
NoteList = new List<Note>();
}
public override string ToString() => $"pseudo : {Pseudo}\nmail : {Mail}\npassword : {Mdp}\nNote possédé : {NoteList.Count}";
public List<Note> RechercherNote(string name){
public List<Note> RechercherNote(string name)
{
List<Note> ListNotesearch = new List<Note>();
string search = name.Tolower();
foreach(Note note in NoteList){
@ -36,7 +34,8 @@ namespace Biblioteque_de_Class
}return ListNotesearch;
}
public List<Note> RechercherNoteFav(string name){
public List<Note> RechercherNoteFav(string name)
{
List<Note> ListNotesearch = new List<Note>();
string search = name.Tolower();
foreach(Note note in FavList){
@ -44,7 +43,8 @@ namespace Biblioteque_de_Class
}return ListNotesearch;
}
public Tags RechercherTags(string name){
public Tags RechercherTags(string name)
{
List<Tags> ListTagssearch = new List<Tags>();
string search = name.Tolower();
foreach(Tags tag in TagList){
@ -52,65 +52,97 @@ namespace Biblioteque_de_Class
}return ListTagssearch;
}
public bool AjouterFav(List<Note> ListFav, Note note)
public void AddFav(Note note)
{
foreach(Note notefav in ListFav)
foreach(Note notefav in FavList)
{
if (!notefav.Equals(note))
if (notefav.Equals(note))
{
ListFav.Add(note);
return true;
throw new Exception("Note already in favorite");
}
}
return false;
FavList.Add(note);
}
public bool SuppFav(List<Note> ListFav, Note note)
public void SupFav(Note note)
{
foreach (Note notefav in ListFav)
foreach(Note notefav in FavList)
{
if (notefav.Nom.Equals(note))
if (notefav.Equals(note))
{
ListFav.Remove(note);
return true;
FavList.Remove(note);
}
}
return false;
throw new Exception("Note not found");
}
public void AjouterNote(string nom, string LogoPath)
public void AddNote(string nom, string LogoPath)
{
foreach (Note note in NoteList)
{
if (note.Nom == nom)
{
throw new Exception("Note already exist");
}
}
Note note = new Note(nom, LogoPath,this);
NoteList.Add(note);
NoteTaged.Add(note, new List<Tags>());
}
public void SuppNote(Note note)
public void SupNote(Note note)
{
if (NoteList.Contains(note))
NoteList.Remove(note);
NoteTaged.Remove(note);
else
throw new Exception("Note not found");
}
public void createTag(List<Tags> listNote, string name) {
foreach(Tags tag in listNote)
public void CreateTag(string name, string color)
{
foreach(Tags tag in TagList){
if(tag.Nom == name) { throw new Exception("Tag already exist"); }
}
TagList.Add(new Tags(name, color));
}
public void DeleteTag(string name)
{
foreach(Tags tag in TagList){
if(tag.Nom == name) { TagList.Remove(tag); }
}
}
public void AddOneTagToNoteList(Note note, Tags tagtoadd)
{
if(ListTags.Contains(tagtoadd) == false) { throw new Exception("Tag not found"); }
if(NoteList.Contains(note) == false) { throw new Exception("Note not found"); }
else
{
if(tag.Nom == name)
{
atributionTag.Add(tag);
}
NoteTaged[note].Add(tagtoadd);
}
throw new Exception("no tag find with this name");
}
public void deleteTag(string name)
public void SupOneTagToNoteList(Note note, Tags tagtosup)
{
foreach(Tags tag in atributionTag)
if(ListTags.Contains(tagtosup) == false) { throw new Exception("Tag not found"); }
if(NoteList.Contains(note) == false) { throw new Exception("Note not found"); }
else
{
if(tag.Nom == name)
{
atributionTag.Remove(tag);
}
NoteTaged[note].Remove(tagtosup);
}
throw new Exception("no tag find with this name");
}
public void AddTagToNoteList(Note note, List<Tags> listTags)
{
NoteTaged.Add(note, listTags);
}
public void SupTagToNoteList(Note note)
{
NoteTaged.Remove(note);
}
}
}
Loading…
Cancel
Save