Пример #1
0
        private void BindData()
        {
            #region 组装查询条件
            string whereStr  = " 1 = 1 ";
            string _keywords = keywords.Replace("'", "");

            if (!string.IsNullOrEmpty(_keywords))
            {
                if (Utils.IsSafeSqlString(_keywords))
                {
                    whereStr += " and (Title like  '%" + _keywords + "%')";
                }
                else
                {
                    JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", ""));
                    return;
                }
            }
            #endregion

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.examination_question bll = new BLL.examination_question();
            this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("Manage.aspx", "keywords={0}&page={1}", this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
        private void BindData()
        {
            this.page = RequestHelper.GetQueryInt("page", 1);

            BLL.examination_question bll = new BLL.examination_question();
            this.rptList.DataSource = bll.GetListByPage("*", "View_ExaminationQuestion", " exa_id = " + exaid, "ID DESC", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount("View_ExaminationQuestion", " exa_id = " + exaid);
            int score        = bll.GetSumCount("score", "View_ExaminationQuestion", " exa_id = " + exaid);
            int singleSelete = bll.GetRecordCount("View_ExaminationQuestion", " exa_id = " + exaid + " and type = " + (int)EnumCollection.questions_type.单选题);
            int muliteSelete = bll.GetRecordCount("View_ExaminationQuestion", " exa_id = " + exaid + " and type = " + (int)EnumCollection.questions_type.多选题);
            int istrueth     = bll.GetRecordCount("View_ExaminationQuestion", " exa_id = " + exaid + " and type = " + (int)EnumCollection.questions_type.判断题);
            int input        = bll.GetRecordCount("View_ExaminationQuestion", " exa_id = " + exaid + " and type = " + (int)EnumCollection.questions_type.填空题);
            int subjective   = bll.GetRecordCount("View_ExaminationQuestion", " exa_id = " + exaid + " and type = " + (int)EnumCollection.questions_type.主观题);

            this.lblCount.Text = string.Format("共 {0} 道题目,总分 {1} 分。其中单选题 {2} 道,多选题 {3} 道,判断题 {4} 道,填空题 {5} 道,主观题 {6} 道。",
                                               this.totalCount, score, singleSelete, muliteSelete, istrueth, input, subjective);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("selected_question.aspx", "exaid={0}&page={1}", this.exaid + "", "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }