/// <summary> /// Ajoute un nouveau dailly à la liste à l'aide d'une nouvelle fenêtre /// </summary> public Dailly Add() { //Affichage du message "ajout en cours" ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = true; ((App)App.Current)._theMainWindow.changementTexteStatusBar("Ajout d'un dailly en cours ..."); //Initialisation de la fenêtre DaillyWindow daillyWindow = new DaillyWindow(); //Création de l'objet temporaire Dailly tmp = new Dailly(); //Mise de l'objet temporaire dans le datacontext daillyWindow.DataContext = tmp; //booléen nullable vrai ou faux ou null bool? dialogResult = daillyWindow.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value == true) { //Si j'appuie sur le bouton Ok, je renvoi l'objet DAO se trouvant dans le datacontext de la fenêtre return (Dailly)daillyWindow.DataContext; } else { try { //On détache la commande ((App)App.Current).mySitaffEntities.Detach((Dailly)daillyWindow.DataContext); } catch (Exception) { } //Si j'appuie sur le bouton annuler, je préviens que j'annule mon ajout ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = false; this.recalculMax(); ((App)App.Current)._theMainWindow.changementTexteStatusBar("Ajout d'un dailly annulé : " + this.listDailly.Count() + " / " + this.max); return null; } }
/// <summary> /// Ouvre la dailly séléctionné en lecture seule à l'aide d'une nouvelle fenêtre /// </summary> public Dailly Look(Dailly d) { if (this._DataGridMain.SelectedItem != null) { if (this._DataGridMain.SelectedItems.Count == 1) { //Affichage du message "affichage en cours" ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = true; ((App)App.Current)._theMainWindow.changementTexteStatusBar("Affichage d'un dailly en cours ..."); //Création de la fenêtre DaillyWindow daillyWindow = new DaillyWindow(); //Initialisation du Datacontext en Commande_Fournisseur et association à la Commande_Fournisseur sélectionnée daillyWindow.DataContext = new Dailly(); daillyWindow.DataContext = (Dailly)this._DataGridMain.SelectedItem; //Je positionne la lecture seule sur la fenêtre daillyWindow.soloLecture = true; //J'affiche la fenêtre bool? dialogResult = daillyWindow.ShowDialog(); //Affichage du message "affichage en cours" ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = false; ((App)App.Current)._theMainWindow.changementTexteStatusBar("Affichage d'un dailly terminé : " + this.listDailly.Count() + " / " + this.max); //Renvoi null return null; } else { MessageBox.Show("Vous ne devez sélectionner qu'un seul dailly.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation); return null; } } else if (d != null) { //Affichage du message "affichage en cours" ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = true; ((App)App.Current)._theMainWindow.changementTexteStatusBar("Affichage d'un dailly en cours ..."); //Création de la fenêtre DaillyWindow daillyWindow = new DaillyWindow(); //Initialisation du Datacontext en Commande_Fournisseur et association à la Commande_Fournisseur sélectionnée daillyWindow.DataContext = new Dailly(); daillyWindow.DataContext = d; //Je positionne la lecture seule sur la fenêtre daillyWindow.soloLecture = true; //J'affiche la fenêtre bool? dialogResult = daillyWindow.ShowDialog(); //Affichage du message "affichage en cours" ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = false; ((App)App.Current)._theMainWindow.changementTexteStatusBar("Affichage d'un dailly terminé : " + this.listDailly.Count() + " / " + this.max); //Renvoi null return null; } else { MessageBox.Show("Vous devez sélectionner un dailly.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation); return null; } }
/// <summary> /// Met à jour l'état en bas pour l'utilisateur /// </summary> /// <param name="typeEtat">texte : "Filtrage", "Ajout", "Modification", "Suppression", "Look", "" ("" = Chargement)</param> /// <param name="dao">un objet Commande_Fournisseur soit pour l'ajouter au listing, soit pour afficher qui a été modifié ou supprimé</param> public void MiseAJourEtat(string typeEtat, Dailly dai) { //Je racalcul le nombre max d'élements this.recalculMax(); //En fonction de l'action, j'affiche le message if (typeEtat == "Filtrage") { ((App)App.Current)._theMainWindow.changementTexteStatusBar("Filtrage des daillys terminé : " + this.listDailly.Count() + " / " + this.max); } else if (typeEtat == "Ajout") { //J'ajoute la commande_fournisseur dans le linsting this.listDailly.Add(dai); //Je racalcul le nombre max d'élements après l'ajout this.recalculMax(); ((App)App.Current)._theMainWindow.changementTexteStatusBar("Ajout d'un dailly numéro '" + dai.Numero + "' effectué avec succès. Nombre d'élements : " + this.listDailly.Count() + " / " + this.max); } else if (typeEtat == "Modification") { //Je raffraichis mon datagrid this._DataGridMain.Items.Refresh(); ((App)App.Current)._theMainWindow.changementTexteStatusBar("Modification du dailly numéro : '" + dai.Numero + "' effectuée avec succès. Nombre d'élements : " + this.listDailly.Count() + " / " + this.max); } else if (typeEtat == "Suppression") { //Je supprime de mon listing l'élément supprimé this.listDailly.Remove(dai); //Je racalcul le nombre max d'élements après la suppression this.recalculMax(); ((App)App.Current)._theMainWindow.changementTexteStatusBar("Suppression du dailly numéro : '" + dai.Numero + "' effectuée avec succès. Nombre d'élements : " + this.listDailly.Count() + " / " + this.max); } else if (typeEtat == "Look") { } else { ((App)App.Current)._theMainWindow.changementTexteStatusBar("Chargement des daillys terminé : " + this.listDailly.Count() + " / " + this.max); } //Je retri les données dans le sens par défaut this.triDatas(); //J'arrete la progressbar ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = false; }
public void LookDailly(UIElement uIElement, Dailly daillyToLook) { ((ListeDaillyControl)uIElement).Look(daillyToLook); }