예제 #1
0
        public CommentInfo AddBookmarkComment(string parentcommentid, long entityid, string content)
        {
            var comment = new Comment
            {
                Content  = content,
                Datetime = TenantUtil.DateTimeNow(),
                UserID   = SecurityContext.CurrentAccount.ID
            };

            var parentID = Guid.Empty;

            try
            {
                if (!string.IsNullOrEmpty(parentcommentid))
                {
                    parentID = new Guid(parentcommentid);
                }
            }
            catch
            {
                parentID = Guid.Empty;
            }
            comment.Parent     = parentID.ToString();
            comment.BookmarkID = entityid;
            comment.ID         = Guid.NewGuid();

            BookmarkingServiceHelper.GetCurrentInstanse().AddComment(comment);

            return(BookmarkingConverter.ConvertComment(comment, new List <Comment>()));
        }
예제 #2
0
        public CommentInfo GetBookmarkCommentPreview(string commentid, string htmltext)
        {
            var comment = new Comment
            {
                Datetime = TenantUtil.DateTimeNow(),
                UserID   = SecurityContext.CurrentAccount.ID
            };

            if (!String.IsNullOrEmpty(commentid))
            {
                comment = BookmarkingServiceHelper.GetCurrentInstanse().GetCommentById(commentid);

                comment.Parent = string.Empty;
            }
            comment.Content = htmltext;

            var ci = BookmarkingConverter.ConvertComment(comment, new List <Comment>());

            ci.IsEditPermissions     = false;
            ci.IsResponsePermissions = false;

            //var isRoot = string.IsNullOrEmpty(comment.Parent) || comment.Parent.Equals(Guid.Empty.ToString(), StringComparison.CurrentCultureIgnoreCase);

            return(ci);
        }
예제 #3
0
        private string GetHTMLComment(string text, string commentID)
        {
            Comment comment = new Comment()
            {
                Content  = text,
                Datetime = ASC.Core.Tenants.TenantUtil.DateTimeNow(),
                UserID   = SecurityContext.CurrentAccount.ID
            };

            if (!String.IsNullOrEmpty(commentID))
            {
                comment = ServiceHelper.GetCommentById(commentID);

                comment.Content = text;
                comment.Parent  = string.Empty;
            }

            var defComment = new CommentsList();

            ConfigureComments(defComment);

            ASC.Web.Controls.CommentInfoHelper.CommentInfo ci = BookmarkingConverter.ConvertComment(comment, BookmarkingServiceHelper.GetCurrentInstanse().BookmarkToAdd.Comments);
            ci.IsEditPermissions     = false;
            ci.IsResponsePermissions = false;

            bool isRoot = string.IsNullOrEmpty(comment.Parent) || comment.Parent.Equals(Guid.Empty.ToString(), StringComparison.CurrentCultureIgnoreCase);


            return(ASC.Web.Controls.CommentInfoHelper.CommentsHelper.GetOneCommentHtmlWithContainer(
                       defComment, ci, isRoot, false));
        }
예제 #4
0
 private string GetOneCommentHtmlWithContainer(Comment comment)
 {
     return(ASC.Web.Controls.CommentInfoHelper.CommentsHelper.GetOneCommentHtmlWithContainer(
                Comments,
                BookmarkingConverter.ConvertComment(comment, BookmarkingServiceHelper.GetCurrentInstanse().BookmarkToAdd.Comments),
                comment.Parent.Equals(Guid.Empty.ToString(), StringComparison.CurrentCultureIgnoreCase),
                false));
 }