Example #1
0
        /// <summary>
        /// 根据ID得到一个主题页面实体
        /// </summary>
        /// <param name="name">页面名称</param>
        /// <returns>主题页面实体</returns>
        public static TopicPageEntity GetTopicPage(String name)
        {
            if (!RegexVerify.IsPageName(name))
            {
                throw new InvalidRequstException(RequestType.TopicPage);
            }

            TopicPageEntity topicpage = TopicPageCache.GetTopicPageCache(name);//读取缓存

            if (topicpage == null)
            {
                topicpage = TopicPageManager.GetReplacedContent(TopicPageRepository.Instance.GetEntity(name));
                TopicPageCache.SetTopicPageCache(topicpage);//设置缓存
            }

            if (topicpage == null)
            {
                throw new NullResponseException(RequestType.TopicPage);
            }

            if (topicpage.IsHide && !AdminManager.HasPermission(PermissionType.SuperAdministrator))
            {
                throw new NoPermissionException();
            }

            return(topicpage);
        }
Example #2
0
        /// <summary>
        /// 获取主题页面列表
        /// </summary>
        /// <param name="pageIndex">页面索引</param>
        /// <returns>主题页面列表</returns>
        public static PagedList <TopicPageEntity> AdminGetTopicPageList(Int32 pageIndex)
        {
            if (!AdminManager.HasPermission(PermissionType.SuperAdministrator))
            {
                throw new NoPermissionException();
            }

            Int32 pageSize    = AdminManager.ADMIN_LIST_PAGE_SIZE;
            Int32 recordCount = TopicPageManager.AdminCountTopicPages();

            return(TopicPageRepository.Instance
                   .GetEntities(pageIndex, pageSize, recordCount)
                   .ToPagedList(pageSize, recordCount));
        }