Пример #1
0
    protected void GVQuiz_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView theGrid      = sender as GridView; // refer to the GridView
        int      newPageIndex = 0;

        if (-2 == e.NewPageIndex)
        { // when click the "GO" Button
            TextBox txtNewPageIndex = null;

            GridViewRow pagerRow = theGrid.BottomPagerRow;

            if (null != pagerRow)
            {
                txtNewPageIndex = pagerRow.FindControl("txtNewPageIndex") as TextBox;   // refer to the TextBox with the NewPageIndex value
            }

            if (null != txtNewPageIndex)
            {
                newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex
            }
        }
        else
        {  // when click the first, last, previous and next Button
            newPageIndex = e.NewPageIndex;
        }

        // check to prevent form the NewPageIndex out of the range
        newPageIndex         = newPageIndex < 0 ? 0 : newPageIndex;
        newPageIndex         = newPageIndex >= theGrid.PageCount ? theGrid.PageCount - 1 : newPageIndex;
        theGrid.PageIndex    = newPageIndex;
        Session["pageindex"] = theGrid.PageIndex;
        ListQuiz();
        GVQuiz.DataBind();
    }
Пример #2
0
    private void ListQuiz()
    {
        int    Qtype  = DDLqtype.SelectedIndex;
        string Qclass = DDLclass.SelectedValue;

        LearnSite.BLL.Quiz bll = new LearnSite.BLL.Quiz();
        if (Qclass == "全部显示")
        {
            GVQuiz.DataSource = bll.GetListByQtype(Qtype);
        }
        else
        {
            GVQuiz.DataSource = bll.GetListByQtypeQclass(Qtype, Qclass);
        }
        if (Qtype == 2)
        {
            GVQuiz.PageSize = 20;
        }
        else
        {
            GVQuiz.PageSize = 10;
        }
        GVQuiz.AllowPaging = true;
        if (Session["pageindex"] != null)
        {
            GVQuiz.PageIndex = int.Parse(Session["pageindex"].ToString());
        }
        GVQuiz.DataBind();
        if (GVQuiz.Rows.Count == 0)
        {
            Btnexport.Visible = false;
        }
    }
Пример #3
0
    private void ListQuiz()
    {
        string Rnum   = cook.Snum;
        int    Qgrade = cook.Sgrade;
        int    Qclass = cook.Sclass;
        string myname = Server.UrlDecode(cook.Sname);

        LearnSite.BLL.QuizGrade qgbll = new LearnSite.BLL.QuizGrade();
        isanswer = qgbll.GetQanswer(Qgrade, Qclass);

        if (Request.QueryString["Rid"] != null)
        {
            int Rid = Int32.Parse(Request.QueryString["Rid"].ToString());
            LearnSite.BLL.Result   rbll   = new LearnSite.BLL.Result();
            LearnSite.Model.Result rmodel = new LearnSite.Model.Result();
            rmodel = rbll.GetModel(Rid);
            if (rmodel != null)
            {
                string mystr = rmodel.Rhistory;
                if (mystr != "")
                {
                    WrongsStr = rmodel.Rwrong.Split(',');
                    string[]           qmystr = mystr.Split(',');
                    LearnSite.BLL.Quiz bll    = new LearnSite.BLL.Quiz();
                    GVQuiz.DataSource = bll.GetListByQidArray(qmystr);
                    GVQuiz.DataBind();
                    Labeltitle.Text = " 〖" + myname + " 随机生成的" + rmodel.Rdate.Value.ToShortDateString() + "号历史记录试卷参考答案〗";
                }
            }
            //显示本次测验试卷参考答案
        }
        else
        {
            if (Session[Rnum + "quizQids"] != null)
            {
                WrongsStr = Session[Rnum + "quizWrong"].ToString().Split(',');//将错题号保存
                string[]           qstr = (string[])Session[Rnum + "quizQids"];
                LearnSite.BLL.Quiz bll  = new LearnSite.BLL.Quiz();
                GVQuiz.DataSource = bll.GetListByQidArray(qstr);
                GVQuiz.DataBind();

                // Labelmsg.Text = "所有题编号:" + Session[Rnum + "quizRightWrong"].ToString() + "<br/>正确题编号:" + Session[Rnum + "quizRight"].ToString() + "<br/>错误题编号:" + Session[Rnum + "quizWrong"].ToString();
            }
            if (Session[Rnum + "quizrnd"] != null)
            {
                Labeltitle.Text           = " 〖" + myname + " 随机生成的" + Session[Rnum + "quizrnd"].ToString() + "号试卷参考答案〗";
                Session[Rnum + "quizrnd"] = null;
            }
        }
    }