コード例 #1
0
 /// <summary>
 /// 获取子级评论列表
 /// </summary>
 /// <param name="parentId">父评论Id</param>
 /// <param name="pageIndex">当前页码</param>
 /// <param name="sortBy">排序字段</param>
 /// <returns></returns>
 public PagingDataSet <Comment> GetChildren(long parentId, int pageIndex, SortBy_Comment sortBy)
 {
     //排序:Id正序
     //缓存分区:ParentId
     //仅显示可公开对外显示的 PubliclyAuditStatus
     return(commentRepository.GetChildren(parentId, pageIndex, sortBy));
 }
コード例 #2
0
ファイル: CommentRepository.cs プロジェクト: yaotyl/spb4mono
        /// <summary>
        /// 获取子级回复的CacheKey
        /// </summary>
        /// <param name="parentId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="sortBy"></param>
        /// <returns></returns>
        private string GetCacheKey_GetChildren(long parentId, SortBy_Comment sortBy)
        {
            StringBuilder cacheKey = new StringBuilder(RealTimeCacheHelper.GetListCacheKeyPrefix(CacheVersionType.AreaVersion, "ParentId", parentId));

            cacheKey.AppendFormat("Pagings:SortBy-{0}", (int)sortBy);

            return(cacheKey.ToString());
        }
コード例 #3
0
ファイル: CommentRepository.cs プロジェクト: yaotyl/spb4mono
        /// <summary>
        /// 获取子级评论列表
        /// </summary>
        /// <param name="parentId">父评论Id</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="sortBy">排序字段</param>
        /// <returns></returns>
        public PagingDataSet <Comment> GetChildren(long parentId, int pageIndex, SortBy_Comment sortBy)
        {
            return(GetPagingEntities(ChildPageSize, pageIndex, CachingExpirationType.ObjectCollection,
                                     //获取CacheKey
                                     () =>
            {
                return GetCacheKey_GetChildren(parentId, sortBy);
            },
                                     //生成PetaPoco.Sql
                                     () =>
            {
                var sql = PetaPoco.Sql.Builder;

                if (parentId > 0)
                {
                    sql.Where("ParentId = @0", parentId);
                }

                switch (this.PubliclyAuditStatus)
                {
                case PubliclyAuditStatus.Again:
                case PubliclyAuditStatus.Fail:
                case PubliclyAuditStatus.Pending:
                case PubliclyAuditStatus.Success:
                    sql.Where("AuditStatus = @0", this.PubliclyAuditStatus);
                    break;

                case PubliclyAuditStatus.Again_GreaterThanOrEqual:
                case PubliclyAuditStatus.Pending_GreaterThanOrEqual:
                    sql.Where("AuditStatus > @0", this.PubliclyAuditStatus);
                    break;

                default:
                    break;
                }

                switch (sortBy)
                {
                case SortBy_Comment.DateCreated:
                    sql.OrderBy("Id ASC"); break;

                case SortBy_Comment.DateCreatedDesc:
                    sql.OrderBy("Id DESC"); break;

                default:
                    sql.OrderBy("Id ASC"); break;
                }

                return sql;
            }
                                     ));
        }
コード例 #4
0
ファイル: CommentRepository.cs プロジェクト: yaotyl/spb4mono
 private PetaPoco.Sql GetSql_CommentPageIndexInParentComments(long parentId, SortBy_Comment sortBy)
 {
     PetaPoco.Sql sql = PetaPoco.Sql.Builder;
     sql.Where("parentId=@0", parentId);
     if (sortBy == SortBy_Comment.DateCreated)
     {
         sql.OrderBy("id");
     }
     else
     {
         sql.OrderBy("id desc");
     }
     return(sql);
 }
コード例 #5
0
        /// <summary>
        /// 评论控件
        /// </summary>
        public static string _Comment_Microblog(this SiteUrls siteUrls, long commentedObjectId, long ownerId, string tenantTypeId, SortBy_Comment sortBy = SortBy_Comment.DateCreatedDesc, string subject = null, string originalAuthor = null)
        {
            RouteValueDictionary dic = new RouteValueDictionary();

            dic.Add("commentedObjectId", commentedObjectId);
            dic.Add("ownerId", ownerId);
            dic.Add("tenantTypeId", tenantTypeId);
            dic.Add("sortBy", sortBy);
            if (!string.IsNullOrEmpty(subject))
            {
                dic.Add("subject", subject);
            }
            if (!string.IsNullOrEmpty(originalAuthor))
            {
                dic.Add("originalAuthor", originalAuthor);
            }

            return(CachedUrlHelper.Action("_Comment", "ChannelMicroblog", MicroblogAreaName, dic));
        }
コード例 #6
0
ファイル: SiteUrls.cs プロジェクト: hbulzy/SYS
 /// <summary>
 /// 微博的评论列表
 /// </summary>
 /// <param name="url"></param>
 /// <param name="tenantType">租户类型id</param>
 /// <param name="commentedObjectId">被评论对象的id</param>
 /// <param name="pageIndex">被评论的页码</param>
 /// <param name="sortBy">排序方式</param>
 /// <returns>微博的评论列表</returns>
 public static string _MicroblogCommentList(this SiteUrls url, string tenantType, long commentedObjectId, int pageIndex = 1, SortBy_Comment sortBy = SortBy_Comment.DateCreated)
 {
     RouteValueDictionary dic = new RouteValueDictionary();
     dic.Add("tenantType", tenantType);
     dic.Add("commentedObjectId", commentedObjectId);
     if (pageIndex > 1)
         dic.Add("pageIndex", pageIndex);
     if (sortBy != SortBy_Comment.DateCreated)
         dic.Add("sortBy", sortBy);
     return CachedUrlHelper.Action("_CommentList", "ChannelMicroblog", MicroblogAreaName, dic);
 }
コード例 #7
0
 public ActionResult _CommentList(string tenantType, long commentedObjectId, int?pageIndex = null, SortBy_Comment sortBy = SortBy_Comment.DateCreatedDesc, long?commentId = null, bool showBefore = true, bool showAfter = false)
 {
     ViewData["tenantType"]        = tenantType;
     ViewData["commentedObjectId"] = commentedObjectId;
     if (commentId.HasValue)
     {
         pageIndex  = new CommentService().GetPageIndexForCommentInCommens(commentId.Value, tenantType, commentedObjectId, sortBy);
         showAfter  = true;
         showBefore = true;
     }
     if (!pageIndex.HasValue)
     {
         pageIndex = 1;
     }
     ViewData["ShowBefore"] = showBefore;
     ViewData["ShowAfter"]  = showAfter;
     return(View(new CommentService().GetRootComments(tenantType, commentedObjectId, pageIndex.Value, sortBy)));
 }
コード例 #8
0
ファイル: CommentRepository.cs プロジェクト: yaotyl/spb4mono
        public int GetPageIndexForCommentInParentCommens(long commentId, long parentId, SortBy_Comment sortBy)
        {
            int    pageIndex = 1;
            string cacheKey  = GetCacheKey_GetChildren(parentId, sortBy);

            PagingEntityIdCollection peic = cacheService.Get <PagingEntityIdCollection>(cacheKey);

            if (peic == null)
            {
                peic = CreateDAO().FetchPagingPrimaryKeys <Comment>(PrimaryMaxRecords, PageSize * CacheablePageCount, 1, GetSql_CommentPageIndexInParentComments(parentId, sortBy));
                peic.IsContainsMultiplePages = true;
                cacheService.Add(cacheKey, peic, CachingExpirationType.ObjectCollection);
            }
            if (peic != null)
            {
                IList <long> commentIds   = peic.GetTopEntityIds(peic.Count).Cast <long>().ToList();
                int          commentIndex = commentIds.IndexOf(commentId);
                if (commentIndex > 0)
                {
                    pageIndex = commentIndex / ChildPageSize + 1;
                }
                else
                {
                    PetaPoco.Sql sql = PetaPoco.Sql.Builder
                                       .Select("Count(Id)")
                                       .From("tn_Comments")
                                       .Where("ParentId=@0", parentId);
                    switch (sortBy)
                    {
                    case SortBy_Comment.DateCreated:
                        sql.Where("Id<@0", commentId);
                        break;

                    case SortBy_Comment.DateCreatedDesc:
                        sql.Where("Id>@0", commentId);
                        break;

                    default:
                        sql.Where("Id<@0", commentId);
                        break;
                    }
                    commentIndex = CreateDAO().FirstOrDefault <int>(sql);
                    if (commentIndex > 0)
                    {
                        pageIndex = commentIndex / ChildPageSize + 1;
                    }
                }
            }
            return(pageIndex);
        }
コード例 #9
0
ファイル: CommentService.cs プロジェクト: hbulzy/SYS
 /// <summary>
 /// 获取一级评论在评论列表中的页码
 /// </summary>
 /// <param name="commentId">评论id</param>
 /// <returns>页码</returns>
 public int GetPageIndexForCommentInCommens(long commentId, string tenantType, long commentedObjectId, SortBy_Comment sortBy)
 {
     return commentRepository.GetPageIndexForCommentInCommens(commentId, tenantType, commentedObjectId, sortBy);
 }
コード例 #10
0
ファイル: CommentService.cs プロジェクト: hbulzy/SYS
 /// <summary>
 /// 获取子级评论列表
 /// </summary>
 /// <param name="parentId">父评论Id</param>
 /// <param name="pageIndex">当前页码</param>
 /// <param name="sortBy">排序字段</param> 
 /// <returns></returns>
 public PagingDataSet<Comment> GetChildren(long parentId, int pageIndex, SortBy_Comment sortBy)
 {
     //排序:Id正序
     //缓存分区:ParentId
     //仅显示可公开对外显示的 PubliclyAuditStatus
     return commentRepository.GetChildren(parentId, pageIndex, sortBy);
 }
コード例 #11
0
ファイル: SiteUrls.cs プロジェクト: hbulzy/SYS
 /// <summary>
 /// (通用)评论列表
 /// </summary>
 /// <param name="tenantType">评论的租户类型id</param>
 /// <param name="commentedObjectId">被评论对象id</param>
 /// <param name="sortBy">排序方式</param>
 /// <param name="pageIndex">当前页码</param>
 /// <returns>评论列表</returns>
 public string _CommentList(string tenantType, long commentedObjectId, SortBy_Comment sortBy = SortBy_Comment.DateCreated, int pageIndex = 1, bool showBefor = true, bool showAfter = false)
 {
     RouteValueDictionary routeValueDictionary = new RouteValueDictionary();
     routeValueDictionary.Add("tenantType", tenantType);
     routeValueDictionary.Add("commentedObjectId", commentedObjectId);
     if (sortBy != SortBy_Comment.DateCreated)
         routeValueDictionary.Add("sortBy", sortBy);
     if (pageIndex != 1)
         routeValueDictionary.Add("pageIndex", pageIndex);
     if (!showBefor)
         routeValueDictionary.Add("showBefor", showBefor);
     if (showAfter)
         routeValueDictionary.Add("showAfter", showAfter);
     return CachedUrlHelper.Action("_CommentList", "Channel", CommonAreaName, routeValueDictionary);
 }
コード例 #12
0
ファイル: SiteUrls.cs プロジェクト: hbulzy/SYS
 /// <summary>
 /// (通用)子级评论列表
 /// </summary>
 /// <param name="parentId">父级评论列表id</param>
 /// <param name="pageIndex">当前页码</param>
 /// <param name="sortBy">排序方式</param>
 /// <returns>排序方式</returns>
 public string _ChildCommentList(long parentId, int pageIndex = 1, SortBy_Comment sortBy = SortBy_Comment.DateCreatedDesc, bool showBefor = true, bool showAfter = false)
 {
     RouteValueDictionary routeValueDictionary = new RouteValueDictionary();
     routeValueDictionary.Add("parentId", parentId);
     if (pageIndex > 1)
         routeValueDictionary.Add("pageIndex", pageIndex);
     if (sortBy != SortBy_Comment.DateCreatedDesc)
         routeValueDictionary.Add("sortBy", sortBy);
     if (!showBefor)
         routeValueDictionary.Add("showBefor", showBefor);
     if (showAfter)
         routeValueDictionary.Add("showAfter", showAfter);
     return CachedUrlHelper.Action("_ChildCommentList", "Channel", CommonAreaName, routeValueDictionary);
 }
コード例 #13
0
 public int GetPageIndexForCommentInParentCommens(long commentId, long ParentId, SortBy_Comment sortBy)
 {
     return(commentRepository.GetPageIndexForCommentInParentCommens(commentId, ParentId, sortBy));
 }
コード例 #14
0
 /// <summary>
 /// 获取一级评论在评论列表中的页码
 /// </summary>
 /// <param name="commentId">评论id</param>
 /// <returns>页码</returns>
 public int GetPageIndexForCommentInCommens(long commentId, string tenantType, long commentedObjectId, SortBy_Comment sortBy)
 {
     return(commentRepository.GetPageIndexForCommentInCommens(commentId, tenantType, commentedObjectId, sortBy));
 }
コード例 #15
0
 /// <summary>
 /// 获取前topNumber条评论
 /// </summary>
 ///<param name="ownerId">评论拥有者Id</param>
 /// <param name="tenantTypeId">租户类型Id</param>
 /// <param name="topNumber">获取的评论数量</param>
 /// <param name="sortBy">排序字段</param>
 /// <returns></returns>
 public IEnumerable <Comment> GetTopComments(long ownerId, string tenantTypeId, int topNumber, SortBy_Comment sortBy = SortBy_Comment.DateCreated)
 {
     return(commentRepository.GetTopComments(ownerId, tenantTypeId, topNumber, sortBy));
 }
コード例 #16
0
ファイル: CommentRepository.cs プロジェクト: yaotyl/spb4mono
        /// <summary>
        /// 获取前topNumber条评论
        /// </summary>
        /// <param name="ownerId">评论拥有者Id</param>
        /// <param name="tenantTypeId">租户类型Id</param>
        /// <param name="topNumber">获取的评论数量</param>
        /// <param name="sortBy">排序字段</param>
        /// <returns></returns>
        public IEnumerable <Comment> GetTopComments(long ownerId, string tenantTypeId, int topNumber, SortBy_Comment sortBy)
        {
            return(GetTopEntities(topNumber, CachingExpirationType.UsualObjectCollection,
                                  () =>
            {
                StringBuilder cacheKey = new StringBuilder(RealTimeCacheHelper.GetListCacheKeyPrefix(CacheVersionType.AreaVersion, "TenantTypeId", tenantTypeId));
                cacheKey.AppendFormat("OwnerId-{0}:SortBy-{1}", ownerId, (int)sortBy);

                return cacheKey.ToString();
            },
                                  () =>
            {
                var sql = PetaPoco.Sql.Builder.Where("TenantTypeId = @0 ", tenantTypeId);

                if (ownerId > 0)
                {
                    sql.Where("OwnerId = @0", ownerId);
                }

                switch (sortBy)
                {
                case SortBy_Comment.DateCreated:
                    sql.OrderBy("Id ASC"); break;

                case SortBy_Comment.DateCreatedDesc:
                    sql.OrderBy("Id DESC"); break;

                default:
                    sql.OrderBy("Id ASC"); break;
                }

                return sql;
            }));
        }
コード例 #17
0
ファイル: CommentRepository.cs プロジェクト: yaotyl/spb4mono
        /// <summary>
        /// 获取一级回复的CacheKey
        /// </summary>
        /// <param name="tenantTypeId"></param>
        /// <param name="commentedObjectId"></param>
        /// <param name="sortBy"></param>
        /// <returns></returns>
        private string GetCachekey_GetRootComments(string tenantTypeId, long commentedObjectId, SortBy_Comment sortBy)
        {
            StringBuilder cacheKey = new StringBuilder(RealTimeCacheHelper.GetListCacheKeyPrefix(CacheVersionType.AreaVersion, "CommentedObjectId", commentedObjectId));

            cacheKey.AppendFormat("TenantTypeId-{0}:SortBy-{1}", tenantTypeId, (int)sortBy);

            return(cacheKey.ToString());
        }
コード例 #18
0
ファイル: CommentService.cs プロジェクト: hbulzy/SYS
 public int GetPageIndexForCommentInParentCommens(long commentId, long ParentId, SortBy_Comment sortBy)
 {
     return commentRepository.GetPageIndexForCommentInParentCommens(commentId, ParentId, sortBy);
 }
コード例 #19
0
ファイル: CommentRepository.cs プロジェクト: yaotyl/spb4mono
 private PetaPoco.Sql GetSql_CommentPageIndex(string tenantType, long commentedObjectId, SortBy_Comment sortBy)
 {
     PetaPoco.Sql sql = PetaPoco.Sql.Builder;
     sql.Where("tenantTypeId=@0", tenantType);
     sql.Where("commentedObjectId=@0", commentedObjectId);
     sql.Where("parentId=0");
     if (sortBy == SortBy_Comment.DateCreated)
     {
         sql.OrderBy("id");
     }
     else
     {
         sql.OrderBy("id desc");
     }
     return(sql);
 }
コード例 #20
0
ファイル: CommentService.cs プロジェクト: hbulzy/SYS
        //顶级评论每页记录数、子评论每页记录数可以分别配置(暂时放在Repository中)
        /// <summary>
        /// 获取顶级评论列表
        /// </summary>
        /// <param name="tenantTypeId">租户类型Id</param>
        /// <param name="commentedObjectId">被评论对象Id</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="sortBy">排序字段</param> 
        /// <returns></returns>
        public PagingDataSet<Comment> GetRootComments(string tenantTypeId, long commentedObjectId, int pageIndex, SortBy_Comment sortBy)
        {
            //排序:Id正序
            //缓存分区:CommentedObjectId
            //仅显示可公开对外显示的 PubliclyAuditStatus

            return commentRepository.GetRootComments(tenantTypeId, commentedObjectId, pageIndex, sortBy);
        }
コード例 #21
0
ファイル: CommentService.cs プロジェクト: hbulzy/SYS
 /// <summary>
 /// 获取前topNumber条评论
 /// </summary>
 ///<param name="ownerId">评论拥有者Id</param>
 /// <param name="tenantTypeId">租户类型Id</param>
 /// <param name="topNumber">获取的评论数量</param>
 /// <param name="sortBy">排序字段</param>
 /// <returns></returns>
 public IEnumerable<Comment> GetTopComments(long ownerId, string tenantTypeId, int topNumber, SortBy_Comment sortBy = SortBy_Comment.DateCreated)
 {
     return commentRepository.GetTopComments(ownerId, tenantTypeId, topNumber, sortBy);
 }
コード例 #22
0
ファイル: ChannelController.cs プロジェクト: hbulzy/SYS
        public ActionResult _ChildCommentList(long parentId, int pageIndex = 1, SortBy_Comment sortBy = SortBy_Comment.DateCreatedDesc, bool showBefor = true, bool showAfter = false, bool enableComment = true)
        {
            Comment comment = commentService.Get(parentId);

            if (comment == null)
                return Content(string.Empty);

            ViewData["enableComment"] = enableComment;

            ViewData["ShowBefor"] = showBefor;
            ViewData["ShowAfter"] = showAfter;
            ViewData["parentId"] = comment.Id;
            ViewData["commentedObjectId"] = comment.CommentedObjectId;
            ViewData["TenantTypeId"] = comment.TenantTypeId;
            return View(commentService.GetChildren(parentId, pageIndex, sortBy));
        }
コード例 #23
0
ファイル: SiteUrls.cs プロジェクト: hbulzy/SYS
        /// <summary>
        /// 评论控件
        /// </summary>
        public static string _Comment_Microblog(this SiteUrls siteUrls, long commentedObjectId, long ownerId, string tenantTypeId, SortBy_Comment sortBy = SortBy_Comment.DateCreatedDesc, string subject = null, string originalAuthor = null)
        {
            RouteValueDictionary dic = new RouteValueDictionary();
            dic.Add("commentedObjectId", commentedObjectId);
            dic.Add("ownerId", ownerId);
            dic.Add("tenantTypeId", tenantTypeId);
            dic.Add("sortBy", sortBy);
            if (!string.IsNullOrEmpty(subject))
                dic.Add("subject", subject);
            if (!string.IsNullOrEmpty(originalAuthor))
                dic.Add("originalAuthor", originalAuthor);

            return CachedUrlHelper.Action("_Comment", "ChannelMicroblog", MicroblogAreaName, dic);
        }
コード例 #24
0
ファイル: ChannelController.cs プロジェクト: hbulzy/SYS
        public ActionResult _CommentList(string tenantType, long commentedObjectId, SortBy_Comment sortBy = SortBy_Comment.DateCreated, int pageIndex = 1, string childCommentLink = null, bool showBefor = true, bool showAfter = false, long? commentId = null, int? childIndex = null, bool enableComment = true)
        {
            ViewData["enableComment"] = enableComment;

            ViewData["ChildCommentLink"] = childCommentLink;
            ViewData["commentedObjectId"] = commentedObjectId;
            ViewData["ShowAfter"] = showAfter;
            ViewData["ShowBefor"] = showBefor;
            ViewData["CommentId"] = commentId;
            ViewData["ChildIndex"] = childIndex;
            ViewData["tenantType"] = tenantType;
            return View(commentService.GetRootComments(tenantType, commentedObjectId, pageIndex, sortBy));
        }
コード例 #25
0
 public ActionResult _CommentList(string tenantType, long commentedObjectId, int? pageIndex = null, SortBy_Comment sortBy = SortBy_Comment.DateCreatedDesc, long? commentId = null, bool showBefore = true, bool showAfter = false)
 {
     ViewData["tenantType"] = tenantType;
     ViewData["commentedObjectId"] = commentedObjectId;
     if (commentId.HasValue)
     {
         pageIndex = new CommentService().GetPageIndexForCommentInCommens(commentId.Value, tenantType, commentedObjectId, sortBy);
         showAfter = true;
         showBefore = true;
     }
     if (!pageIndex.HasValue)
         pageIndex = 1;
     ViewData["ShowBefore"] = showBefore;
     ViewData["ShowAfter"] = showAfter;
     return View(new CommentService().GetRootComments(tenantType, commentedObjectId, pageIndex.Value, sortBy));
 }
コード例 #26
0
ファイル: CommentRepository.cs プロジェクト: yaotyl/spb4mono
        /// <summary>
        /// 获取顶级评论列表
        /// </summary>
        /// <param name="tenantTypeId">租户类型Id</param>
        /// <param name="commentedObjectId">被评论对象Id</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="sortBy">排序字段</param>
        /// <returns></returns>
        public PagingDataSet <Comment> GetRootComments(string tenantTypeId, long commentedObjectId, int pageIndex, SortBy_Comment sortBy)
        {
            return(GetPagingEntities(PageSize, pageIndex, CachingExpirationType.ObjectCollection,
                                     //获取CacheKey
                                     () =>
            {
                return GetCachekey_GetRootComments(tenantTypeId, commentedObjectId, sortBy);
            },
                                     //生成PetaPoco.Sql
                                     () =>
            {
                var sql = PetaPoco.Sql.Builder;

                sql.Where("ParentId = 0");

                if (!String.IsNullOrEmpty(tenantTypeId))
                {
                    sql.Where("TenantTypeId = @0", tenantTypeId);
                }

                if (commentedObjectId > 0)
                {
                    sql.Where("CommentedObjectId = @0", commentedObjectId);
                }

                switch (this.PubliclyAuditStatus)
                {
                case PubliclyAuditStatus.Again:
                case PubliclyAuditStatus.Fail:
                case PubliclyAuditStatus.Pending:
                case PubliclyAuditStatus.Success:
                    sql.Where("AuditStatus = @0", this.PubliclyAuditStatus);
                    break;

                case PubliclyAuditStatus.Again_GreaterThanOrEqual:
                case PubliclyAuditStatus.Pending_GreaterThanOrEqual:
                    sql.Where("AuditStatus > @0", this.PubliclyAuditStatus);
                    break;

                default:
                    break;
                }

                switch (sortBy)
                {
                case SortBy_Comment.DateCreated:
                    sql.OrderBy("Id ASC"); break;

                case SortBy_Comment.DateCreatedDesc:
                    sql.OrderBy("Id DESC"); break;

                default:
                    sql.OrderBy("Id ASC"); break;
                }

                return sql;
            }));
        }
コード例 #27
0
        /// <summary>
        /// 微博的评论列表
        /// </summary>
        /// <param name="url"></param>
        /// <param name="tenantType">租户类型id</param>
        /// <param name="commentedObjectId">被评论对象的id</param>
        /// <param name="pageIndex">被评论的页码</param>
        /// <param name="sortBy">排序方式</param>
        /// <returns>微博的评论列表</returns>
        public static string _MicroblogCommentList(this SiteUrls url, string tenantType, long commentedObjectId, int pageIndex = 1, SortBy_Comment sortBy = SortBy_Comment.DateCreated)
        {
            RouteValueDictionary dic = new RouteValueDictionary();

            dic.Add("tenantType", tenantType);
            dic.Add("commentedObjectId", commentedObjectId);
            if (pageIndex > 1)
            {
                dic.Add("pageIndex", pageIndex);
            }
            if (sortBy != SortBy_Comment.DateCreated)
            {
                dic.Add("sortBy", sortBy);
            }
            return(CachedUrlHelper.Action("_CommentList", "ChannelMicroblog", MicroblogAreaName, dic));
        }
コード例 #28
0
        //顶级评论每页记录数、子评论每页记录数可以分别配置(暂时放在Repository中)

        /// <summary>
        /// 获取顶级评论列表
        /// </summary>
        /// <param name="tenantTypeId">租户类型Id</param>
        /// <param name="commentedObjectId">被评论对象Id</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="sortBy">排序字段</param>
        /// <returns></returns>
        public PagingDataSet <Comment> GetRootComments(string tenantTypeId, long commentedObjectId, int pageIndex, SortBy_Comment sortBy)
        {
            //排序:Id正序
            //缓存分区:CommentedObjectId
            //仅显示可公开对外显示的 PubliclyAuditStatus

            return(commentRepository.GetRootComments(tenantTypeId, commentedObjectId, pageIndex, sortBy));
        }