Пример #1
0
        /// <summary>
        /// 频道页面
        /// </summary>
        public void ArticleChannelPage()
        {
            int cid = MyCommFun.RequestInt("cid");

            if (cid == 0)
            {
                var category_id = this.Document.GetChildTagById("category_id");
                if (category_id != null && category_id.Attributes["value"] != null)
                {
                    cid = MyCommFun.Obj2Int(category_id.Attributes["value"].Value.ToString());
                }
            }
            DAL.article_category   cateDal  = new DAL.article_category("dt_");
            Model.article_category category = cateDal.GetModel(cid);
            if (category != null)
            {
                this.Document.SetValue("model", category);
            }
        }
Пример #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.article_category GetModel(int id)
 {
     return(dal.GetModel(id));
 }
Пример #3
0
        /// <summary>
        /// 列表页面独有的数据
        /// </summary>
        public void ArticleClassPage()
        {
            int category_id = 0;
            int channel_id = 0;
            category_id = MyCommFun.RequestInt("cid");

            if (category_id == 0)
            {
                var categoryid = this.Document.GetChildTagById("categoryid");
                category_id = MyCommFun.Obj2Int(categoryid.Attributes["value"].Value.ToString());
            }
            var channelid = this.Document.GetChildTagById("channel_id");
            channel_id = MyCommFun.Obj2Int(channelid.Attributes["value"].Value.ToString());

            //--=====begin: 将这个列表(文章类别)的基本信息展示出来 ====--
            DAL.article_category cateDal = new DAL.article_category("dt_");
            Model.article_category category = cateDal.GetModel(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 = MyCommFun.Str2Int(pagesizeStr);//每页的记录数
            if (pageSize <= 0)
            {
                pageSize = 10;
            }
            if (MyCommFun.RequestInt("page") > 0)
            {
                currPage = MyCommFun.RequestInt("page");
            }

            DataSet artlist = new DataSet();
            if (category_id != 0)
            {

                DAL.article artDal = new DAL.article();
                artlist = artDal.GetList("hotnews", category_id, pageSize, currPage, "channel_id=" + channel_id, 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"] = "/portalpage/weixin_news_detail.aspx?id=" + dr["id"].ToString();
                        }

                        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 = "javascript:;";
                bgrey = "c-p-grey";
            }
            else
            {
                beforePageStr = MyCommFun.ChangePageNum(MyCommFun.getTotalUrl(), (currPage - 1));
                beforePageStr = "href=\"" + beforePageStr + "\"";
                bgrey = "";
            }

            if (currPage >= totPage)
            {
                nextPageStr = "javascript:;";
                ngrey = " c-p-grey";
            }
            else
            {
                nextPageStr = MyCommFun.ChangePageNum(MyCommFun.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);//下一页灰色的样式
        }
Пример #4
0
        /// <summary>
        /// 列表页面独有的数据
        /// </summary>
        public void ArticleClassPage()
        {
            int category_id = 0;
            int channel_id  = 0;

            category_id = MyCommFun.RequestInt("cid");

            if (category_id == 0)
            {
                var categoryid = this.Document.GetChildTagById("categoryid");
                category_id = MyCommFun.Obj2Int(categoryid.Attributes["value"].Value.ToString());
            }
            var channelid = this.Document.GetChildTagById("channel_id");

            channel_id = MyCommFun.Obj2Int(channelid.Attributes["value"].Value.ToString());


            //--=====begin: 将这个列表(文章类别)的基本信息展示出来 ====--
            DAL.article_category   cateDal  = new DAL.article_category("dt_");
            Model.article_category category = cateDal.GetModel(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    = MyCommFun.Str2Int(pagesizeStr); //每页的记录数

            if (pageSize <= 0)
            {
                pageSize = 10;
            }
            if (MyCommFun.RequestInt("page") > 0)
            {
                currPage = MyCommFun.RequestInt("page");
            }

            DataSet artlist = new DataSet();

            if (category_id != 0)
            {
                DAL.article artDal = new DAL.article();
                artlist = artDal.GetList("hotnews", category_id, pageSize, currPage, "channel_id=" + channel_id, 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"] = "/portalpage/weixin_news_detail.aspx?id=" + dr["id"].ToString();
                        }

                        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 = "javascript:;";
                bgrey         = "c-p-grey";
            }
            else
            {
                beforePageStr = MyCommFun.ChangePageNum(MyCommFun.getTotalUrl(), (currPage - 1));
                beforePageStr = "href=\"" + beforePageStr + "\"";
                bgrey         = "";
            }

            if (currPage >= totPage)
            {
                nextPageStr = "javascript:;";
                ngrey       = " c-p-grey";
            }
            else
            {
                nextPageStr = MyCommFun.ChangePageNum(MyCommFun.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);         //下一页灰色的样式
        }
Пример #5
0
 /// <summary>
 /// 频道页面
 /// </summary>
 public void ArticleChannelPage()
 {
     int cid = MyCommFun.RequestInt("cid");
     if (cid == 0)
     {
         var category_id = this.Document.GetChildTagById("category_id");
         if (category_id != null && category_id.Attributes["value"] != null)
         {
             cid = MyCommFun.Obj2Int(category_id.Attributes["value"].Value.ToString());
         }
     }
     DAL.article_category cateDal = new DAL.article_category("dt_");
     Model.article_category category = cateDal.GetModel(cid);
     if (category != null)
     {
         this.Document.SetValue("model", category);
     }
 }