示例#1
0
        /// <summary>
        /// Event Load UcAddQuestion
        /// </summary>


        private void Load_test(object sender, EventArgs e)
        {
            ///

            ////Load test
            UcQuestions test = UcQuestions.Instance;

            pnlMain.Controls.Clear();
            panelDockL.Visible = false;
            pnlMain.Controls.Add(panelDockL);
            pnlMain.Visible = false;
            pnlMain.Controls.Add(test);
            pnlMain.Visible = true;
        }
示例#2
0
        private void UcQuestions_Load(object sender, EventArgs e)
        {
            switch (infoTest.NumberQuestions)
            {
            case 10:
            {
                Minute = 2;
                second = 0;
                break;
            }

            case 20:
            {
                Minute = 4;
                second = 0;
                break;
            }

            case 30:
            {
                Minute = 10;
                second = 0;
                break;
            }

            case 50:
            {
                Minute = 20;
                second = 0;
                break;
            }

            case 100:
            {
                Minute = 40;
                second = 0;
                break;
            }
            }

            timer1.Start();
            //Load Questions
            List <OjQuestion> Datatable = xmlBLL.DataQuestionsByLever(infoTest.Lever); /*LoadData.Instance.LoadDataQuetion()*/;

            if (Datatable.Count < infoTest.NumberQuestions)
            {
                MessageBox.Show("không đủ câu hỏi trong cơ sở dữ liệu", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                instance                 = null;
                infoTest.Lever           = null;
                infoTest.NumberQuestions = 0;
                return;
            }
            int[] random = ArrayRandom(infoTest.NumberQuestions, Datatable.Count);


            int number = 1;
            int height = 0;

            for (int i = 0; i < infoTest.NumberQuestions; i++)
            {
                OjQuestion Item = Datatable[random[i]];
                UCQuestion UcQ  = new UCQuestion();

                UcQ.Location    = new Point(0, height);
                UcQ.Number      = number;
                UcQ.Question1   = Item.Question1;
                UcQ.A1          = Item.A1;
                UcQ.B1          = Item.B1;
                UcQ.C1          = Item.C1;
                UcQ.D1          = Item.D1;
                UcQ.AnswerTrue1 = Item.AnswerTrue1.Trim();
                pnlQuestions.Controls.Add(UcQ);

                height += 277;
                number += 1;
            }

            this.Enabled = true;
        }