private void bSuppression_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Êtes-vous sure de vouloir supprimer la question ?", "My App", MessageBoxButton.YesNo); switch (result) { case MessageBoxResult.Yes: if (currentTest == "GAME") { Answer_Game newAnswerGame = new Answer_Game(); newAnswerGame.DeleteAnswersGameFromQuestionId(questionGame.Id); Questions_Game newQuestionGame = new Questions_Game(); newQuestionGame.DeleteQuestionGame(questionGame.Id); } else { Answer_Orientation newAnswerOrientation = new Answer_Orientation(); newAnswerOrientation.DeleteAnswersOrientationFromQuestionId(questionOrientation.Id); Questions_Orientation newQuestionOrientation = new Questions_Orientation(); newQuestionOrientation.DeleteQuestionOrientation(questionOrientation.Id); } MessageBox.Show("Question supprimée.", "My App"); //Mettre à jours la liste View.wAdminQuestionSelected pg = new View.wAdminQuestionSelected(currentTest); pg.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; pg.Show(); this.Close(); break; case MessageBoxResult.No: break; } }
public static void getQuestionsOrientation() { Questions_Orientation newGameOrientation = new Questions_Orientation(); lstQuestionsOrientation.Clear(); lstQuestionsOrientation = newGameOrientation.SelectQuestionsOrientation(); }
public wAdminEditRatingOrientation(Questions_Orientation question, string msg) { InitializeComponent(); questionSelected = question; currentTest = msg; Answer_Orientation answerOrientation = new Answer_Orientation(); lstAnswer = answerOrientation.SelectAnswerOrientationFromQuestionOrientationId(questionSelected.Id); setAnswers(); }
public wAdminEditQuestion(string msg, Questions_Orientation q) { InitializeComponent(); questionOrientation = q; currentTest = msg; listAnswerOrientation = getAnswerByQuestionOrientationId(q.Id); setAnswerTBByAnswerTextList(new List <string> { listAnswerOrientation[0].Text.ToString(), listAnswerOrientation[1].Text.ToString(), listAnswerOrientation[2].Text.ToString(), listAnswerOrientation[3].Text.ToString() }); tbQuestion.Text = q.Question; }
private void listView_Click(object sender, MouseButtonEventArgs e) { if (lvAdmin.SelectedValue != null) { if (currentTest == "GAME") { Questions_Game questionGameSelected = (Questions_Game)lvAdmin.SelectedItems[0]; View.wAdminQuestionSelected pgAdminQuestion = new View.wAdminQuestionSelected(currentTest, questionGameSelected); pgAdminQuestion.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; pgAdminQuestion.Show(); this.Close(); } else { Questions_Orientation questionOrientationSelected = (Questions_Orientation)lvAdmin.SelectedItems[0]; View.wAdminQuestionSelected pgAdminQuestion = new View.wAdminQuestionSelected(currentTest, questionOrientationSelected); pgAdminQuestion.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; pgAdminQuestion.Show(); this.Close(); } } }
public wAdminQuestionSelected(string msg, Questions_Orientation currentQuestionOrientation) : this(msg) { InitializeComponent(); questionOrientation = currentQuestionOrientation; lQuestionSubject.Text = questionOrientation.Question; }
private void btnAdd_Click(object sender, RoutedEventArgs e) { if (currentTest == "GAME") { if (questionGame != null) { try { Questions_Game editQuestionGame = new Questions_Game(); editQuestionGame.EditQuestionGame(questionGame.Id, tbQuestion.Text.ToString()); Answer_Game editAnswerGame = new Answer_Game(); editAnswerGame.EditTextAnswerGame(listAnswerGame[0].Id, tbAnswerOne.Text.ToString()); editAnswerGame.EditTextAnswerGame(listAnswerGame[1].Id, tbAnswerTwo.Text.ToString()); editAnswerGame.EditTextAnswerGame(listAnswerGame[2].Id, tbAnswerThree.Text.ToString()); editAnswerGame.EditTextAnswerGame(listAnswerGame[3].Id, tbAnswerFour.Text.ToString()); MessageBox.Show("Modification effectué avec succès"); } catch (Exception ex) { MessageBox.Show("Attention, impossible de modifier la question"); MessageBox.Show(ex.Message.ToString()); } } else { try { Questions_Game addQuestionGame = new Questions_Game(); long id = addQuestionGame.AddQuestionGame(tbQuestion.Text.ToString()); Answer_Game addAnswerGame = new Answer_Game(); addAnswerGame.AddAnswerGame(tbAnswerOne.Text.ToString(), Convert.ToInt32(id), true); addAnswerGame.AddAnswerGame(tbAnswerTwo.Text.ToString(), Convert.ToInt32(id), true); addAnswerGame.AddAnswerGame(tbAnswerThree.Text.ToString(), Convert.ToInt32(id), true); addAnswerGame.AddAnswerGame(tbAnswerFour.Text.ToString(), Convert.ToInt32(id), true); MessageBox.Show("Ajout effectué avec succès"); } catch (Exception ex) { MessageBox.Show("Attention, impossible d'ajouter la question"); MessageBox.Show(ex.Message.ToString()); } } } else { if (questionOrientation != null) { try { Questions_Orientation editQuestionOrientation = new Questions_Orientation(); editQuestionOrientation.EditQuestionOrientation(questionOrientation.Id, tbQuestion.Text.ToString()); Answer_Orientation editAnswerOrientation = new Answer_Orientation(); editAnswerOrientation.EditTextAnswerOrientation(listAnswerOrientation[0].Id, tbAnswerOne.Text.ToString()); editAnswerOrientation.EditTextAnswerOrientation(listAnswerOrientation[1].Id, tbAnswerTwo.Text.ToString()); editAnswerOrientation.EditTextAnswerOrientation(listAnswerOrientation[2].Id, tbAnswerThree.Text.ToString()); editAnswerOrientation.EditTextAnswerOrientation(listAnswerOrientation[3].Id, tbAnswerFour.Text.ToString()); MessageBox.Show("Modification effectué avec succès"); } catch { MessageBox.Show("Attention, impossible de modifier la question"); } } else { try { Questions_Orientation addQuestionOrientation = new Questions_Orientation(); long id = addQuestionOrientation.AddQuestionOrientation(tbQuestion.Text.ToString()); Answer_Orientation addAnswerOrientation = new Answer_Orientation(); addAnswerOrientation.AddAnswerOrientation(tbAnswerOne.Text.ToString(), Convert.ToInt32(id), 1); addAnswerOrientation.AddAnswerOrientation(tbAnswerTwo.Text.ToString(), Convert.ToInt32(id), 2); addAnswerOrientation.AddAnswerOrientation(tbAnswerThree.Text.ToString(), Convert.ToInt32(id), 3); addAnswerOrientation.AddAnswerOrientation(tbAnswerFour.Text.ToString(), Convert.ToInt32(id), 4); MessageBox.Show("Ajout effectué avec succès"); } catch { MessageBox.Show("Attention, impossible d'ajouter la question"); } } } wAdminCurrentTest pg = new wAdminCurrentTest(currentTest); pg.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; pg.Show(); this.Close(); }