Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int crsID = 0;

            if (comboBox1.SelectedItem != null)
            {
                crsID = int.Parse(comboBox1.SelectedItem.ToString().Split(',')[0]);
            }
            else
            {
                MessageBox.Show("Please select course id", "Waring");
                return;
            }

            if (!isQuestDataValid())
            {
                MessageBox.Show("Please Enter Valid Data", "Waring");
                return;
            }

            string qbody    = qcont.Text.Trim();
            string qtype    = comboBox3.SelectedItem.ToString();
            int    qdeg     = (int)qdegree.Value;
            string modelAns = qmodel.Text.Trim();

            OnlineExam ent  = new OnlineExam();
            var        last = ent.insertQuest(qtype, qdeg, qbody, modelAns, crsID).First();

            ////////////////////////////////////////////////////////////////////
            if (last.Type.ToLower() == "mcq")
            {
                insertChoicesForQuestById(last.QuesId);
            }


            loadCourse();
            loadQuestions(crsID);
            qcont.Text     = qmodel.Text = string.Empty;
            qdegree.Value  = 1;
            comboBox3.Text = string.Empty;
        }