Exemplo n.º 1
0
        private void createButton_Click(object sender, EventArgs e)
        {
            Guid testGUID;

            testGUID = Guid.NewGuid();
            dataset.Tests.AddTestsRow(nameTextBox.Text, isPracticeCheckBox.Checked ? (true) : (false),
                                      descriptionTextBox.Text, 0, 0, testGUID.ToString(), 1);
            if (typeComboBox.SelectedIndex != 0)
            {
                dataset.Tests[0].QuestionTypeId = dataset.QuestionTypes[typeComboBox.SelectedIndex - 1].Id;
            }
            else
            {
                dataset.Tests[0].SetQuestionTypeIdNull();
            }

            if (subTypecomboBox.SelectedIndex != 0)
            {
                dataset.Tests[0].QuestionSubtypeId = dataset.QuestionSubtypes[subTypecomboBox.SelectedIndex - 1].Id;
            }
            else
            {
                dataset.Tests[0].SetQuestionSubtypeIdNull();
            }
            provider.AddNewTest(dataset.Tests[0]);

            ((Connection)connectionComboBox.SelectedItem).Refresh();

            DialogResult = DialogResult.OK;
        }