Exemplo n.º 1
0
 /// <summary>
 /// 获得指定栏目内容页数
 /// </summary>
 /// <param name="_channelid">频道ID</param>
 /// <param name="_classid">栏目ID</param>
 /// <param name="_includechild">是否包含子类内容</param>
 /// <returns></returns>
 public int GetContetPageCount(string _channelid, string _classid, bool _includechild)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string _channeltype = new Normal_ChannelDAL().GetChannelType(_channelid);
         if (_channeltype.Length == 0)
         {
             return(0);
         }
         _doh.Reset();
         _doh.SqlCmd = "SELECT [PageSize],[Code] FROM [jcms_normal_class] WHERE [ChannelId]=" + _channelid + " AND [Id]=" + _classid;
         int    _pagesize  = SiteGroupCms.Utils.Validator.StrToInt(_doh.GetDataTable().Rows[0]["PageSize"].ToString(), 0);
         string _classcode = _doh.GetDataTable().Rows[0]["Code"].ToString();
         if (_pagesize == 0)
         {
             _pagesize = 20;
         }
         string _pstr = string.Empty;
         if (!_includechild)
         {
             _pstr = " [ClassID]=" + _classid + " AND [IsPass]=1 AND [ChannelId]=" + _channelid;
         }
         else
         {
             _pstr = " [ClassID] in (Select id FROM [jcms_normal_class] WHERE [Code] LIKE '" + _classcode + "%') AND [IsPass]=1 AND [ChannelId]=" + _channelid;
         }
         _doh.Reset();
         _doh.ConditionExpress = _pstr;
         int _totalcount = _doh.Count("jcms_module_" + _channeltype);
         return(SiteGroupCms.Utils.Int.PageCount(_totalcount, _pagesize));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 得到内容页地址
        /// </summary>
        /// <param name="_contentid"></param>
        /// <param name="_truefile"></param>
        /// <returns></returns>
        public string GetContentLink(string _contentid)
        {
            SiteGroupCms.Dal.Normal_ChannelDAL _ChannelDal = new Normal_ChannelDAL();
            SiteGroupCms.Dal.ArticleDal        articledal  = new ArticleDal();
            SiteGroupCms.Entity.Article        article     = articledal.GetEntity(_contentid);
            if (article.Yyarticleid.ToString() != "" && article.Yyarticleid != 0)//如果引用文章
            {
                _contentid = article.Yyarticleid.ToString();
            }
            article = articledal.GetEntity(_contentid);           //重新取引用的文章

            if (article.Linkurl != "" && article.Linkurl != null) //如果是连接文章
            // return article.Linkurl; //这个直接得到连接地址
            {
                return("/ajaxhandler/Gethits.aspx?articleid=" + article.Id); //得到可以统计点击次数的连接地址
            }
            SiteGroupCms.Entity.Normal_Channel _Channel = _ChannelDal.GetEntity(article.Catalogid.ToString());
            site = (SiteGroupCms.Entity.Site)HttpContext.Current.Session["site"];
            string qianstr   = "/sites/" + site.Location + "/pub";
            string centerstr = "";

            //检查对应的文件夹是否存在,若不存在则创建,若存在则以id为标题生成
            while (_Channel.Father != 0)//不为跟节点就继续往上走
            {
                centerstr = "/" + _Channel.Dirname + centerstr;
                _Channel  = _ChannelDal.GetEntity(_Channel.Father.ToString());
            }
            centerstr = "/" + _Channel.Dirname + centerstr + "/";
            string title = article.Addtime.Year.ToString() + article.Addtime.Month.ToString() + article.Addtime.Day.ToString() + _contentid;

            return(qianstr + centerstr + title + ".html");
        }