示例#1
0
        /// <summary>
        /// DealWithStudentAnswer
        /// </summary>
        private void DealWithExamResult()
        {
            string isPassed = Constants.emptyStr;

            if (studentGetScore < FormPassValue.passCriteria)
            {
                isPassed = NOPASS;
            }
            else if (studentGetScore > FormPassValue.passCriteria)
            {
                isPassed = PASS;
            }

            // insert student grade and isPassed
            ExamService.ExamServiceClient examManager = new ExamService.ExamServiceClient();

            //if need to query grade randomly, should insert correct quantity
            examManager.InsertExanResultById(RememberSomeParameter.userId, FormPassValue.examId, studentGetScore, isPassed);

            // update dataGridView dataSource so that avoid student take exam again
            MyExam form = (this.Owner as FormExamList).GetPnlMyExam();

            form.GetAllExam().GetDgvExamList().DataSource =
                examManager.SearchExam(QueryExamState.SortColumn, QueryExamState.SortDirection, form.GetCurrentPage(),
                                       form.GetPageSize(), QueryExamState.KeywordState, RememberSomeParameter.username);
        }
示例#2
0
        //Notice content
        private void LoadExamNotice(int userId)
        {
            ExamService.ExamServiceClient examManager = new ExamService.ExamServiceClient();
            ExamDS.ExamNoticeDataTable    table       = examManager.GetExamNoticeById(userId);
            foreach (var item in table)
            {
                FlowLayoutPanel panel = new FlowLayoutPanel();
                panel.AutoSize = false;
                panel.Height   = 20;
                panel.Width    = 700;

                Label fragStart = new Label();
                fragStart.Height   = 20;
                fragStart.AutoSize = true;
                fragStart.Text     = item.No + FRAG_STR;

                Label fragExamName = new Label();
                fragExamName.Height    = 20;
                fragExamName.Width     = 30;
                fragExamName.AutoSize  = true;
                fragExamName.ForeColor = Color.FromArgb(41, 103, 147);
                fragExamName.Text      = BACKSLASH + item.exam_name + BACKSLASH;
                fragExamName.Cursor    = Cursors.Hand;
                fragExamName.Click    += (object sender, EventArgs e) =>
                {
                    FormPassValue.languageState      = Thread.CurrentThread.CurrentCulture.ToString();
                    FormPassValue.currentWindowState = this.WindowState;
                    FormPassValue.isNoticeStart      = 1;

                    ExamDescription examDescription = new ExamDescription();
                    FormPassValue.examId = item.id;
                    DialogResult result = examDescription.ShowDialog();

                    if (result == DialogResult.OK)
                    {
                        FormTakeExam formTakeExam = new FormTakeExam();
                        formTakeExam.Show(this);
                        this.Hide();
                    }
                };

                DateTime dateTime = item.effective_time;
                string   yearStr  = dateTime.Year + SHORT_LINE + dateTime.Month + SHORT_LINE + dateTime.Day;
                string   timeStr  = dateTime.Hour + COLON + (dateTime.Minute.ToString().Equals(ZERO) ? ZEROTWO : dateTime.Minute.ToString()) + DOT;

                Label fragEnd = new Label();
                fragEnd.Height   = 20;
                fragEnd.AutoSize = true;
                fragEnd.Text     = FRAGSTRTWO + yearStr + EMPTY_STR + timeStr;

                panel.Controls.Add(fragStart);
                panel.Controls.Add(fragExamName);
                panel.Controls.Add(fragEnd);

                this.pnlNoticeContent.Controls.Add(panel);
            }
        }