private void btnOrientationManage_Click(object sender, RoutedEventArgs e) { wAdminCurrentTest pg = new wAdminCurrentTest("ORIENTATION"); 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(); }