Пример #1
0
        private void BindData()
        {
            #region 组装查询条件
            string whereStr  = " from_id = " + (int)EnumCollection.resource_from.精品微课 + " and is_del = 1 ";
            string _keywords = keywords.Replace("'", "");

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

            #endregion

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.common_resource bll = new BLL.common_resource();
            this.rptList.DataSource = bll.GetListByPage("*", "View_ChapterResource", whereStr, " sort asc ", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("resource_back.aspx", "keywords={0}&page={1}", this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Пример #2
0
        private void GetCourseResource()
        {
            int    type     = RequestHelper.GetFormInt("type");
            string keywords = RequestHelper.GetFormString("keywords");
            int    page     = RequestHelper.GetFormInt("pageIndex", 1);
            int    pageSize = RequestHelper.GetFormInt("pageSize", 10);

            Utils.WriteCookie("manager_page_size", "AppoaPage", pageSize.ToString(), 14400);

            #region 组装查询条件
            string whereStr  = " from_id = " + (int)EnumCollection.resource_from.精品微课 + " and is_del = 0 and type = " + type;
            string _keywords = keywords.Replace("'", "");

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

            #endregion

            BLL.common_resource bll = new BLL.common_resource();
            DataTable           dt  = bll.GetListByPage("*", "View_ChapterResource", whereStr, " sort asc ", page, pageSize);

            int totalCount = bll.GetRecordCount("View_ChapterResource", whereStr);

            int pageCount = 0;
            if (totalCount % pageSize == 0)
            {
                pageCount = (int)(totalCount / pageSize);
            }
            else
            {
                pageCount = ((int)(totalCount / pageSize)) + 1;
            }

            var obj = new
            {
                DataList   = dt,
                TotalCount = totalCount,
                PageCount  = pageCount
            };

            writeMsgSuccess("", new List <object>()
            {
                obj
            });
        }
        private void BindData()
        {
            #region 组装查询条件

            if (this.class_id > 0)
            {
                this.ddlClass.SelectedValue = this.class_id + "";
            }
            else
            {
                this.class_id = Convert.ToInt32(this.ddlClass.SelectedValue);
            }

            string whereStr  = " from_id = " + (int)EnumCollection.resource_from.课堂 + " and is_del = 0 and type = " + (int)EnumCollection.resource_type.图文资源 + " and data_id = " + this.class_id;
            string _keywords = keywords.Replace("'", "");

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

            #endregion

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

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("article_list.aspx", "keywords={0}&class_id={1}&page={2}", this.keywords, this.class_id + "", "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }