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); }
private SiteGroupCms.Entity.Normal_ClassTree getTree(DbOperHandler _doh, string _channelid, string _classid, bool _includechild) { SiteGroupCms.Entity.Normal_ClassTree _tree = new SiteGroupCms.Entity.Normal_ClassTree(); SiteGroupCms.Entity.Normal_Channel _channel = new SiteGroupCms.Dal.Normal_ChannelDAL().GetEntity(_channelid); bool _channelishtml = true; if (_classid == "0")//表示从根节点开始 { _tree.Id = _channel.ID.ToString(); _tree.Name = _channel.Title; _tree.Link = Go2Channel(_channelid, 0); _tree.RssUrl = ""; } else { SiteGroupCms.Entity.Normal_Class _class = new SiteGroupCms.Dal.Normal_ClassDAL().GetEntity(_classid); _tree.Id = _classid; _tree.Name = _class.Title; _tree.Link = Go2Class(1, _channelishtml, _channelid, _classid, false); // _tree.RssUrl = Go2Rss(1, false, _channelid, _classid); } _tree.HasChild = HasChild(_channelid, _classid); List <SiteGroupCms.Entity.Normal_ClassTree> subtree = new List <SiteGroupCms.Entity.Normal_ClassTree>(); if (_includechild) { _doh.Reset(); _doh.SqlCmd = "SELECT Id FROM [jcms_normal_class] WHERE [ChannelId]=" + _channelid + " AND [ParentId]=" + _classid + " order by code"; DataTable dtClass = _doh.GetDataTable(); for (int i = 0; i < dtClass.Rows.Count; i++) { string _subclassid = dtClass.Rows[i]["Id"].ToString(); subtree.Add(getTree(_doh, _channelid, _subclassid, _includechild)); } dtClass.Clear(); dtClass.Dispose(); } _tree.SubChild = subtree; return(_tree); }