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); }
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>())); }
public object SaveBookmarkAjax(string BookmarkUrl, string BookmarkName, string BookmarkDescription, string BookmarkTags, string uniqueID) { var url = UpdateURL(BookmarkUrl); var b = _serviceHelper.AddBookmark(url, BookmarkName, BookmarkDescription, BookmarkTags); b = _serviceHelper.GetBookmarkWithUserBookmarks(url); var displayMode = BookmarkingBusinessFactory.GetDisplayMode(); var bookmarkString = GetBookmarkAsString(b, new Guid(uniqueID)); if (BookmarkDisplayMode.SelectedBookmark == displayMode) { var userImage = BookmarkingServiceHelper.GetHTMLUserAvatar(); var userPageLink = BookmarkingServiceHelper.GetUserPageLink(); var ub = _serviceHelper.GetCurrentUserBookmark(b); var userBookmarkDescription = BookmarkingServiceHelper.GetUserBookmarkDescriptionIfChanged(ub); var dateAdded = BookmarkingConverter.GetDateAsString(ub.DateAdded); var divID = ub.UserID.ToString(); var userBookmarks = _serviceHelper.GetUserBookmarks(b); var addedBy = new BookmarkAddedByUserContorl().GetAddedByTableItem(userBookmarks.Count % 2 != 0, userImage, userPageLink, userBookmarkDescription, dateAdded, divID); return(new { BookmarkString = bookmarkString, AddedBy = addedBy, DivID = divID }); } return(new { BookmarkString = bookmarkString, AddedBy = string.Empty }); }
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)); }
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)); }
public string GetDateAddedAsString(object date) { try { var dateAdded = (DateTime)date; return(BookmarkingConverter.GetDateAsString(dateAdded)); } catch { return(string.Empty); } }
public void InitComments() { ConfigureComments(CommentList); CommentList.Items = BookmarkingConverter.ConvertCommentList(BookmarkComments); Comments = CommentList; }