Exemple #1
0
        private void questions_Click(object sender, RoutedEventArgs e)
        {
            if (idQ != 2000)
            {
                question Updatedquestion = ct.UpdateQuestionOfSondage(idQ, inputQ.Text);
                int      b = 0;
                foreach (var choix in ch)
                {
                    b++;
                    string unChoix = (choix.Children[1] as TextBox).Text;
                    if (b <= Updatedquestion.choixes.Count)
                    {
                        ct.UpdateChoix(Updatedquestion.choixes.ElementAt(b - 1).Id, unChoix);
                    }
                    else
                    {
                        ct.AddChoix(Updatedquestion, unChoix);
                    }
                }
            }
            else
            {
                question Newquestion = ct.AddQuestionOfSondage(quest, inputQ.Text);
                foreach (var choix in ch)
                {
                    string unChoix = (choix.Children[1] as TextBox).Text;
                    ct.AddChoix(Newquestion, unChoix);
                }
            }
            ajouterQS page = new ajouterQS(quest, nbQ, k + 1);

            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 (sondageExistant)
                        {
                            newSondage = ct.UpdateSondage(questionnaire.Id, titreChoisi.Text, inputDescription.Text, newTheme.nom, int.Parse(inputRemuneration.Text), int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value);
                        }
                        else
                        {
                            newSondage = ct.AddSondage(titreChoisi.Text, inputDescription.Text, newTheme.nom, int.Parse(inputRemuneration.Text), int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value);
                        }
                    }
                    else
                    {
                        if (sondageExistant)
                        {
                            newSondage = ct.UpdateSondageWithThemeWithThemeParent(questionnaire.Id, titreChoisi.Text, inputDescription.Text, themes.Text, themesParents.Text, int.Parse(inputRemuneration.Text), int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value);
                        }
                        else
                        {
                            newSondage = ct.AddSondageWithThemeWithThemeParent(titreChoisi.Text, inputDescription.Text, themes.Text, themesParents.Text, int.Parse(inputRemuneration.Text), int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value);
                        }
                    }
                }
                else
                {
                    newSondage = ct.AddSondage(titreChoisi.Text, inputDescription.Text, themes.SelectedItem.ToString(), int.Parse(inputRemuneration.Text), int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value);
                }

                ajouterQS page = new ajouterQS(ct.getQuestionnaireBySondage(newSondage), int.Parse(inputNbQ.Text), 1);
                NavigationService.Navigate(page);
            }
            catch (System.FormatException)
            {
                erreur.Visibility = Visibility.Visible;
            }
        }
Exemple #3
0
        private void questions_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sequenceExistante)
                {
                    newSequence = ct.UpdateSequence(sequence.Id, titreChoisi.Text, inputDescription.Text, enq.theme.nom, int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value);
                }
                else
                {
                    newSequence = ct.AddSequence(titreChoisi.Text, inputDescription.Text, enq.theme.nom, int.Parse(inputNbQ.Text), disponibilite.IsChecked.Value, enq);
                }

                ajouterQS page = new ajouterQS(newSequence, int.Parse(inputNbQ.Text), 1);
                NavigationService.Navigate(page);
            }
            catch (System.FormatException)
            {
                erreur.Visibility = Visibility.Visible;
            }
        }