Ejemplo n.º 1
0
        /// <summary>
        /// 获取被评论对象(部分)
        /// </summary>
        /// <param name="commentedObjectId"></param>
        /// <returns></returns>
        public CommentedObject GetCommentedObject(long commentedObjectId)
        {
            Photo photo = new PhotoService().GetPhoto(commentedObjectId);

            if (photo != null)
            {
                CommentedObject commentedObject = new CommentedObject();
                commentedObject.DetailUrl = SiteUrls.Instance().PhotoDetail(commentedObjectId);
                commentedObject.Name      = SiteUrls.FullUrl(SiteUrls.Instance().PhotoDetail(commentedObjectId));
                commentedObject.Author    = photo.Author;
                commentedObject.UserId    = photo.UserId;
                return(commentedObject);
            }
            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取被评论对象(部分)
        /// </summary>
        /// <param name="commentedObjectId"></param>
        /// <returns></returns>
        public CommentedObject GetCommentedObject(long commentedObjectId)
        {
            AskAnswer answer = new AskService().GetAnswer(commentedObjectId);

            if (answer != null)
            {
                CommentedObject commentedObject = new CommentedObject();
                commentedObject.DetailUrl = SiteUrls.Instance().AskQuestionDetail(answer.QuestionId);
                commentedObject.Name      = answer.Body;
                commentedObject.Author    = answer.Author;
                commentedObject.UserId    = answer.UserId;
                return(commentedObject);
            }
            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取被评论对象(部分)
        /// </summary>
        /// <param name="commentedObjectId"></param>
        /// <returns></returns>
        public CommentedObject GetCommentedObject(long commentedObjectId)
        {
            ContentItem contentItem = new ContentItemService().Get(commentedObjectId);

            if (contentItem != null)
            {
                CommentedObject commentedObject = new CommentedObject();
                commentedObject.DetailUrl = SiteUrls.Instance().ContentItemDetail(commentedObjectId);
                commentedObject.Name      = contentItem.Title;
                commentedObject.Author    = contentItem.Author;
                commentedObject.UserId    = contentItem.UserId;
                return(commentedObject);
            }
            return(null);
        }
Ejemplo n.º 4
0
        public CommentedObject GetCommentedObject(long commentedObjectId)
        {
            BarThread barThread = new BarThreadService().Get(commentedObjectId);

            if (barThread != null)
            {
                CommentedObject commentedObject = new CommentedObject();
                commentedObject.DetailUrl = SiteUrls.Instance().ThreadDetail(commentedObjectId);
                commentedObject.Name      = barThread.Subject;
                commentedObject.Author    = barThread.Author;
                commentedObject.UserId    = barThread.UserId;
                return(commentedObject);
            }
            return(null);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取被评论对象(部分)
        /// </summary>
        /// <param name="commentedObjectId"></param>
        /// <returns></returns>
        public CommentedObject GetCommentedObject(long commentedObjectId)
        {
            MicroblogEntity microblog = new MicroblogService().Get(commentedObjectId);

            if (microblog != null)
            {
                CommentedObject commentedObject = new CommentedObject();
                commentedObject.DetailUrl = SiteUrls.Instance().ShowMicroblog(microblog.User.UserName, commentedObjectId);
                commentedObject.Name      = microblog.Body;
                commentedObject.Author    = microblog.User.DisplayName;
                commentedObject.UserId    = microblog.UserId;
                return(commentedObject);
            }
            return(null);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取被评论对象(部分)
        /// </summary>
        /// <param name="commentedObjectId"></param>
        /// <returns></returns>
        public CommentedObject GetCommentedObject(long commentedObjectId)
        {
            AskQuestion question = new AskService().GetQuestion(commentedObjectId);

            if (question != null)
            {
                CommentedObject commentedObject = new CommentedObject();
                commentedObject.DetailUrl = SiteUrls.Instance().AskQuestionDetail(commentedObjectId);
                commentedObject.Name      = question.Subject;
                commentedObject.Author    = question.Author;
                commentedObject.UserId    = question.UserId;
                return(commentedObject);
            }
            return(null);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取被评论对象(部分)
        /// </summary>
        /// <param name="commentedObjectId"></param>
        /// <returns></returns>
        public CommentedObject GetCommentedObject(long commentedObjectId)
        {
            WikiPage page = new WikiService().Get(commentedObjectId);

            if (page != null)
            {
                CommentedObject commentedObject = new CommentedObject();
                commentedObject.DetailUrl = SiteUrls.Instance().PageDetail(commentedObjectId);
                commentedObject.Name      = page.Title;
                commentedObject.Author    = page.Author;
                commentedObject.UserId    = page.UserId;
                return(commentedObject);
            }
            return(null);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 获取被评论对象(部分)
        /// </summary>
        /// <param name="commentedObjectId"></param>
        /// <returns></returns>
        public CommentedObject GetCommentedObject(long commentedObjectId)
        {
            PointGift pointGift = new PointMallService().GetGift(commentedObjectId);

            if (pointGift != null)
            {
                IUser           user            = DIContainer.Resolve <UserService>().GetUser(pointGift.UserId);
                CommentedObject commentedObject = new CommentedObject();
                commentedObject.DetailUrl = SiteUrls.Instance().GiftDetail(commentedObjectId);
                commentedObject.Name      = pointGift.Name;
                commentedObject.Author    = user.DisplayName;
                commentedObject.UserId    = pointGift.UserId;
                return(commentedObject);
            }
            return(null);
        }
Ejemplo n.º 9
0
        public AssociatedInfo GetAssociatedInfo(long associateId, string tenantTypeId = "")
        {
            Comment comment = new CommentService().Get(associateId);

            if (comment != null && comment.User() != null)
            {
                ICommentUrlGetter commentUrlGetter = CommentUrlGetterFactory.Get(comment.TenantTypeId);
                CommentedObject   commentObject    = commentUrlGetter.GetCommentedObject(comment.CommentedObjectId);
                return(new AssociatedInfo()
                {
                    DetailUrl = commentUrlGetter.GetCommentDetailUrl(comment.CommentedObjectId, comment.Id, commentObject.UserId),
                    Subject = Tunynet.Utilities.HtmlUtility.TrimHtml(comment.Body, 12)
                });
            }

            return(null);
        }