/// <summary> /// 列表页面独有的数据 /// </summary> public void ArticleClassPage() { int category_id = Globals.RequestQueryNum("cid"); //--=====begin: 将这个列表(文章类别)的基本信息展示出来 ====-- //Model.article_category category = tDal.GetCategoryByWid(wid, category_id); //this.Document.SetValue("category", category); //--=====end: 将这个列表(文章类别)的基本信息展示出来 ====-- Tag orderByTag = this.Document.GetChildTagById("norderby"); string orderby = orderByTag.Attributes["value"].Value.ToString(); Tag pagesizeTag = this.Document.GetChildTagById("npagesize"); string pagesizeStr = pagesizeTag.Attributes["value"].Value.ToString(); int currPage = 1; //当前页面 int recordCount = 0; //总记录数 int totPage = 1; //总页数 int pageSize = SFUtils.StrToInt(pagesizeStr, 10); //每页的记录数 if (pageSize <= 0) { pageSize = 10; } if (Globals.RequestQueryNum("page") > 0) { currPage = Globals.RequestQueryNum("page"); } DataSet artlist = new DataSet(); if (category_id != 0) { Chenduo.DAL.article artDal = new Chenduo.DAL.article(); artlist = artDal.GetList("news", category_id, pageSize, currPage, "wid=" + wid, orderby, out recordCount); if (artlist != null && artlist.Tables.Count > 0 && artlist.Tables[0].Rows.Count > 0) { DataRow dr; for (int i = 0; i < artlist.Tables[0].Rows.Count; i++) { dr = artlist.Tables[0].Rows[i]; if (dr["link_url"] != null && dr["link_url"].ToString().Trim().Length > 0) { //dr["link_url"] = MyCommFun.urlAddOpenid(dr["link_url"].ToString().Trim(), openid); } else { //dr["link_url"] = MyCommFun.urlAddOpenid("detail.aspx?wid=" + wid + "&aid=" + dr["id"].ToString(), openid); } artlist.AcceptChanges(); } totPage = recordCount / pageSize; int yushu = recordCount % pageSize; if (yushu > 0) { totPage += 1; } if (totPage < 1) { totPage = 1; } } if (currPage > totPage) { currPage = totPage; } } else { currPage = 1; recordCount = 0; totPage = 1; } this.Document.SetValue("totPage", totPage); //总页数 this.Document.SetValue("currPage", currPage); //当前页 this.Document.SetValue("newslist", artlist); //文章列表 string beforePageStr = ""; //上一页 string nextPageStr = ""; //下一页 string bgrey = "c-p-grey"; string ngrey = "c-p-grey"; if (currPage <= 1) { beforePageStr = ""; bgrey = "c-p-grey"; } else { beforePageStr = SFUtils.ChangePageNum(SFUtils.getTotalUrl(), (currPage - 1)); beforePageStr = "href=\"" + beforePageStr + "\""; bgrey = ""; } if (currPage >= totPage) { nextPageStr = ""; ngrey = " c-p-grey"; } else { nextPageStr = SFUtils.ChangePageNum(SFUtils.getTotalUrl(), (currPage + 1)); nextPageStr = "href=\"" + nextPageStr + "\""; ngrey = ""; } this.Document.SetValue("bpage", beforePageStr); //上一页 this.Document.SetValue("npage", nextPageStr); //下一页 this.Document.SetValue("bgrey", bgrey); //上一页灰色的样式 this.Document.SetValue("ngrey", ngrey); //下一页灰色的样式 }