public void LookRetourChantier(UIElement uIElement, Retour_Chantier retToLook) { ((ListeRetourChantierControl)uIElement).Look(retToLook); }
/// <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 Sortie_Atelier soit pour l'ajouter au listing, soit pour afficher qui a été modifié ou supprimé</param> public void MiseAJourEtat(string typeEtat, Retour_Chantier om) { //Je recalcul 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 retours chantier terminé : " + this.listRetour.Count() + " / " + this.max); } else if (typeEtat == "Ajout") { //J'ajoute sortie atelier dans le linsting this.listRetour.Add(om); //Je recalcul le nombre max d'élements après l'ajout this.recalculMax(); ((App)App.Current)._theMainWindow.changementTexteStatusBar("Ajout d'un retour chantier effectuée avec succès. Nombre d'élements : " + this.listRetour.Count() + " / " + this.max); try { this._DataGridMain.SelectedItem = om; } catch (Exception) { } } else if (typeEtat == "Modification") { //Je raffraichis mon datagrid this._DataGridMain.Items.Refresh(); ((App)App.Current)._theMainWindow.changementTexteStatusBar("Modification du retour chantier effectuée avec succès. Nombre d'élements : " + this.listRetour.Count() + " / " + this.max); } else if (typeEtat == "Suppression") { //Je supprime de mon listing l'élément supprimé this.listRetour.Remove(om); //Je recalcul le nombre max d'élements après la suppression this.recalculMax(); ((App)App.Current)._theMainWindow.changementTexteStatusBar("Suppression du retour chantier effectuée avec succès. Nombre d'élements : " + this.listRetour.Count() + " / " + this.max); } else if (typeEtat == "Look") { } else if (typeEtat == "Duplicate") { //J'ajoute sortie atelier dans le linsting this.listRetour.Add(om); //Je recalcul le nombre max d'élements après l'ajout this.recalculMax(); ((App)App.Current)._theMainWindow.changementTexteStatusBar("Dupliquer un retour chantier effectué avec succès. Nombre d'élements : " + this.listRetour.Count() + " / " + this.max); } else { ((App)App.Current)._theMainWindow.changementTexteStatusBar("Chargement des retours chantier terminé : " + this.listRetour.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; }
/// <summary> /// Ajoute une nouvelle entreprise à la liste à l'aide d'une nouvelle fenêtre /// </summary> public Retour_Chantier Add() { //Affichage du message "ajout en cours" ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = true; ((App)App.Current)._theMainWindow.changementTexteStatusBar("Ajout d'une retour chantier en cours ..."); //Initialisation de la fenêtre RetourChantierWindow retourChantierWindow = new RetourChantierWindow(); //Création de l'objet temporaire Retour_Chantier tmp = new Retour_Chantier(); //Mise de l'objet temporaire dans le datacontext retourChantierWindow.DataContext = tmp; //booléen nullable vrai ou faux ou null bool? dialogResult = retourChantierWindow.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value == true) { //Si j'appuie sur le bouton Ok, je renvoi l'objet sortieAtelier dans le datacontext de la fenêtre return (Retour_Chantier)retourChantierWindow.DataContext; } else { try { //Detachement de tous les éléments liés à une Mission tiers if (((Retour_Chantier)retourChantierWindow.DataContext).Contenu_Retour_Chantier != null) { while (((Retour_Chantier)retourChantierWindow.DataContext).Contenu_Retour_Chantier.Count() > 0) { ((App)App.Current).mySitaffEntities.Detach(((Retour_Chantier)retourChantierWindow.DataContext).Contenu_Retour_Chantier.First()); } ((App)App.Current).mySitaffEntities.Detach(((Retour_Chantier)retourChantierWindow.DataContext).Contenu_Retour_Chantier); } } 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 retour chantier annulé : " + this.listRetour.Count() + " / " + this.max); return null; } }
/// <summary> /// Ouvre l'entreprise séléctionnée en lecture seule à l'aide d'une nouvelle fenêtre /// </summary> public Retour_Chantier Look(Retour_Chantier retourChantier) { if (this._DataGridMain.SelectedItem != null || retourChantier != null) { if (this._DataGridMain.SelectedItems.Count == 1 || retourChantier != null) { //Affichage du message "affichage en cours" ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = true; ((App)App.Current)._theMainWindow.changementTexteStatusBar("Affichage d'un retour chantier en cours ..."); //Création de la fenêtre RetourChantierWindow retourChantierWindow = new RetourChantierWindow(); //Initialisation du Datacontext en ordre de mission et association à l'sortieAtelier sélectionnée retourChantierWindow.DataContext = new Sortie_Atelier(); if (retourChantier != null) { retourChantierWindow.DataContext = retourChantier; } else { retourChantierWindow.DataContext = (Retour_Chantier)this._DataGridMain.SelectedItem; } //Je positionne la lecture seule sur la fenêtre retourChantierWindow.lectureSeule(); //J'affiche la fenêtre bool? dialogResult = retourChantierWindow.ShowDialog(); //Affichage du message "affichage en cours" ((App)App.Current)._theMainWindow.progressBarMainWindow.IsIndeterminate = false; ((App)App.Current)._theMainWindow.changementTexteStatusBar("Affichage d'un retour chantier terminé : " + this.listRetour.Count() + " / " + this.max); //Renvoi null return null; } else { MessageBox.Show("Vous ne devez sélectionner qu'un retour chantier atelier.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation); return null; } } else { MessageBox.Show("Vous devez sélectionner un retour chantier.", "Attention", MessageBoxButton.OK, MessageBoxImage.Exclamation); return null; } }