//save button public void SaveAll_Click(object sender, EventArgs e) { int AmountOfQuestions = bc.qc.getQuestions(index).Count(); if (combobox.SelectedIndex == 0) { if (string.IsNullOrWhiteSpace(QuestionName.Text)) { MessageBox.Show("Vul eerst een vraag in"); } else if (string.IsNullOrWhiteSpace(AnswerOpenQuestionTextbox.Text)) { MessageBox.Show("Vul eerst een antwoord in"); } else { question = new Question(AmountOfQuestions + 1, QuestionName.Text, 0, index); Questionoption questionOption = new Questionoption(1, AnswerOpenQuestionTextbox.Text, AmountOfQuestions + 1, true); question.addOption(questionOption); bc.qc.create(question); MessageBox.Show("De vraag is toegevoegd"); bc.qc.editListPanel(index); } } else if (combobox.SelectedIndex == 1) { if (string.IsNullOrWhiteSpace(QuestionName.Text)) { MessageBox.Show("Vul eerst een vraag in"); } else if (string.IsNullOrWhiteSpace(Answer1TextboxThesis.Text) || string.IsNullOrWhiteSpace(Answer2TextboxThesis.Text)) { MessageBox.Show("Vul eerst een antwoord in"); } else { AmountOfQuestions += 1; question = new Question(AmountOfQuestions + 1, QuestionName.Text, 1, index); Questionoption questionOption = new Questionoption(1, Answer1TextboxThesis.Text, AmountOfQuestions, false); question.addOption(questionOption); Questionoption questionOption1 = new Questionoption(1, Answer2TextboxThesis.Text, AmountOfQuestions, false); question.addOption(questionOption1); bc.qc.create(question); MessageBox.Show("De stelling is toegevoegd"); bc.qc.editListPanel(index); } } else if (combobox.SelectedIndex == 2) { if (string.IsNullOrWhiteSpace(QuestionName.Text)) { MessageBox.Show("Vul eerst een vraag in"); } else if (string.IsNullOrWhiteSpace(Answer1Textbox.Text) || string.IsNullOrWhiteSpace(Answer2Textbox.Text)) { MessageBox.Show("Vul eerst alle antwoorden in"); } else { if (Answer1Radiobuttons.Checked || Answer2Radiobuttons.Checked) { AmountOfQuestions += 1; question = new Question(AmountOfQuestions + 1, QuestionName.Text, 2, index); Questionoption questionOption1 = new Questionoption(1, Answer1Textbox.Text, AmountOfQuestions, Answer1Radiobuttons.Checked); question.addOption(questionOption1); Questionoption questionOption2 = new Questionoption(2, Answer2Textbox.Text, AmountOfQuestions, Answer2Radiobuttons.Checked); question.addOption(questionOption2); bc.qc.create(question); MessageBox.Show("De vraag is toegevoegd"); bc.qc.editListPanel(index); } else { MessageBox.Show("Selecteer eerst een juist antwoord"); } } } else if (combobox.SelectedIndex == 3) { if (string.IsNullOrWhiteSpace(QuestionName.Text)) { MessageBox.Show("Vul eerst een vraag in"); } else if (string.IsNullOrWhiteSpace(Answer1Textbox.Text) || string.IsNullOrWhiteSpace(Answer2Textbox.Text) || string.IsNullOrWhiteSpace(Answer3Textbox.Text)) { MessageBox.Show("Vul eerst alle antwoorden in"); } else { if (Answer1Radiobuttons.Checked || Answer2Radiobuttons.Checked || Answer3Radiobuttons.Checked) { AmountOfQuestions += 1; question = new Question(AmountOfQuestions + 1, QuestionName.Text, 3, index); Questionoption questionOption1 = new Questionoption(1, Answer1Textbox.Text, AmountOfQuestions, Answer1Radiobuttons.Checked); question.addOption(questionOption1); Questionoption questionOption2 = new Questionoption(1, Answer2Textbox.Text, AmountOfQuestions, Answer2Radiobuttons.Checked); question.addOption(questionOption2); Questionoption questionOption3 = new Questionoption(1, Answer3Textbox.Text, AmountOfQuestions, Answer3Radiobuttons.Checked); question.addOption(questionOption3); bc.qc.create(question); MessageBox.Show("De vraag is toegevoegd"); bc.qc.editListPanel(index); } else { MessageBox.Show("Selecteer eerst een juist antwoord"); } } } else if (combobox.SelectedIndex == 4) { if (string.IsNullOrWhiteSpace(QuestionName.Text)) { MessageBox.Show("Vul eerst een vraag in"); } else if (string.IsNullOrWhiteSpace(Answer1Textbox.Text) || string.IsNullOrWhiteSpace(Answer2Textbox.Text) || string.IsNullOrWhiteSpace(Answer3Textbox.Text) || string.IsNullOrWhiteSpace(Answer4Textbox.Text)) { MessageBox.Show("Vul eerst alle antwoorden in"); } else { if (Answer1Radiobuttons.Checked || Answer2Radiobuttons.Checked || Answer3Radiobuttons.Checked || Answer4Radiobuttons.Checked) { AmountOfQuestions += 1; question = new Question(AmountOfQuestions + 1, QuestionName.Text, 4, index); Questionoption questionOption1 = new Questionoption(1, Answer1Textbox.Text, AmountOfQuestions, Answer1Radiobuttons.Checked); question.addOption(questionOption1); Questionoption questionOption2 = new Questionoption(1, Answer2Textbox.Text, AmountOfQuestions, Answer2Radiobuttons.Checked); question.addOption(questionOption2); Questionoption questionOption3 = new Questionoption(1, Answer3Textbox.Text, AmountOfQuestions, Answer3Radiobuttons.Checked); question.addOption(questionOption3); Questionoption questionOption4 = new Questionoption(1, Answer4Textbox.Text, AmountOfQuestions, Answer4Radiobuttons.Checked); question.addOption(questionOption4); bc.qc.create(question); MessageBox.Show("De vraag is toegevoegd"); bc.qc.editListPanel(index); } else { MessageBox.Show("Selecteer eerst een juist antwoord"); } } } else if (combobox.SelectedIndex == 5) { if (string.IsNullOrWhiteSpace(QuestionName.Text)) { MessageBox.Show("Vul eerst een vraag in"); } else if (string.IsNullOrWhiteSpace(Answer1Textbox.Text) || string.IsNullOrWhiteSpace(Answer2Textbox.Text) || string.IsNullOrWhiteSpace(Answer3Textbox.Text) || string.IsNullOrWhiteSpace(Answer4Textbox.Text) || string.IsNullOrWhiteSpace(Answer5Textbox.Text)) { MessageBox.Show("Vul eerst alle antwoorden in"); } else { if (Answer1Radiobuttons.Checked || Answer2Radiobuttons.Checked || Answer3Radiobuttons.Checked || Answer4Radiobuttons.Checked || Answer5Radiobuttons.Checked) { AmountOfQuestions += 1; question = new Question(AmountOfQuestions + 1, QuestionName.Text, 5, index); Questionoption questionOption1 = new Questionoption(1, Answer1Textbox.Text, AmountOfQuestions, Answer1Radiobuttons.Checked); question.addOption(questionOption1); Questionoption questionOption2 = new Questionoption(1, Answer2Textbox.Text, AmountOfQuestions, Answer2Radiobuttons.Checked); question.addOption(questionOption2); Questionoption questionOption3 = new Questionoption(1, Answer3Textbox.Text, AmountOfQuestions, Answer3Radiobuttons.Checked); question.addOption(questionOption3); Questionoption questionOption4 = new Questionoption(1, Answer4Textbox.Text, AmountOfQuestions, Answer4Radiobuttons.Checked); question.addOption(questionOption4); Questionoption questionOption5 = new Questionoption(1, Answer5Textbox.Text, AmountOfQuestions, Answer5Radiobuttons.Checked); question.addOption(questionOption5); bc.qc.create(question); MessageBox.Show("De vraag is toegevoegd"); bc.qc.editListPanel(index); } else { MessageBox.Show("Selecteer eerst een juist antwoord"); } } } else if (combobox.SelectedIndex == 6) { if (string.IsNullOrWhiteSpace(QuestionName.Text)) { MessageBox.Show("Vul eerst een vraag in"); } else if (string.IsNullOrWhiteSpace(Answer1Textbox.Text) || string.IsNullOrWhiteSpace(Answer2Textbox.Text) || string.IsNullOrWhiteSpace(Answer3Textbox.Text) || string.IsNullOrWhiteSpace(Answer4Textbox.Text) || string.IsNullOrWhiteSpace(Answer5Textbox.Text) || string.IsNullOrWhiteSpace(Answer6Textbox.Text)) { MessageBox.Show("Vul eerst alle antwoorden in"); } else { if (Answer1Radiobuttons.Checked || Answer2Radiobuttons.Checked || Answer3Radiobuttons.Checked || Answer4Radiobuttons.Checked || Answer5Radiobuttons.Checked || Answer6Radiobuttons.Checked) { AmountOfQuestions += 1; question = new Question(AmountOfQuestions + 1, QuestionName.Text, 6, index); Questionoption questionOption1 = new Questionoption(1, Answer1Textbox.Text, AmountOfQuestions, Answer1Radiobuttons.Checked); question.addOption(questionOption1); Questionoption questionOption2 = new Questionoption(1, Answer2Textbox.Text, AmountOfQuestions, Answer2Radiobuttons.Checked); question.addOption(questionOption2); Questionoption questionOption3 = new Questionoption(1, Answer3Textbox.Text, AmountOfQuestions, Answer3Radiobuttons.Checked); question.addOption(questionOption3); Questionoption questionOption4 = new Questionoption(1, Answer4Textbox.Text, AmountOfQuestions, Answer4Radiobuttons.Checked); question.addOption(questionOption4); Questionoption questionOption5 = new Questionoption(1, Answer5Textbox.Text, AmountOfQuestions, Answer5Radiobuttons.Checked); question.addOption(questionOption5); Questionoption questionOption6 = new Questionoption(1, Answer6Textbox.Text, AmountOfQuestions, Answer6Radiobuttons.Checked); question.addOption(questionOption6); bc.qc.create(question); MessageBox.Show("De vraag is toegevoegd"); bc.qc.editListPanel(index); } else { MessageBox.Show("Selecteer eerst een juist antwoord"); } } } }