Exemple #1
0
        public bool getCountOpValid()
        {
            bool isContent = false, ckCr = false;

            for (int index = 0; index < panels.Count; ++index)
            {
                if (!getContent(index).Equals(""))
                {
                    isContent = true;
                    if (ckCorrects[index].Checked)
                    {
                        ckCr = true;
                    }
                }
            }
            if (!isContent)
            {
                MessBox.Warning("Please fill in at least one option"); return(false);
            }
            if (!ckCr)
            {
                MessBox.Warning("Check at least one correct answer"); return(false);
            }
            return(true);
        }
Exemple #2
0
        private void btnStart_Click_1(object sender, EventArgs e)
        {
            if (cbxNameExams.selectedIndex == -1)
            {
                MessBox.Warning("Not selected Name Exams !! Please Select "); return;
            }
            ;
            if (stringToInt(cbxSelectNumExams.Text) <= 0)
            {
                MessBox.Warning("Invalid Number Question !! "); return;
            }
            if (stringToInt(cbxTimes.Text) <= 0 && !cbxTimes.Text.Equals("None"))
            {
                MessBox.Warning("Invalid Times/Number Question !! "); return;
            }
            if (!QA.getInstance().setQuestions(stringToInt(cbxSelectNumExams.Text), examsCode[cbxNameExams.selectedIndex], stringToInt(cbxTimes.Text)))
            {
                return;
            }

            //Hide and show form beginner
            this.Hide();
            using (var form = new StartForm())
            {
                form.ShowDialog();
            }
            this.Show();
        }
Exemple #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string contents = switchText.Value ? rtxtQuestion.Text : fileName;

            if (RgEx.isEmpty(contents, "Title question"))
            {
                return;
            }
            if (!pnOps.getCountOpValid())
            {
                return;
            }
            if (cbxNameExams.selectedIndex == -1)
            {
                MessBox.Warning("Please Select Exams!!"); return;
            }


            /*Insert Question*/
            Questions qs = new Questions(contents, DateTime.UtcNow.ToShortDateString(), Examcode[cbxNameExams.selectedIndex].ToString(),
                                         FormLogin.username, switchText.Value == true ? "0" : "1", rtxExplain.Text);

            qs.setOption(pnOps.GetOption());
            qs.InsertQuestion();

            Clear();
        }
Exemple #4
0
        public bool setQuestions(int numQues, int exId, int timePer)
        {
            string query       = string.Format("select count(q_id) from questions where q_fk_ex ={0}", exId);
            string IdQuestions = ReturnClass.scalarReturn(query);

            if (string.IsNullOrEmpty(IdQuestions) || int.Parse(IdQuestions) < numQues)
            {
                MessBox.Warning("Num Question or Name Exams invalid "); return(false);
            }
            this.numQues = numQues;
            this.exId    = exId;
            this.timePer = timePer;
            optionMix.Clear();
            check.Clear();
            RandomNumberQs();
            InitRandomChoice();
            currentIndex = -1;
            return(true);
        }