/// <summary> /// Ouvre la fenêtre de personnalisation de profil /// </summary> /// <param name="obj"></param> private void OnPersoProfil(object obj) { RefreshEvent.GetInstance().Handler += OnRefresh; WindowClosedEvent.GetInstance().Handler += OnCloseWindowPersoProfil; _wPersoProfil = new WindowPersoProfil(); _wPersoProfil.ShowDialog(); }
/// <summary> /// Ouvre la fenêtre d'administration /// </summary> /// <param name="obj"></param> private void OnAdministration(object obj) { WindowClosedEvent.GetInstance().Handler += OnCloseWindowAdd; RefreshEvent.GetInstance().Handler += OnRefresh; _wAdd = new WindowAdd(); _wAdd.ShowDialog(); }
/// <summary> /// Supprime la série selectionné /// </summary> /// <param name="obj"></param> private void OnSupprmierSerie(object obj) { if (MessageBox.Show($"Voulez vous vraiment supprimer la série : {Selectseriesuppr} ?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { GestionBDD.supprSerie(Selectseriesuppr); for (int i = Listserie.Count - 1; i >= 0; i--) { if (Listserie[i].Contains(Selectseriesuppr)) { Listserie.RemoveAt(i); } } RefreshEvent.GetInstance().OnRefreshAcceuilHandler(EventArgs.Empty); chargerListSerie(); MessageBox.Show("Série supprimé"); } }
//COMMANDE AJOUT SERIE /// <summary> /// Vérifié que la durée moyenne et le nombre de saison sont bien des chiffres. Si oui la série est ajouté /// </summary> /// <param name="obj"></param> private void OnAjouterSerie(object obj) { if (GestionBDD.verifSerie(NomSerie)) { MessageBox.Show("Cette série est déjà enregistrée", "Erreur", MessageBoxButton.OK, MessageBoxImage.Warning); } else { if (int.TryParse(DureeMoyenneSerie, out _result) == true) { if (int.TryParse(NbSaison, out _res) == true) { FileInfo f = new FileInfo(_openFile.FileName); if (f.Length > 512000) { MessageBox.Show("La taille de l'image est trop grande (500 ko maximum)", "", MessageBoxButton.OK, MessageBoxImage.Warning); } else { CheckImageSerie(); CheckBanniereSerie(); GestionBDD.ajouter_Serie(NomSerie, DescriptionSerie, SelectGenre, ProducteurSerie, int.Parse(DureeMoyenneSerie), int.Parse(NbSaison), _fileName, _fileNameBanniere, int.Parse(NbEpisode)); Listserie.Add(NomSerie); chargerListSerie(); MessageBox.Show("Ajout enregistrée", "Confirmation", MessageBoxButton.OK); //Déclenchement de l'événement pour mettre à jour le viewAccueil RefreshEvent.GetInstance().OnRefreshAcceuilHandler(EventArgs.Empty); setChampNullAjouter(); } } else { MessageBox.Show("Veuillez rentrer uniquement des nombres pour le nombre de saison(s) de la serie", "Erreur", MessageBoxButton.OK, MessageBoxImage.Warning); } } else { MessageBox.Show("Veuillez rentrer uniquement des nombres pour la Durée Moyenne de la serie", "Erreur", MessageBoxButton.OK, MessageBoxImage.Warning); } } }
//COMMANDE MODIFIER SERIE /// <summary> /// Vérifie si la duree moyenne et le nombre de saison sont bien des chiffres. Si oui la série est modifié /// </summary> /// <param name="obj"></param> private void OnModifierSerie(object obj) { if (int.TryParse(Dureemoyenneseriemodif, out _result) == true) { if (int.TryParse(NbSaisonModif, out _res) == true) { if (_verif) { if (!File.Exists($@"{_path}\{_fileNameModif}")) { FileInfo f = new FileInfo(_openFileModif.FileName); if (f.Length > 512000) { MessageBox.Show("La taille de l'image est trop grande (500 ko maximum)", "", MessageBoxButton.OK, MessageBoxImage.Warning); } else { File.Copy(_openFileModif.FileName, Path.Combine(_path, _fileNameModif)); File.Copy(_openFileBanniereModif.FileName, Path.Combine(_path, _fileNameBanniereModif)); GestionBDD.updateSerie(SelectSerie, Descriptionseriemodif, int.Parse(Dureemoyenneseriemodif), Producteurseriemodif, Selectgenremodif, _fileNameModif, int.Parse(NbSaisonModif), _fileNameBanniereModif, int.Parse(NbEpisodeModif)); MessageBox.Show("Modification enrgistrée"); RefreshEvent.GetInstance().OnRefreshAcceuilHandler(EventArgs.Empty); setChampModifNull(); } } } else { GestionBDD.updateSeriesansImage(SelectSerie, Descriptionseriemodif, int.Parse(Dureemoyenneseriemodif), Producteurseriemodif, Selectgenremodif, int.Parse(NbSaisonModif), int.Parse(NbEpisodeModif)); MessageBox.Show("Modification enrgistrée"); RefreshEvent.GetInstance().OnRefreshAcceuilHandler(EventArgs.Empty); setChampModifNull(); } } else { MessageBox.Show("Veuillez rentrer uniquement des nombres pour le nombre de saison(s) de la serie", "Erreur", MessageBoxButton.OK, MessageBoxImage.Warning); } } else { MessageBox.Show("Veuillez rentrer uniquement des nombres pour la Durée Moyenne de la serie", "Erreur", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void OnSauverModifProfil(object obj) { if (Description != user.Description) { user_courant.Description = Description; GestionBDD.updateDescription(Description, user_courant.Pseudo); } if (SelectSexe != "Pas spécifié...") { user_courant.Sexe = SelectSexe; GestionBDD.updateSexe(SelectSexe, user_courant.Pseudo); } if (SelectDate != user_courant.DateDeNaissance) { user_courant.DateDeNaissance = SelectDate; GestionBDD.updateDdn(SelectDate.ToString(), user_courant.Pseudo); } //GESTION SAUVEGARDE IMAGE if (_verif) { if (!File.Exists($@"{_path}\{_fileName}")) { FileInfo f = new FileInfo(openFile.FileName); if (f.Length > 512000) { MessageBox.Show("La taille de l'image de profil est trop grande (500 ko maximum)", "", MessageBoxButton.OK, MessageBoxImage.Warning); } else { File.Copy(openFile.FileName, Path.Combine(_path, _fileName)); GestionBDD.enregisterPhotoProfil(_fileName, user.Pseudo); user.image = new BitmapImage(new Uri($@"{_path}\{_fileName}")); } } else { GestionBDD.enregisterPhotoProfil(_fileName, user.Pseudo); user.image = new BitmapImage(new Uri($@"{_path}\{_fileName}")); } } if (_verifCouv) { if (!File.Exists($@"{_path}\{_fileNameCouverture}")) { FileInfo f = new FileInfo(_openFileCouverture.FileName); if (f.Length > 716800) { MessageBox.Show("La taille de l'image de couverture est trop grande (700 ko maximum)", "", MessageBoxButton.OK, MessageBoxImage.Warning); } else { File.Copy(_openFileCouverture.FileName, Path.Combine(_path, _fileNameCouverture)); GestionBDD.enregisterPhotoCouverture(_fileNameCouverture, user.Pseudo); user.couverture = new BitmapImage(new Uri($@"{_path}\{_fileNameCouverture}")); } } else { GestionBDD.enregisterPhotoCouverture(_fileNameCouverture, user.Pseudo); user.couverture = new BitmapImage(new Uri($@"{_path}\{_fileNameCouverture}")); } } MessageBox.Show("Modification enregistrée"); RefreshEvent.GetInstance().OnRefreshAcceuilHandler(EventArgs.Empty); WindowClosedEvent.GetInstance().OnWindowClosedHandler(EventArgs.Empty); }