Exemple #1
0
        private void updateComment(object[] args, object target)
        {
            ForumPost  post   = args[0] as ForumPost;
            User       editor = args[1] as User;
            ForumTopic topic  = ForumTopic.findById(post.TopicId);

            // 更新评论
            CommentSync objSync = CommentSync.find("PostId=" + post.Id).first();

            if (objSync == null)
            {
                return;
            }
            OpenComment comment = objSync.Comment;

            comment.Content = strUtil.ParseHtml(post.Content);
            comment.update();

            // 更新此ForumPost对应的Microblog
            Microblog mblog = Microblog.find("DataId=:id and DataType=:dtype")
                              .set("id", post.Id)
                              .set("dtype", typeof(ForumPost).FullName)
                              .first();

            if (mblog != null)
            {
                mblog.Content = getPostContent(post);
                mblog.update();
            }
        }
Exemple #2
0
        private void deleteCommentByPost(ForumPost post)
        {
            CommentSync objSync = CommentSync.find("PostId=" + post.Id).first();

            if (objSync == null)
            {
                return;
            }

            // 删除此评论
            OpenComment comment = objSync.Comment;

            commentService.Delete(comment);

            // 删除同步表 CommentSync
            objSync.delete();
        }
Exemple #3
0
        private void deletePost(object[] args, object target)
        {
            OpenComment comment = args[0] as OpenComment;

            CommentSync objSync = CommentSync.find("CommentId=" + comment.Id).first();

            if (objSync == null)
            {
                return;
            }

            // 删除帖子
            postService.DeleteToTrash(objSync.Post, comment.Member, "");

            // 删除同步表
            objSync.delete();

            // 删除 ForumPost 对应的 Microblog
        }
Exemple #4
0
        private int getParentId(OpenComment comment, ForumTopic topic)
        {
            ForumPost post = postService.GetPostByTopic(topic.Id);

            // 获取topic对应的post的Id
            if (comment.ParentId == 0)
            {
                return(post.Id);
            }
            else
            {
                CommentSync objSync = CommentSync.find("CommentId=" + comment.ParentId).first();
                if (objSync == null || objSync.Post == null)
                {
                    return(post.Id);
                }

                return(objSync.Post.Id);
            }
        }