Пример #1
0
        private void FullShowList()
        {
            BLL.Article bllarticle = new BLL.Article();
            int         rowcount, pageIndex, pageSize;

            pageIndex = 1;
            pageSize  = 15;
            string[] str     = "7".Split(',');
            int[]    typeids = new int[str.Length];
            for (int i = 0; i < str.Length; i++)
            {
                typeids[i] = Convert.ToInt32(str[i]);
            }
            DataTable     dt        = bllarticle.getPagerArticle(pageIndex, pageSize, out rowcount, typeids, "");
            int           pagecount = (rowcount + pageSize - 1) / pageSize;
            StringBuilder result    = new StringBuilder();

            foreach (DataRow dr in dt.Rows)
            {
                result.AppendFormat("<li><a href=\"javascript:showDetail({0})\" data-transition='slide'>{1}<span class=\"ui-li-count\">{2}</span></a></li>", dr["id"], dr["dbo_title"], ((DateTime)dr["dbo_ptime"]).ToString("yyyy-MM-dd"));
            }
            NewList = result.ToString();
            hidPagecount_list.Value = pagecount.ToString();
            hidPageNow_list.Value   = pageIndex.ToString();
            if (pagecount == pageIndex || pagecount == 0)
            {
                listMore.InnerHtml = "没有更多内容了";
            }
        }
Пример #2
0
        public string GetListByPage(string page)
        {
            BLL.Article bllarticle = new BLL.Article();
            int         rowcount, pageIndex, pageSize;

            pageIndex = Convert.ToInt32(page);
            pageSize  = 15;
            string[] str     = "7".Split(',');
            int[]    typeids = new int[str.Length];
            for (int i = 0; i < str.Length; i++)
            {
                typeids[i] = Convert.ToInt32(str[i]);
            }
            DataTable     dt     = bllarticle.getPagerArticle(pageIndex, pageSize, out rowcount, typeids, "");
            StringBuilder result = new StringBuilder();

            foreach (DataRow dr in dt.Rows)
            {
                result.AppendFormat("<li><a href=\"javascript:showDetail({0})\" data-transition='slide'>{1}<span class=\"ui-li-count\">{2}</span></a></li>", dr["id"], dr["dbo_title"], ((DateTime)dr["dbo_ptime"]).ToString("yyyy-MM-dd"));
            }
            return(result.ToString());
        }
Пример #3
0
        private void BindData()
        {
            string strFiter = string.Empty;

            if (ViewState["fiter"] != null)
            {
                strFiter = ViewState["fiter"].ToString();
            }



            #region 自定义分页
            int rowcount, pageIndex, pageSize;
            pageIndex = 1;
            if (ViewState["pageIndex"] != null)
            {
                pageIndex = Convert.ToInt32(ViewState["pageIndex"]);
            }
            else
            {
                ViewState["pageIndex"] = pageIndex;
            }

            pageSize = this.GridView1.PageSize;

            int[] typeids;

            if (ViewState["selectType"] == null)
            {
                if (currentAdmin.validationSpcAdmin(spcId))
                {
                    typeids = bllarticletype.getTypeIdsBySpcId(Convert.ToInt32(spcId));
                }
                else
                {
                    string   ids    = adminOpers.getChannelPower(spcId, currentAdmin.Channels);
                    string[] strids = ids.Split(',');
                    typeids = new int[strids.Length];
                    for (int i = 0; i < strids.Length; i++)
                    {
                        typeids[i] = Convert.ToInt32(strids[i]);
                    }
                }
            }
            else
            {
                typeids = new int[] { Convert.ToInt32(ViewState["selectType"]) };
            }

            if (typeids.Length == 0)
            {
                // Response.Write(sys.alertAndRedirect("", "" + ));
                Response.Write("<script type='text/javascript'>alert('专题下未创建任何文章类型,请先添加文章类型');window.location.href='typeAdd.aspx?spcId='" + spcId.ToString() + "</script>");
                pnlContent.Visible = false;
                return;
            }

            DataTable dt = bllarticle.getPagerArticle(pageIndex, pageSize, out rowcount, typeids, strFiter);
            //DataTable dt = dal.article.getPagerArticle(pageIndex, pageSize, out rowcount, strFiter, spcId);

            ShowPageNav(rowcount, pageIndex, pageSize);

            #endregion

            //没有定义分页,从数据库中查询出所有的内容,数据大的时候效率低
            //DataTable dt = dal.article.GetArticleList(strFiter, spcId);

            this.GridView1.DataSource = dt;
            this.GridView1.DataBind();
        }