/*测试的几种状态:
     * 1、保存过答案,但由于某种原因又重新进行考试;
     * 2、第一次进行考试,答案全是空的
     * 3、刚刚保存了答案;保持题目原来的答案即可
     * 4、已交卷。不再显示题目及答案。
     */
    protected void Page_Load(object sender, EventArgs e)
    {
        string username  = ((FormsIdentity)HttpContext.Current.User.Identity).Ticket.Name;
        int    shijuanid = 0;

        if (Request.QueryString["shijuanid"] != null)
        {
            shijuanid = int.Parse(Request.QueryString["shijuanid"]);
        }
        else
        {
            Response.Redirect("jiaoshiceshi.aspx");
        }
        if (CeshiInfo.IsIpXianzhi(shijuanid))//如果该考试限制IP地址
        {
            SetStukaoshiIp(username, shijuanid);
            switch (CheckIp(username, shijuanid))
            {
            case 1:    //学生考试机的IP与数据库中登记的IP不一致,需要到原来考试的机器上进行考试
                ScriptManager.RegisterClientScriptBlock(this, typeof(string), "", "alert('考试过程中不允许换机器!请到您初次进行考试的电脑进行考试,或与教师联系。');", true);
                SetTimerStop();
                return;

            case 2:
                ScriptManager.RegisterClientScriptBlock(this, typeof(string), "", "alert('检测到您所在的电脑已有同学进行本次考试!请换台电脑进行考试。');", true);
                SetTimerStop();
                return;
            }
        }
        if (!IsPostBack)
        {
            XianshiTimu(int.Parse(lbl_tihao.Text));
            GetCeshiJibenInfo();
            GetStudentCeshiInfo(username, shijuanid);
        }
    }