private void addPassgeToQuestionButton_Click(object sender, EventArgs e) { SelectPassageQuestionForm selectPassage = new SelectPassageQuestionForm(dataSet, setId, this); selectPassage.ShowDialog(); if (selectPassage.DialogResult == DialogResult.OK && selectedPassageId != -1) { passageTextBox.Text = dataSet.QuestionsEx.FindByIdSetId(selectedPassageId, setId).Text; } }
private void subTypecomboBox_SelectedIndexChanged(object sender, EventArgs e) { if (isInit) { return; } if ((subTypecomboBox.SelectedIndex == 3) && (subTypecomboBox.Enabled)) //Question to passage { if ( MessageBox.Show("Convert question to 'Reading Comprehension - Question to Passage'?", APP_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { SelectPassageQuestionForm selectPassage = new SelectPassageQuestionForm(dbObject.FullDataset, _questionRow.SetId); if (selectPassage.ShowDialog() == DialogResult.OK) { Close(true); selectedPassageId = selectPassage.selectedPassageId; dbObject.FullDataset.PassagesToQuestionsEx.AddPassagesToQuestionsExRow( dbObject.FullDataset.QuestionsEx.FindByIdSetId(selectedPassageId, _questionRow.SetId).Text, selectedPassageId, Id); dbObject.FullDataset.QuestionsEx.FindByIdSetId(Id, _questionRow.SetId).SubtypeId = 4; PassageQuestion qse = new PassageQuestion( dbObject.FullDataset.QuestionsEx.FindByIdSetId(selectedPassageId, _questionRow.SetId), dbObject.GetConnection(), dbObject.Parent); ApplicationController.Instance.Edit(qse); } else { //MessageBox.Show("Convert question to 'Reading Comprehension - Question to Passage'?", APP_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Question) subTypecomboBox.SelectedIndex = dbObject.FullDataset.QuestionsEx.FindByIdSetId(Id, _questionRow.SetId).SubtypeId - 1; } } else { subTypecomboBox.SelectedIndex = dbObject.FullDataset.QuestionsEx.FindByIdSetId(Id, _questionRow.SetId).SubtypeId - 1; } return; } else { _questionRow.Text = textTextBox.Text + ""; } if ((subTypecomboBox.SelectedIndex == 2) && (subTypecomboBox.Enabled)) //Question to passage { if ( MessageBox.Show("Convert question to 'Reading Comprehension - Passage'?", APP_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Close(true); dbObject.FullDataset.QuestionsEx.FindByIdSetId(Id, _questionRow.SetId).SubtypeId = 3; PassageQuestion qse = new PassageQuestion(dbObject.FullDataset.QuestionsEx.FindByIdSetId(Id, _questionRow.SetId), dbObject.GetConnection(), dbObject.Parent); ApplicationController.Instance.Edit(qse); // } else { subTypecomboBox.SelectedIndex = dbObject.FullDataset.QuestionsEx.FindByIdSetId(Id, _questionRow.SetId).SubtypeId - 1; } return; } else { _questionRow.Text = textTextBox.Text + ""; } }