private void _ButtonAffaireDocumentTechniqueNouveau_Click(object sender, RoutedEventArgs e) { TypeDocTechniqueWindow typedocTechniqueWindow = new TypeDocTechniqueWindow(); typedocTechniqueWindow.DataContext = new Affaire_Type_Commande(); ((Affaire_Type_Commande)typedocTechniqueWindow.DataContext).Affaire1 = (Affaire)this.DataContext; bool? dialogResult = typedocTechniqueWindow.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value == true) { ((Affaire)this.DataContext).Affaire_Type_Commande.Add((Affaire_Type_Commande)typedocTechniqueWindow.DataContext); } else { try { ((App)App.Current).mySitaffEntities.Detach((Affaire_Type_Commande)typedocTechniqueWindow.DataContext); } catch (Exception) { } } this._dataGridDocumentTechnique.Items.Refresh(); }
private void LookDocTechnique_Click(object sender, RoutedEventArgs e) { if (this._comboBoxTypeCommande.SelectedItem != null) { ParametreTypeCommandeControl parametreTypeCommandeControl = new ParametreTypeCommandeControl(); if (this._comboBoxAffaire.SelectedItem != null) { if (((Affaire)this._comboBoxAffaire.SelectedItem).Affaire_Type_Commande.Where(aff => aff.Type_Commande1.Identifiant == ((Type_Commande)this._comboBoxTypeCommande.SelectedItem).Identifiant).Count() != 0) { Affaire_Type_Commande toWatch = ((Affaire)this._comboBoxAffaire.SelectedItem).Affaire_Type_Commande.Where(aff => aff.Type_Commande1.Identifiant == ((Type_Commande)this._comboBoxTypeCommande.SelectedItem).Identifiant).First(); TypeDocTechniqueWindow typedocTechniqueWindow = new TypeDocTechniqueWindow(); if (toWatch != null) { typedocTechniqueWindow.DataContext = toWatch; } else { typedocTechniqueWindow.DataContext = (Type_Commande)this._comboBoxTypeCommande.SelectedItem; } typedocTechniqueWindow.LectureSeule(); bool? dialogResult = typedocTechniqueWindow.ShowDialog(); } else { parametreTypeCommandeControl.Look((Type_Commande)this._comboBoxTypeCommande.SelectedItem); } } else { parametreTypeCommandeControl.Look((Type_Commande)this._comboBoxTypeCommande.SelectedItem); } } }
private void _ButtonAffaireDocumentTechniqueModifier_Click(object sender, RoutedEventArgs e) { if (this._dataGridDocumentTechnique.SelectedItems.Count <= 0) { MessageBox.Show("Vous devez sélectionner une doc technique à modifier.", "Erreur", MessageBoxButton.OK, MessageBoxImage.Stop); } else if (this._dataGridDocumentTechnique.SelectedItems.Count > 1) { MessageBox.Show("Vous ne devez sélectionner qu'une doc technique à modifier.", "Erreur", MessageBoxButton.OK, MessageBoxImage.Stop); } else if (this._dataGridDocumentTechnique.SelectedItem != null) { TypeDocTechniqueWindow typedocTechniqueWindow = new TypeDocTechniqueWindow(); typedocTechniqueWindow.DataContext = (Affaire_Type_Commande)this._dataGridDocumentTechnique.SelectedItem; bool? dialogResult = typedocTechniqueWindow.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value == true) { this._dataGridDocumentTechnique.SelectedItem = (Affaire_Type_Commande)typedocTechniqueWindow.DataContext; } else { try { ((App)App.Current).mySitaffEntities.Refresh(System.Data.Objects.RefreshMode.StoreWins, (Affaire_Type_Commande)typedocTechniqueWindow.DataContext); } catch (Exception) { } } } this._dataGridDocumentTechnique.Items.Refresh(); }