private static EventComment ToComment(object[] r) { var comment = new EventComment { Feed = new Event { Id = Convert.ToInt64(r[0]), FeedType = (FeedType)Convert.ToInt32(r[1]), Caption = Convert.ToString(r[2]), Text = Convert.ToString(r[3]), Date = Convert.ToDateTime(r[4]), Creator = Convert.ToString(r[5]) } }; if (r[6] != null) { comment.Id = Convert.ToInt64(r[6]); comment.Comment = Convert.ToString(r[7]); comment.ParentId = Convert.ToInt64(r[8]); comment.Date = Convert.ToDateTime(r[9]); comment.Creator = Convert.ToString(r[10]); } return(comment); }
public EventCommentWrapper(FeedComment comment) { CreatedBy = EmployeeWraper.Get(Core.CoreContext.UserManager.GetUsers(new Guid(comment.Creator))); Updated = Created = (ApiDateTime)comment.Date; Id = comment.Id; Text = comment.Comment; ParentId = comment.ParentId; }
private static FeedComment ToFeedComment(EventComment comment) { return(new FeedComment(new Guid(comment.Creator)) { Id = comment.Id.ToString(CultureInfo.InvariantCulture), Description = HtmlUtility.GetFull(comment.Comment), Date = comment.Date }); }
public string GetPreview(string text, string commentID) { var storage = FeedStorageFactory.Create(); var comment = new FeedComment(1) { Date = TenantUtil.DateTimeNow(), Creator = SecurityContext.CurrentAccount.ID.ToString() }; if (!string.IsNullOrEmpty(commentID)) { comment = storage.GetFeedComment(long.Parse(commentID, CultureInfo.CurrentCulture)); } comment.Comment = text; var info = GetCommentInfo(comment); info.IsEditPermissions = false; info.IsResponsePermissions = false; var defComment = new CommentsList(); ConfigureComments(defComment, null); return CommentsHelper.GetOneCommentHtmlWithContainer( defComment, info, true, false); }
public AjaxResponse AddComment(string parentCommentId, string newsId, string text, string pid) { var resp = new AjaxResponse(); resp.rs1 = parentCommentId; var comment = new FeedComment(long.Parse(newsId)); comment.Comment = text; var storage = FeedStorageFactory.Create(); if (!string.IsNullOrEmpty(parentCommentId)) comment.ParentId = Convert.ToInt64(parentCommentId); var feed = storage.GetFeed(long.Parse(newsId, CultureInfo.CurrentCulture)); comment = storage.SaveFeedComment(feed, comment); var info = GetCommentInfo(comment); var defComment = new CommentsList(); ConfigureComments(defComment, feed); var visibleCommentsCount = 0; storage.GetFeedComments(feed.Id).ForEach((cmm) => { visibleCommentsCount += (cmm.Inactive ? 0 : 1); }); resp.rs2 = CommentsHelper.GetOneCommentHtmlWithContainer( defComment, info, comment.IsRoot(), visibleCommentsCount%2 == 1); return resp; }
private CommentInfo GetCommentInfo(FeedComment comment) { var info = new CommentInfo { CommentID = comment.Id.ToString(CultureInfo.CurrentCulture), UserID = new Guid(comment.Creator), TimeStamp = comment.Date, TimeStampStr = comment.Date.Ago(), IsRead = true, Inactive = comment.Inactive, CommentBody = comment.Comment, UserFullName = DisplayUserSettings.GetFullUserName(new Guid(comment.Creator)), UserAvatar = GetHtmlImgUserAvatar(new Guid(comment.Creator)), IsEditPermissions = CommunitySecurity.CheckPermissions(NewsConst.Action_Edit), IsResponsePermissions = CommunitySecurity.CheckPermissions(NewsConst.Action_Comment), UserPost = CoreContext.UserManager.GetUsers((new Guid(comment.Creator))).Title }; return info; }
private static FeedComment ToFeedComment(EventComment comment) { return new FeedComment(new Guid(comment.Creator)) { Id = comment.Id.ToString(CultureInfo.InvariantCulture), Description = HtmlSanitizer.Sanitize(comment.Comment), Date = comment.Date }; }
private static EventComment ToComment(object[] r) { var comment = new EventComment { Feed = new Event { Id = Convert.ToInt64(r[0]), FeedType = (FeedType)Convert.ToInt32(r[1]), Caption = Convert.ToString(r[2]), Text = Convert.ToString(r[3]), Date = Convert.ToDateTime(r[4]), Creator = Convert.ToString(r[5]) } }; if (r[6] != null) { comment.Id = Convert.ToInt64(r[6]); comment.Comment = Convert.ToString(r[7]); comment.ParentId = Convert.ToInt64(r[8]); comment.Date = Convert.ToDateTime(r[9]); comment.Creator = Convert.ToString(r[10]); } return comment; }
public EventCommentWrapper AddEventComments(int feedid, string content, long parentId) { if (parentId > 0 && FeedStorage.GetFeedComment(parentId) == null) throw new ItemNotFoundException("parent comment not found"); var comment = new FeedComment(feedid) { Comment = content, Creator = SecurityContext.CurrentAccount.ID.ToString(), FeedId = feedid, Date = DateTime.UtcNow, ParentId = parentId }; FeedStorage.SaveFeedComment(FeedStorage.GetFeed(feedid), comment); return new EventCommentWrapper(comment); }