Exemplo n.º 1
0
        /// <summary>
        /// 递归加载文章
        /// </summary>
        /// <param name="docTypeConfigFix">固定的二级</param>
        /// <param name="docTypeConfig">当前文档类型</param>
        /// <param name="docTypeConfigLst">当前文档子类型</param>
        /// <param name="allList">所有类型</param>
        /// <param name="isLogin">是否登录</param>
        private static void AddDocTypeConfigDocList(Model.DocTypeConfig docTypeConfigFix, Model.DocTypeConfig docTypeConfig, IEnumerable <Model.DocTypeConfig> docTypeConfigLst, IList <Model.DocTypeConfig> allList, bool isLogin)
        {
            foreach (var item in docTypeConfigLst)
            {
                var docList = isLogin
                    ?
                              Repository.HelpDoc.GetListByDocTypeId(1, 8, item.docTypeId, out int _totalCount, out int _pageCount)
                    :
                              Repository.HelpDoc.GetVisitorListByDocTypeId(1, 8, item.docTypeId, out int _vTotalCount, out int _vPageCount)
                ;

                if (docTypeConfigFix.DocList == null)
                {
                    docTypeConfigFix.DocList = new List <Model.HelpDoc>();
                }
                //处理二级文档列表
                foreach (var doc in docList)
                {
                    if (docTypeConfigFix.DocList.Count == 8)
                    {
                        break;
                    }
                    docTypeConfigFix.DocList.Add(doc);
                }

                var lst = from rst in allList where rst.docPreTypeId == item.docTypeId select rst;
                if (lst != null)
                {
                    AddDocTypeConfigDocList(docTypeConfigFix, item, lst, allList, isLogin);
                }
            }
        }