示例#1
0
        public void Loading()
        {
            ArrayList question_one;
            ArrayList question_more;
            ArrayList question_judge;

            question_one   = Exam_Drector.GetQuestions("questions_one", 5, 1);
            question_more  = Exam_Drector.GetQuestions("questions_more", 5, 6);
            question_judge = Exam_Drector.GetQuestions("questions_judge", 5, 11);
            Question_Save.Add("questions_one", question_one);                  // 保存题目用来比对答案,存储在哈希表中
            Question_Save.Add("questions_more", question_more);
            Question_Save.Add("questions_judge", question_judge);
            DataList_Questoin_One.DataSource = question_one;
            DataList_Questoin_One.DataBind();
            DataList_Questoin_More.DataSource = question_more;
            DataList_Questoin_More.DataBind();
            DataList_Questoin_Judge.DataSource = question_judge;
            DataList_Questoin_Judge.DataBind();
            Exam_Drector.Loading_Question(DataList_Questoin_One, question_one, "questions_one");
            Exam_Drector.Loading_Question(DataList_Questoin_More, question_more, "questions_more");
            Session["Question_Save"]        = Question_Save;
            ViewState["pre_question_one"]   = 0;
            ViewState["pre_question_more"]  = 0;
            ViewState["pre_question_judge"] = 0;
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Server.UrlDecode(Request.QueryString["examId"]) != null || Session["Question_Save"] != null)
            {
                if (Server.UrlDecode(Request.QueryString["examId"]) != null)
                {
                    string  examId  = Server.UrlDecode(Request.QueryString["examId"]);
                    Mongodb mongodb = new Mongodb();
                    mongodb.GetCollection("exam");
                    BsonDocument document = mongodb.Query("examId", examId);
                    question_one           = Exam_Drector.GetQuestionsOrChoosed(document, "question_one");
                    question_more          = Exam_Drector.GetQuestionsOrChoosed(document, "question_more");
                    question_judge         = Exam_Drector.GetQuestionsOrChoosed(document, "question_judge");
                    questions_one_chosed   = Exam_Drector.GetQuestionsOrChoosed(document, "questions_one_chosed");
                    questions_more_chosed  = Exam_Drector.GetQuestionsOrChoosed(document, "questions_more_chosed");
                    questions_judge_chosed = Exam_Drector.GetQuestionsOrChoosed(document, "questions_judge_chosed");
                    score.Text             = Request.QueryString["score"].ToString();
                }
                else if (Session["Question_Save"] != null)
                {
                    Hashtable Question_Save = (Hashtable)Session["Question_Save"];
                    question_one   = (ArrayList)Question_Save["questions_one"];
                    question_more  = (ArrayList)Question_Save["questions_more"];
                    question_judge = (ArrayList)Question_Save["questions_judge"];
                    // 获取存储用户选择的项
                    hashtable_question_one   = (Hashtable)Session["hashtable_question_one"];
                    hashtable_question_more  = (Hashtable)Session["hashtable_question_more"];
                    hashtable_question_judge = (Hashtable)Session["hashtable_question_judge"];

                    questions_one_chosed   = (ArrayList)hashtable_question_one["questions_one_chosed"];
                    questions_more_chosed  = (ArrayList)hashtable_question_more["questions_more_chosed"];
                    questions_judge_chosed = (ArrayList)hashtable_question_judge["questions_judge_chosed"];
                    score.Text             = Session["score_total"].ToString();
                }
                DataList_Questoin_One.DataSource = question_one;
                DataList_Questoin_One.DataBind();
                DataList_Questoin_More.DataSource = question_more;
                DataList_Questoin_More.DataBind();
                DataList_Questoin_Judge.DataSource = question_judge;
                DataList_Questoin_Judge.DataBind();

                Exam_Drector.Loading_Question(DataList_Questoin_One, question_one, "questions_one");
                Exam_Drector.Loading_Question(DataList_Questoin_More, question_more, "questions_more");
                Exam_Drector.Loading_Result(DataList_Questoin_One, question_one, "questions_one", questions_one_chosed);
                Exam_Drector.Loading_Result(DataList_Questoin_More, question_more, "questions_more", questions_more_chosed);
                Exam_Drector.Loading_Result(DataList_Questoin_Judge, question_judge, "questions_judge", questions_judge_chosed);

                number.Text = Session["sn"].ToString();
                name.Text   = Session["username"].ToString();
            }
            else
            {
                Response.Redirect("~/Login.aspx");
            }
        }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack)
     {
     }
     else
     {
         if (Session["sn"] != null && Session["username"] != null)
         {
             number.Text = "学号:" + Session["sn"].ToString();
             name.Text   = "姓名:" + Session["username"].ToString();
         }
         else
         {
             Response.Redirect("~/Login.aspx");
         }
         ArrayList question_one;
         ArrayList question_more;
         ArrayList question_judge;
         question_one   = Exam_Drector.GetQuestions("questions_one", 5, 1);
         question_more  = Exam_Drector.GetQuestions("questions_more", 5, 6);
         question_judge = Exam_Drector.GetQuestions("questions_judge", 5, 11);
         Question_Save.Add("questions_one", question_one);                  // 保存题目用来比对答案,存储在哈希表中
         Question_Save.Add("questions_more", question_more);
         Question_Save.Add("questions_judge", question_judge);
         DataList_Questoin_One.DataSource = question_one;
         DataList_Questoin_One.DataBind();
         DataList_Questoin_More.DataSource = question_more;
         DataList_Questoin_More.DataBind();
         DataList_Questoin_Judge.DataSource = question_judge;
         DataList_Questoin_Judge.DataBind();
         Exam_Drector.Loading_Question(DataList_Questoin_One, question_one, "questions_one");
         Exam_Drector.Loading_Question(DataList_Questoin_More, question_more, "questions_more");
         Session["Question_Save"]        = Question_Save;
         ViewState["pre_question_one"]   = 0;
         ViewState["pre_question_more"]  = 0;
         ViewState["pre_question_judge"] = 0;
     }
 }