示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Exm exam = ExamHelper.GetExam(this.ExamId);

            if (IsAnswerMode)
            {
                AnswerSheet answersheet = AnswerHelper.GetAnswerSheet(this.SubmittedUserId, this.ExamId);
                //feed submitted answers
                exam = ExamHelper.ProcessAnswers(exam, answersheet);
                divExamDetails.Visible = false;
            }

            if (exam != null)
            {
                litIstructions.Text = exam.Instructions != null ? exam.Instructions : "-";
                litTime.Text        = exam.TimeInSeconds.HasValue ? Utils.TimeString(exam.TimeInSeconds.Value) : "-";

                repQuestions.DataSource = exam.Questions;
                repQuestions.DataBind();
            }
        }
示例#2
0
        private void _SetUIAndBindData()
        {
            Exm exam = ExamHelper.GetExam(this.ExamId);

            AnswerSheet answersheet = AnswerHelper.GetAnswerSheet(this.UserId, this.ExamId);

            if (!Page.IsPostBack)
            {
                divQuestionContainer.Visible = false;
                divMessage.Visible           = false;
                divWelcome.Visible           = true;

                litIstructions.Text = exam.Instructions != null ? exam.Instructions : "-";
                litTime.Text        = exam.TimeInSeconds.HasValue ? Utils.TimeString(exam.TimeInSeconds.Value) : "-";
                return;
            }
            else if (answersheet != null && answersheet.Answers.Count == exam.Questions.Count)
            {
                divQuestionContainer.Visible = false;
                divMessage.Visible           = true;
                divWelcome.Visible           = false;

                //lblMessage.Text = "Finished!";
            }
            else if (answersheet == null || answersheet.Answers.Count < exam.Questions.Count)
            {
                divQuestionContainer.Visible = true;
                divMessage.Visible           = false;
                divWelcome.Visible           = false;
                Question question = ExamHelper.NextQuestion(exam, answersheet);
                if (question != null)
                {
                    populateQuestionUI(question);
                }
            }
        }