//通过Label控件显示设计题题目
    public static void ShowQuestionDesign(DesignHigh d, Label lblD, Label lblS1, Label lblS2, RadioButtonList rdoListS1, RadioButtonList rdoListS2)
    {
        lblD.Text = d.question.ToString();

        lblS1.Text = d.Q1.ToString();

        rdoListS1.Items[0].Text = "A." + d.A1;
        rdoListS1.Items[1].Text = "B." + d.B1;
        rdoListS1.Items[2].Text = "C." + d.C1;
        rdoListS1.Items[3].Text = "D." + d.D1;

        rdoListS1.Items[0].Value = "A";
        rdoListS1.Items[1].Value = "B";
        rdoListS1.Items[2].Value = "C";
        rdoListS1.Items[3].Value = "D";

        lblS2.Text = d.Q2.ToString();

        rdoListS2.Items[0].Text = "A." + d.A2;
        rdoListS2.Items[1].Text = "B." + d.B2;
        rdoListS2.Items[2].Text = "C." + d.C2;
        rdoListS2.Items[3].Text = "D." + d.D2;

        rdoListS2.Items[0].Value = "A";
        rdoListS2.Items[1].Value = "B";
        rdoListS2.Items[2].Value = "C";
        rdoListS2.Items[3].Value = "D";
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        DesignHigh updateQuestion = new DesignHigh();

        //将所用更新数据与不可更改数据存放于一个新实例中
        updateQuestion.Id         = int.Parse(Id);
        updateQuestion.question   = txtQuestion.Text;
        updateQuestion.answer     = txtAnswer.Text;
        updateQuestion.Q1         = txtQ1.Text;
        updateQuestion.A1         = txtQ1A.Text;
        updateQuestion.B1         = txtQ1B.Text;
        updateQuestion.C1         = txtQ1C.Text;
        updateQuestion.D1         = txtQ1D.Text;
        updateQuestion.answer1    = txtQ1Answer.Text;
        updateQuestion.Q2         = txtQ2.Text;
        updateQuestion.A2         = txtQ2A.Text;
        updateQuestion.B2         = txtQ2B.Text;
        updateQuestion.C2         = txtQ2C.Text;
        updateQuestion.D2         = txtQ2D.Text;
        updateQuestion.answer2    = txtQ2Answer.Text;
        updateQuestion.suggestion = Convert.ToInt32(txtSuggestion.Text);

        //调用UpdateUser方法,实现数据库中的数据更新
        int n = QuestionChangeManager.UpdateDesignQuestion(updateQuestion, j);

        //提示更改的数据行数
        if (n > 0)
        {
            //Response.Write(string.Format("<script type = 'text/javascript'> alert('成功更新数据,有{0}行收到更新!'); </script>", n.ToString()));
            RegisterClientScriptBlock("", string.Format("<script type = 'text/javascript'> alert('成功更新数据,有{0}行收到更新!'); </script>", n.ToString()));
        }
        //数据更改后,再次绑定并显示更新后的数据
        GridView1.DataSource = Manage.ShowData(j);
        GridView1.DataBind();
    }
    //设计题分数计算
    public static int designScore(DesignHigh d, RadioButtonList rdolist1, RadioButtonList rdolist2)
    {
        int score = 0;

        if (rdolist1.SelectedValue == d.answer1)
        {
            score += 15;
        }
        if (rdolist2.SelectedValue == d.answer2)
        {
            score += 15;
        }
        return(score);
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        //将注册信息存入数据库
        string question   = txtQuestion.Text;
        string answer     = txtAnswer.Text;
        string Q1         = txtQ1.Text;
        string A1         = txtQ1A.Text;
        string B1         = txtQ1B.Text;
        string C1         = txtQ1C.Text;
        string D1         = txtQ1D.Text;
        string answer1    = txtQ1Answer.Text;
        string Q2         = txtQ2.Text;
        string A2         = txtQ2A.Text;
        string B2         = txtQ2B.Text;
        string C2         = txtQ2C.Text;
        string D2         = txtQ2D.Text;
        string answer2    = txtQ2Answer.Text;
        int    suggestion = Convert.ToInt32(txtSuggestion.Text);


        DesignHigh newquestion = new DesignHigh(question, answer, suggestion, Q1, A1, B1, C1, D1, answer1, Q2, A2, B2, C2, D2, answer2);
        //调用AddUser方法,添加新用户信息
        int n = QuestionChangeManager.AddDesignQuestion(newquestion, j);

        //提示添加数据行,并清空textBox
        if (n > 0)
        {
            Response.Write(string.Format("<script type = 'text/javascript'> alert('成功添加数据,有{0}行数据已添加!'); </script>", n.ToString()));
            txtQuestion.Text   = "";
            txtAnswer.Text     = "";
            txtQ1.Text         = "";
            txtQ1A.Text        = "";
            txtQ1B.Text        = "";
            txtQ1C.Text        = "";
            txtQ1D.Text        = "";
            txtQ1Answer.Text   = "";
            txtQ2.Text         = "";
            txtQ2A.Text        = "";
            txtQ2B.Text        = "";
            txtQ2C.Text        = "";
            txtQ2D.Text        = "";
            txtQ2Answer.Text   = "";
            txtSuggestion.Text = "";
        }

        //数据更改后,再次绑定并显示更新后的数据
        GridView1.DataSource = Manage.ShowData(j);
        GridView1.DataBind();
    }
    /// <summary>
    /// 从数据库中获取高级设计题记录
    /// </summary>
    public static DesignHigh GetDesign(int Id)
    {
        SQLHelper dbAccess = new SQLHelper();           //实例化一个SQLHelper类

        string sql = "Select * from [DesignHigh] where Id = @Id";

        SqlParameter[] para = { new SqlParameter("@Id", Id) };   //利用参数para进行动态定义
        SqlDataReader  dr   = dbAccess.GetDRWithPara(sql, para); //获取查询数据流

        //根据查询得到的数据,对成员赋值
        //数据流中是否有数据
        if (dr.Read())
        {
            DesignHigh d = new DesignHigh();
            d.Id         = int.Parse(dr["Id"].ToString());
            d.question   = dr["question"].ToString();
            d.answer     = dr["answer"].ToString();
            d.suggestion = int.Parse(dr["suggestion"].ToString());
            d.Q1         = dr["Q1"].ToString();
            d.A1         = dr["A1"].ToString();
            d.B1         = dr["B1"].ToString();
            d.C1         = dr["C1"].ToString();
            d.D1         = dr["D1"].ToString();
            d.answer1    = dr["answer1"].ToString().Trim();
            d.Q2         = dr["Q2"].ToString();
            d.A2         = dr["A2"].ToString();
            d.B2         = dr["B2"].ToString();
            d.C2         = dr["C2"].ToString();
            d.D2         = dr["D2"].ToString();
            d.answer2    = dr["answer2"].ToString().Trim();

            //关闭SqlDataReader对象,此时连接同时关闭
            dr.Close();
            return(d);
        }
        else
        {
            dr.Close();
            return(null);
        }
    }
    //获取设计题数据
    public static DesignHigh GetDesignQuestion(string Id, string tablename)
    {
        SQLHelper dbAccess = new SQLHelper();    //实例化一个SQLHelper类
        string    sql      = "Select * from [" + tablename + "] where Id = @Id";

        SqlParameter[] para = { new SqlParameter("@Id", Id) };   //利用参数para进行动态定义
        SqlDataReader  dr   = dbAccess.GetDRWithPara(sql, para); //获取查询数据流

        //根据查询得到的数据,对成员赋值
        //数据流中是否有数据
        if (dr.Read())
        {
            //声明User对象,将数据流中的值赋给User对象
            DesignHigh Question = new DesignHigh();
            Question.Id         = int.Parse(dr["Id"].ToString());
            Question.question   = dr["question"].ToString();
            Question.answer     = dr["answer"].ToString();
            Question.suggestion = int.Parse(dr["suggestion"].ToString());
            Question.Q1         = dr["Q1"].ToString();
            Question.A1         = dr["A1"].ToString();
            Question.B1         = dr["B1"].ToString();
            Question.C1         = dr["C1"].ToString();
            Question.D1         = dr["D1"].ToString();
            Question.answer1    = dr["answer1"].ToString();
            Question.Q2         = dr["Q2"].ToString();
            Question.A2         = dr["A2"].ToString();
            Question.B2         = dr["B2"].ToString();
            Question.C2         = dr["C2"].ToString();
            Question.D2         = dr["D2"].ToString();
            Question.answer2    = dr["answer2"].ToString();
            //关闭SqlDataReader对象,此时连接同时关闭
            dr.Close();
            return(Question);
        }
        else
        {
            dr.Close();
            return(null);
        }
    }
    //添加设计题数据
    public static int AddDesignQuestion(DesignHigh Question, string tablename)
    {
        SQLHelper dbAccess = new SQLHelper();    //实例化一个SQLHelp类
        string    sql      = "Insert Into [" + tablename + "] Values("
                             + "'" + Question.question + "',"
                             + "'" + Question.answer + "',"
                             + "'" + Question.suggestion + "',"
                             + "'" + Question.Q1 + "',"
                             + "'" + Question.A1 + "',"
                             + "'" + Question.B1 + "',"
                             + "'" + Question.C1 + "',"
                             + "'" + Question.D1 + "',"
                             + "'" + Question.answer1 + "',"
                             + "'" + Question.Q2 + "',"
                             + "'" + Question.A2 + "',"
                             + "'" + Question.B2 + "',"
                             + "'" + Question.C2 + "',"
                             + "'" + Question.D2 + "',"
                             + "'" + Question.answer2 + "')";

        return(dbAccess.doSql(sql));    //利用SQLHelp类的doSql方法增加用户,执行一条SQL语句,返回受影响的行数
    }
    //更新设计题数据
    public static int UpdateDesignQuestion(DesignHigh Question, string tablename)
    {
        SQLHelper dbAccess = new SQLHelper();    //实例化一个SQLHelp类
        string    sql      = "Update [" + tablename + "] Set question='";

        sql += Question.question + "',answer='";
        sql += Question.answer + "',suggestion='";
        sql += Question.suggestion + "',Q1='";
        sql += Question.Q1 + "',A1='";
        sql += Question.A1 + "',B1='";
        sql += Question.B1 + "',C1='";
        sql += Question.C1 + "',D1='";
        sql += Question.D1 + "',answer1='";
        sql += Question.answer1 + "',Q2='";
        sql += Question.Q2 + "',A2='";
        sql += Question.A2 + "',B2='";
        sql += Question.B2 + "',C2='";
        sql += Question.C2 + "',D2='";
        sql += Question.D2 + "',answer2='";
        sql += Question.answer2 + "' where Id=" + Question.Id;
        return(dbAccess.doSql(sql));    //利用SQLHelp类的doSql方法增加用户,执行一条SQL语句,返回受影响的行数
    }
    //选择数据,并在textBox框中显示
    protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        Id = GridView1.Rows[e.NewSelectedIndex].Cells[2].Text;
        DesignHigh question = new DesignHigh();

        question = QuestionChangeManager.GetDesignQuestion(Id, j);  //通过GetUser方法的userid索引,获取用户数据

        //用户数据显示
        txtQuestion.Text   = question.question;
        txtAnswer.Text     = question.answer;
        txtSuggestion.Text = Convert.ToString(question.suggestion);
        txtQ1.Text         = question.Q1;
        txtQ1Answer.Text   = question.answer1;
        txtQ1A.Text        = question.A1;
        txtQ1B.Text        = question.B1;
        txtQ1C.Text        = question.C1;
        txtQ1D.Text        = question.D1;
        txtQ2.Text         = question.Q2;
        txtQ2Answer.Text   = question.answer2;
        txtQ2A.Text        = question.A2;
        txtQ2B.Text        = question.B2;
        txtQ2C.Text        = question.C2;
        txtQ2D.Text        = question.D2;
    }
 public static void JudgingDesign(DesignHigh d, Button btnanswer)
 {
     btnanswer.Visible = true;
 }
    //设计题的单选题判定
    public static bool JudgingDesignRadio(RadioButtonList rdolistS1, RadioButtonList rdolistS2, DesignHigh d, Label lblS1, Label lblS2)
    {
        bool correct1, correct2;

        if (rdolistS1.SelectedValue == d.answer1)
        {
            lblS1.Text = "恭喜你答对了!";
            correct1   = true;
        }
        else
        {
            lblS1.Text = "错误!正确答案:" + d.answer1;
            correct1   = false;
        }

        if (rdolistS2.SelectedValue == d.answer2)
        {
            lblS2.Text = "恭喜你答对了!";
            correct2   = true;
        }
        else
        {
            lblS2.Text = "错误!正确答案:" + d.answer2;
            correct2   = false;
        }
        return(correct1 && correct2);
    }
 public static void ShowQuestionDesign2(DesignHigh d, Label lblD)
 {
     lblD.Text = d.question.ToString();
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["stuId"] != null)
            {
                //随机出题
                long   tick  = DateTime.Now.Ticks;
                Random ran   = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
                int    iDown = 1;
                int    iUp   = TestHighManager.CountRadio();
                int[]  n     = new int[5];
                while (true)
                {
                    int i = 0;
                    n[0] = ran.Next(iDown, iUp);
                    n[1] = ran.Next(iDown, iUp);
                    n[2] = ran.Next(iDown, iUp);
                    n[3] = ran.Next(iDown, iUp);
                    n[4] = ran.Next(iDown, iUp);
                    if (n[0] != n[1] && n[0] != n[2] && n[0] != n[3] && n[0] != n[4] && n[1] != n[2] && n[1] != n[3] && n[1] != n[4] && n[2] != n[3] && n[2] != n[4] && n[3] != n[4])
                    {
                        i = 4;
                    }
                    if (i == 4)
                    {
                        break;
                    }
                }
                r1 = TestHighManager.GetRadio(n[0]);
                TestHighManager.ShowQuestionRadio(r1, rdolistS1, lblS1);
                r2 = TestHighManager.GetRadio(n[1]);
                TestHighManager.ShowQuestionRadio(r2, rdolistS2, lblS2);
                r3 = TestHighManager.GetRadio(n[2]);
                TestHighManager.ShowQuestionRadio(r3, rdolistS3, lblS3);
                r4 = TestHighManager.GetRadio(n[3]);
                TestHighManager.ShowQuestionRadio(r4, rdolistS4, lblS4);
                r5 = TestHighManager.GetRadio(n[4]);
                TestHighManager.ShowQuestionRadio(r5, rdolistS5, lblS5);

                //随机出题
                int   iUp1 = TestHighManager.CountJudge();
                int[] j    = new int[4];
                while (true)
                {
                    int i = 0;
                    j[0] = ran.Next(iDown, iUp1);
                    j[1] = ran.Next(iDown, iUp1);
                    j[2] = ran.Next(iDown, iUp1);
                    j[3] = ran.Next(iDown, iUp1);
                    if (j[0] != j[1] && j[0] != j[2] && j[0] != j[3] && j[1] != j[2] && j[1] != j[3] && j[2] != j[3])
                    {
                        i = 3;
                    }
                    if (i == 3)
                    {
                        break;
                    }
                }

                j1 = TestHighManager.GetJudge(j[0]);
                TestHighManager.ShowQuestionJudge(j1, rdolistJ1, lblJ1);
                j2 = TestHighManager.GetJudge(j[1]);
                TestHighManager.ShowQuestionJudge(j2, rdolistJ2, lblJ2);
                j3 = TestHighManager.GetJudge(j[2]);
                TestHighManager.ShowQuestionJudge(j3, rdolistJ3, lblJ3);
                j4 = TestHighManager.GetJudge(j[3]);
                TestHighManager.ShowQuestionJudge(j4, rdolistJ4, lblJ4);

                //随机出题
                int   iUp2 = TestHighManager.CountBlank();
                int[] k    = new int[3];
                while (true)
                {
                    int i = 0;
                    k[0] = ran.Next(iDown, iUp2);
                    k[1] = ran.Next(iDown, iUp2);
                    k[2] = ran.Next(iDown, iUp2);
                    if (k[0] != k[1] && k[0] != k[2] && k[1] != k[2])
                    {
                        i = 2;
                    }
                    if (i == 2)
                    {
                        break;
                    }
                }

                b1 = TestHighManager.GetBlank(k[0]);
                TestHighManager.ShowQuestionBlank(b1, lblB1, lblB12);
                b2 = TestHighManager.GetBlank(k[1]);
                TestHighManager.ShowQuestionBlank(b2, lblB2, lblB22);
                b3 = TestHighManager.GetBlank(k[2]);
                TestHighManager.ShowQuestionBlank(b3, lblB3, lblB32);

                //随机出题
                int   iUp3 = TestHighManager.CountDesign();
                int[] m    = new int[2];
                m[0] = ran.Next(iDown, iUp3);

                d1 = TestHighManager.GetDesign(m[0]);
                TestHighManager.ShowQuestionDesign2(d1, lblD1);
            }
            else
            {
                Response.Redirect("Login.aspx");
            }
        }
    }
    //static StudentInfo stuNew2 = new StudentInfo();
    //int[] rr = new int[6];  //用于存放错题的学习建议,有1~5中类型,数字长度选6

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)    //防止点保存后,页面再一次刷新,和验证码一样
        {
            if (Session["stuId"] != null)
            {
                //String Msg;
                int    score1 = 0;
                int    score2 = 0;
                int    score3 = 0;
                int    score4 = 0;
                string stuId  = Session["stuId"].ToString();

                stuNews1 = ClassUnitManager.GetStudyingInform(stuId);
                score1   = stuNews1.pretest;
                score2   = stuNews1.low;
                score3   = stuNews1.mid;
                score4   = stuNews1.high;

                if (int.Parse(Request.QueryString["caid"].ToString().Trim()) == 1) //不是第一次做题,读取断点
                {
                    BreakingPointRadio bpr = new BreakingPointRadio();
                    bpr = BreakingPointManager.LoadBreakingPointRadio(Session["stuId"].ToString());

                    r1 = TestHighManager.GetRadio(bpr.r1);
                    TestHighManager.ShowQuestionRadio(r1, rdolistS1, lblS1);
                    r2 = TestHighManager.GetRadio(bpr.r2);
                    TestHighManager.ShowQuestionRadio(r2, rdolistS2, lblS2);
                    r3 = TestHighManager.GetRadio(bpr.r3);
                    TestHighManager.ShowQuestionRadio(r3, rdolistS3, lblS3);
                    r4 = TestHighManager.GetRadio(bpr.r4);
                    TestHighManager.ShowQuestionRadio(r4, rdolistS4, lblS4);
                    r5 = TestHighManager.GetRadio(bpr.r5);
                    TestHighManager.ShowQuestionRadio(r5, rdolistS5, lblS5);

                    BreakingPointJudge bpj = new BreakingPointJudge();
                    bpj = BreakingPointManager.LoadBreakingPointJudge(Session["stuId"].ToString());

                    j1 = TestHighManager.GetJudge(bpj.j1);
                    TestHighManager.ShowQuestionJudge(j1, rdolistJ1, lblJ1);
                    j2 = TestHighManager.GetJudge(bpj.j2);
                    TestHighManager.ShowQuestionJudge(j2, rdolistJ2, lblJ2);
                    j3 = TestHighManager.GetJudge(bpj.j3);
                    TestHighManager.ShowQuestionJudge(j3, rdolistJ3, lblJ3);
                    j4 = TestHighManager.GetJudge(bpj.j4);
                    TestHighManager.ShowQuestionJudge(j4, rdolistJ4, lblJ4);

                    BreakingPointBlank bpb = new BreakingPointBlank();
                    bpb = BreakingPointManager.LoadBreakingPointBlank(Session["stuId"].ToString());

                    b1 = TestHighManager.GetBlank(bpb.b1);
                    TestHighManager.ShowQuestionBlank(b1, lblB1, lblB12);
                    b2 = TestHighManager.GetBlank(bpb.b2);
                    TestHighManager.ShowQuestionBlank(b2, lblB2, lblB22);
                    b3 = TestHighManager.GetBlank(bpb.b3);
                    TestHighManager.ShowQuestionBlank(b3, lblB3, lblB32);

                    BreakingPointDesign bpd = new BreakingPointDesign();
                    bpd = BreakingPointManager.LoadBreakingPointDesign(Session["stuId"].ToString());

                    d1 = TestHighManager.GetDesign(bpd.d1);
                    TestHighManager.ShowQuestionDesign(d1, lblD1, lblD1S1, lblD1S2, rdolistD1S1, rdolistD1S2);

                    TestHighManager.ShowRadioBreakingpoint(bpr, rdolistS1, rdolistS2, rdolistS3, rdolistS4, rdolistS5);
                    TestHighManager.ShowJudgeBreakingpoint(bpj, rdolistJ1, rdolistJ2, rdolistJ3, rdolistJ4);
                    TestHighManager.ShowBlankBreakingpoint(bpb, txtB11, txtB21, txtB31);
                }
                else if (int.Parse(Request.QueryString["caid"].ToString().Trim()) == 0)
                {
                    if (score1 >= 90 || score3 >= 60)
                    {
                        //随机出题(加入错题的权重,原先的题号不变,多余的错题作为普通题目放到最后进行随机)

                        long   tick  = DateTime.Now.Ticks;
                        Random ran   = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
                        int    iDown = 1;
                        int    iUp   = TestHighManager.CountRadio();
                        int[]  rr    = new int[iUp + 1];
                        for (int mn = 1; mn <= TestHighManager.CountRadio(); mn++)
                        {
                            rr[mn] = WrongRadioManager.WrongRadionum(Session["stuId"].ToString(), mn, "High", "WrongRadio");
                            iUp    = iUp + rr[mn];
                        }

                        int[] n = new int[5];
                        while (true)
                        {
                            int i;
                            n[0] = ran.Next(iDown, iUp);
                            n[1] = ran.Next(iDown, iUp);
                            n[2] = ran.Next(iDown, iUp);
                            n[3] = ran.Next(iDown, iUp);
                            n[4] = ran.Next(iDown, iUp);

                            //对随机选出的5个数重映射题号
                            for (i = 0; i <= 4; i++)
                            {
                                if (n[i] > TestHighManager.CountRadio())
                                {
                                    int temp;
                                    temp = n[i] - TestHighManager.CountRadio();
                                    int p;
                                    for (p = 1; p <= TestHighManager.CountRadio(); p++)
                                    {
                                        temp = temp - rr[p];
                                        if (temp <= 0)
                                        {
                                            break;
                                        }
                                    }
                                    n[i] = p;
                                }
                            }

                            if (n[0] != n[1] && n[0] != n[2] && n[0] != n[3] && n[0] != n[4] && n[1] != n[2] && n[1] != n[3] && n[1] != n[4] && n[2] != n[3] && n[2] != n[4] && n[3] != n[4])
                            {
                                i = 4;
                            }
                            if (i == 4)
                            {
                                break;
                            }
                        }
                        r1 = TestHighManager.GetRadio(n[0]);
                        TestHighManager.ShowQuestionRadio(r1, rdolistS1, lblS1);
                        r2 = TestHighManager.GetRadio(n[1]);
                        TestHighManager.ShowQuestionRadio(r2, rdolistS2, lblS2);
                        r3 = TestHighManager.GetRadio(n[2]);
                        TestHighManager.ShowQuestionRadio(r3, rdolistS3, lblS3);
                        r4 = TestHighManager.GetRadio(n[3]);
                        TestHighManager.ShowQuestionRadio(r4, rdolistS4, lblS4);
                        r5 = TestHighManager.GetRadio(n[4]);
                        TestHighManager.ShowQuestionRadio(r5, rdolistS5, lblS5);


                        //随机出题
                        int   iUp1 = TestHighManager.CountJudge();
                        int[] jj   = new int[iUp1 + 1];
                        for (int mn = 1; mn <= TestHighManager.CountJudge(); mn++)
                        {
                            jj[mn] = WrongRadioManager.WrongRadionum(Session["stuId"].ToString(), mn, "High", "WrongJudge");
                            iUp1   = iUp1 + jj[mn];
                        }
                        int[] j = new int[4];
                        while (true)
                        {
                            int i;
                            j[0] = ran.Next(iDown, iUp1);
                            j[1] = ran.Next(iDown, iUp1);
                            j[2] = ran.Next(iDown, iUp1);
                            j[3] = ran.Next(iDown, iUp1);

                            //对随机选出的4个数重映射题号
                            for (i = 0; i <= 3; i++)
                            {
                                if (j[i] > TestHighManager.CountJudge())
                                {
                                    int temp;
                                    temp = j[i] - TestHighManager.CountJudge();
                                    int p;
                                    for (p = 1; p <= TestHighManager.CountJudge(); p++)
                                    {
                                        temp = temp - jj[p];
                                        if (temp <= 0)
                                        {
                                            break;
                                        }
                                    }
                                    j[i] = p;
                                }
                            }

                            if (j[0] != j[1] && j[0] != j[2] && j[0] != j[3] && j[1] != j[2] && j[1] != j[3] && j[2] != j[3])
                            {
                                i = 3;
                            }
                            if (i == 3)
                            {
                                break;
                            }
                        }

                        j1 = TestHighManager.GetJudge(j[0]);
                        TestHighManager.ShowQuestionJudge(j1, rdolistJ1, lblJ1);
                        j2 = TestHighManager.GetJudge(j[1]);
                        TestHighManager.ShowQuestionJudge(j2, rdolistJ2, lblJ2);
                        j3 = TestHighManager.GetJudge(j[2]);
                        TestHighManager.ShowQuestionJudge(j3, rdolistJ3, lblJ3);
                        j4 = TestHighManager.GetJudge(j[3]);
                        TestHighManager.ShowQuestionJudge(j4, rdolistJ4, lblJ4);

                        //随机出题
                        int   iUp2 = TestHighManager.CountBlank();
                        int[] kk   = new int[iUp2 + 1];
                        for (int mn = 1; mn <= TestHighManager.CountBlank(); mn++)
                        {
                            kk[mn] = WrongRadioManager.WrongRadionum(Session["stuId"].ToString(), mn, "High", "WrongBlank");
                            iUp2   = iUp2 + kk[mn];
                        }
                        int[] k = new int[3];
                        while (true)
                        {
                            int i;
                            k[0] = ran.Next(iDown, iUp2);
                            k[1] = ran.Next(iDown, iUp2);
                            k[2] = ran.Next(iDown, iUp2);

                            //对随机选出的3个数重映射题号
                            for (i = 0; i <= 2; i++)
                            {
                                if (k[i] > TestHighManager.CountBlank())
                                {
                                    int temp;
                                    temp = k[i] - TestHighManager.CountBlank();
                                    int p;
                                    for (p = 1; p <= TestHighManager.CountBlank(); p++)
                                    {
                                        temp = temp - kk[p];
                                        if (temp <= 0)
                                        {
                                            break;
                                        }
                                    }
                                    k[i] = p;
                                }
                            }
                            if (k[0] != k[1] && k[0] != k[2] && k[1] != k[2])
                            {
                                i = 2;
                            }
                            if (i == 2)
                            {
                                break;
                            }
                        }

                        b1 = TestHighManager.GetBlank(k[0]);
                        TestHighManager.ShowQuestionBlank(b1, lblB1, lblB12);
                        b2 = TestHighManager.GetBlank(k[1]);
                        TestHighManager.ShowQuestionBlank(b2, lblB2, lblB22);
                        b3 = TestHighManager.GetBlank(k[2]);
                        TestHighManager.ShowQuestionBlank(b3, lblB3, lblB32);


                        //随机出题
                        int   iUp3 = TestHighManager.CountDesign();
                        int[] m    = new int[2];
                        m[0] = ran.Next(iDown, iUp3);
                        d1   = TestHighManager.GetDesign(m[0]);
                        TestHighManager.ShowQuestionDesign(d1, lblD1, lblD1S1, lblD1S2, rdolistD1S1, rdolistD1S2);
                    }

                    else
                    {
                        lblTitle.Visible    = false;
                        PanelAll.Visible    = false;
                        PanelDesign.Visible = false;
                        btnSubmit.Visible   = false;
                        btnOk.Visible       = false;
                        btnSave.Visible     = false;
                        //Response.Write("<script type = 'text/javascript'> alert('你未通过低等级测试,不能进行该等级测试!'); </script>");
                        RegisterClientScriptBlock("", "<script>alert('你未通过前测或低等级测试,不能进行高级测试!')</script>");
                    }
                }
            }
            else
            {
                Response.Redirect("Login.aspx");
            }
        }
    }