Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Server.ScriptTimeout = 8;//脚本过期时间
            int    CurrentPage = Int_ThisPage();
            string ClassId     = (this.lblClassId.Text == "{$CategoryId}") ? Str2Str(q("id")) : Str2Str(this.lblClassId.Text);
            string ModuleType  = this.lblModuleType.Text;

            doh.Reset();
            doh.SqlCmd = "SELECT ID FROM [" + base.CategoryTable + "] WHERE [Id]=" + ClassId;
            DataTable dtSearch = doh.GetDataTable();

            if (dtSearch.Rows.Count == 0)
            {
                FinalMessage("栏目不存在或已被删除!", site.Dir, 0, 8);
                Response.End();
            }
            dtSearch.Clear();
            dtSearch.Dispose();
            JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL();
            int pageCount = new JumboECMS.DAL.Normal_CategoryDAL().GetContetPageCount(ClassId, true);

            CurrentPage  = JumboECMS.Utils.Int.Min(CurrentPage, pageCount);
            teDAL.IsHtml = true;
            string HtmlUrl = Go2Category(ClassId, CurrentPage);

            if (!System.IO.File.Exists(Server.MapPath(HtmlUrl)))//保存静态
            {
                string TxtStr = teDAL.GetSiteCategoryPage(ClassId, CurrentPage);
                SaveCacheFile(TxtStr, Server.MapPath(HtmlUrl));
            }
            Response.Redirect(HtmlUrl);
        }
Esempio n. 2
0
        private JumboECMS.Entity.Normal_CategoryTree getTree(DbOperHandler _doh, string _categoryid, bool _includechild)
        {
            JumboECMS.Entity.Normal_CategoryTree _tree     = new JumboECMS.Entity.Normal_CategoryTree();
            JumboECMS.Entity.Normal_Category     _category = new JumboECMS.DAL.Normal_CategoryDAL().GetEntity(_categoryid, "");
            _tree.Id       = Str2Int(_categoryid);
            _tree.Name     = _category.Title;
            _tree.Link     = Go2Category(_categoryid, 1);
            _tree.HasChild = HasChild(_categoryid);
            List <JumboECMS.Entity.Normal_CategoryTree> subtree = new List <JumboECMS.Entity.Normal_CategoryTree>();

            if (_includechild)
            {
                _doh.Reset();
                _doh.SqlCmd = "SELECT Id FROM [" + base.CategoryTable + "] WHERE [ParentId]=" + _categoryid + " order by code";
                DataTable dtCategory = _doh.GetDataTable();
                for (int i = 0; i < dtCategory.Rows.Count; i++)
                {
                    string _subcategoryid = dtCategory.Rows[i]["Id"].ToString();
                    subtree.Add(getTree(_doh, _subcategoryid, _includechild));
                }
                dtCategory.Clear();
                dtCategory.Dispose();
            }
            _tree.SubChild = subtree;
            return(_tree);
        }
Esempio n. 3
0
        /// <summary>
        /// 链接到栏目页
        /// </summary>
        /// <param name="_categoryid"></param>
        /// <param name="_page"></param>
        /// <returns></returns>
        public string GetCategoryLink(string _categoryid, int _page)
        {
            JumboECMS.Entity.Normal_Category _Category = new JumboECMS.DAL.Normal_CategoryDAL().GetEntity(_categoryid, "");
            if (_page == 1 && _Category.AliasPage != "")
            {
                return(_Category.AliasPage);
            }
            string TempUrl = JumboECMS.Common.PageFormat.Category(site.Dir, _page);

            TempUrl = TempUrl.Replace("<#SiteDir#>", site.Dir);
            TempUrl = TempUrl.Replace("<#CategoryFilePath#>", _Category.FilePath.ToLower());
            TempUrl = TempUrl.Replace("<#id#>", _categoryid);
            if (_page > 0)
            {
                TempUrl = TempUrl.Replace("*", _page.ToString());
            }
            return(TempUrl);
        }
Esempio n. 4
0
 /// <summary>
 /// 获得指定栏目内容页数
 /// </summary>
 /// <param name="_categoryid">栏目ID</param>
 /// <param name="_includechild">是否包含子类内容</param>
 /// <returns></returns>
 public int GetContetPageCount(string _categoryid, bool _includechild)
 {
     JumboECMS.Entity.Normal_Category _category = new JumboECMS.DAL.Normal_CategoryDAL().GetEntity(_categoryid, "");
     if (_category.TypeId == "3" || _category.TypeId == "4")
     {
         return(1);
     }
     using (DbOperHandler _doh = new Common().Doh())
     {
         JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL();
         string   _pagestr    = teDAL.GetSiteCategoryTemplate(_categoryid);
         string   RegexString = "<jcms:categorycontent (?<tagcontent>.*?)>(?<tempstr>.*?)</jcms:categorycontent>";
         string[] _tagcontent = JumboECMS.Utils.Strings.GetRegValue(_pagestr, RegexString, "tagcontent", false);
         string[] _tempstr    = JumboECMS.Utils.Strings.GetRegValue(_pagestr, RegexString, "tempstr", false);
         if (_tagcontent.Length > 0)//标签存在
         {
             int _pagesize = Str2Int(JumboECMS.Utils.Strings.AttributeValue(_tagcontent[0], "pagesize"));
             if (_pagesize == 0)
             {
                 _pagesize = 20;
             }
             string _wherestr = string.Empty;
             if (!_includechild)
             {
                 _wherestr = " [CategoryID]=" + _categoryid + " AND [IsPass]=1";
             }
             else
             {
                 _wherestr = " [CategoryID] in (Select id FROM [" + base.CategoryTable + "] WHERE [Code] LIKE '" + _category.Code + "%') AND [IsPass]=1";
             }
             _doh.Reset();
             _doh.ConditionExpress = _wherestr;
             int _totalcount = _doh.Count("jcms_module_" + _category.ModuleType);
             return(JumboECMS.Utils.Int.PageCount(_totalcount, _pagesize));
         }
         else
         {
             return(1);
         }
     }
 }
Esempio n. 5
0
        /// <summary>
        /// 生成栏目文件
        /// </summary>
        /// <param name="_categoryId"></param>
        /// <param name="CreateParent"></param>

        protected void CreateCategoryFile(string _categoryId, bool CreateParent)
        {
            JumboECMS.DAL.TemplateEngineDAL teDAL = new JumboECMS.DAL.TemplateEngineDAL();
            int    pageCount = new JumboECMS.DAL.Normal_CategoryDAL().GetContetPageCount(_categoryId, true);
            string PageStr   = string.Empty;

            for (int i = 1; i < (pageCount + 1); i++)
            {
                PageStr = teDAL.GetSiteCategoryPage(_categoryId, i);
                JumboECMS.Utils.DirFile.SaveFile(PageStr, Go2Category(_categoryId, i));
            }
            doh.Reset();
            doh.SqlCmd = "SELECT Id, ParentId FROM [" + CategoryTable + "] WHERE [Id]=" + _categoryId;
            DataTable dtCategory = doh.GetDataTable();

            if (dtCategory.Rows.Count > 0 && dtCategory.Rows[0]["ParentId"].ToString() != "0" && CreateParent == true)
            {
                CreateCategoryFile(dtCategory.Rows[0]["ParentId"].ToString(), true);
            }
            dtCategory.Clear();
            dtCategory.Dispose();
        }