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 wAdminEditRatingOrientation(Questions_Orientation question, string msg) { InitializeComponent(); questionSelected = question; currentTest = msg; Answer_Orientation answerOrientation = new Answer_Orientation(); lstAnswer = answerOrientation.SelectAnswerOrientationFromQuestionOrientationId(questionSelected.Id); setAnswers(); }
private void Button_Click(object sender, RoutedEventArgs e) { Answer_Orientation newAnswerOrientation = new Answer_Orientation(); newAnswerOrientation.EditJobAnswerOrientation(lstAnswer[0].Id, cbAnswerJobOne.SelectedIndex); newAnswerOrientation.EditJobAnswerOrientation(lstAnswer[1].Id, cbAnswerJobTwo.SelectedIndex); newAnswerOrientation.EditJobAnswerOrientation(lstAnswer[2].Id, cbAnswerJobThree.SelectedIndex); newAnswerOrientation.EditJobAnswerOrientation(lstAnswer[3].Id, cbAnswerJobFour.SelectedIndex); View.wAdminQuestionSelected pg = new View.wAdminQuestionSelected(currentTest, questionSelected); pg.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; pg.Show(); this.Close(); }
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(); }
public List <Answer_Orientation> getAnswerByQuestionOrientationId(int questionOrientationId) { Answer_Orientation getAnswerOrientation = new Answer_Orientation(); return(getAnswerOrientation.SelectAnswerOrientationFromQuestionOrientationId(questionOrientationId)); }