private void modifier_Click(object sender, RoutedEventArgs e) { if (ct.getQuestionnaireById(qu).Id_enquete.HasValue) { ajouterSE page = new ajouterSE(ct.getQuestionnaireById(qu)); NavigationService.Navigate(page); } else { ajouterSondage page = new ajouterSondage(qu); NavigationService.Navigate(page); } }
private void questions_Click(object sender, RoutedEventArgs e) { try { if (nvTheme) { if (themesParents.SelectedIndex == -1) { theme newTheme = ct.AddThemeAlone(themes.Text); if (enqueteExistante) { newEnquete = ct.UpdateEnquete(enquete.Id, titreChoisi.Text, inputDescription.Text, newTheme.nom, int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } else { newEnquete = ct.AddEnquete(titreChoisi.Text, inputDescription.Text, newTheme.nom, int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } } else { if (enqueteExistante) { newEnquete = ct.UpdateEnqueteWithThemeWithThemeParent(enquete.Id, titreChoisi.Text, inputDescription.Text, themes.Text, themesParents.Text, int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } else { newEnquete = ct.AddEnqueteWithThemeWithThemeParent(titreChoisi.Text, inputDescription.Text, themes.Text, themesParents.Text, int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } } } else { newEnquete = ct.AddEnquete(titreChoisi.Text, inputDescription.Text, themes.SelectedItem.ToString(), int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value); } if (enqueteExistante) { detailEnquete page = new detailEnquete(newEnquete); NavigationService.Navigate(page); } else { ajouterSE page = new ajouterSE(newEnquete, int.Parse(inputNbQ.Text), 1); NavigationService.Navigate(page); } } catch (System.FormatException) { erreur.Visibility = Visibility.Visible; } }