private string GetHTMLComment(Comment comment) { var creator = Global.EngineFactory.GetParticipantEngine().GetByID(comment.CreateBy).UserInfo; var oCommentInfo = new CommentInfo { TimeStamp = comment.CreateOn, TimeStampStr = comment.CreateOn.Ago(), CommentBody = comment.Content, CommentID = comment.ID.ToString(), UserID = comment.CreateBy, UserFullName = creator.DisplayUserName(), Inactive = comment.Inactive, IsEditPermissions = ProjectSecurity.CanEditComment(Task != null ? Task.Project : null, comment), IsResponsePermissions = ProjectSecurity.CanCreateComment(), IsRead = true, UserAvatar = Global.GetHTMLUserAvatar(creator), UserPost = creator.Title }; if (commentList == null) { commentList = new CommentsList(); ConfigureComments(commentList, null); } return(CommentsHelper.GetOneCommentHtmlWithContainer( commentList, oCommentInfo, comment.Parent == Guid.Empty, false)); }
private string GetHTMLComment(Comment comment, bool isPreview) { var creator = Global.EngineFactory.GetParticipantEngine().GetByID(comment.CreateBy).UserInfo; var info = new CommentInfo { CommentID = comment.ID.ToString(), UserID = comment.CreateBy, TimeStamp = comment.CreateOn, TimeStampStr = comment.CreateOn.Ago(), UserPost = creator.Title, Inactive = comment.Inactive, CommentBody = comment.Content, UserFullName = DisplayUserSettings.GetFullUserName(creator), UserAvatar = Global.GetHTMLUserAvatar(creator) }; var defComment = new CommentsList(); ConfigureComments(defComment, null); if (!isPreview) { info.IsRead = true; info.IsEditPermissions = ProjectSecurity.CanEditComment(Task.Project, comment); info.IsResponsePermissions = ProjectSecurity.CanCreateComment(); } return(CommentsHelper.GetOneCommentHtmlWithContainer( defComment, info, comment.Parent == Guid.Empty, false)); }
private CommentInfo GetCommentInfo(IEnumerable <Comment> allComments, Comment parent) { var creator = Global.EngineFactory.GetParticipantEngine().GetByID(parent.CreateBy).UserInfo; var commentInfo = new CommentInfo { TimeStampStr = parent.CreateOn.Ago(), Inactive = parent.Inactive, IsRead = true, IsResponsePermissions = ProjectSecurity.CanCreateComment(), IsEditPermissions = ProjectSecurity.CanEditComment(Task.Project, parent), CommentID = parent.ID.ToString(), CommentBody = parent.Content, UserID = parent.CreateBy, UserFullName = creator.DisplayUserName(), UserPost = creator.Title, UserAvatar = Global.GetHTMLUserAvatar(creator), CommentList = new List <CommentInfo>(), }; if (allComments != null) { foreach (var comment in allComments.Where(comment => comment.Parent == parent.ID)) { commentInfo.CommentList.Add(GetCommentInfo(allComments, comment)); } } return(commentInfo); }
internal CommentInfo GetCommentInfo(IEnumerable <Comment> allComments, Comment comment, ProjectEntity entity) { var creator = EngineFactory.ParticipantEngine.GetByID(comment.CreateBy).UserInfo; var oCommentInfo = new CommentInfo { TimeStamp = comment.CreateOn, TimeStampStr = comment.CreateOn.Ago(), CommentBody = HtmlUtility.GetFull(comment.Content), CommentID = comment.OldGuidId.ToString(), UserID = comment.CreateBy, UserFullName = creator.DisplayUserName(), UserProfileLink = creator.GetUserProfilePageURL(), Inactive = comment.Inactive, IsEditPermissions = ProjectSecurity.CanEditComment(entity, comment), IsResponsePermissions = ProjectSecurity.CanCreateComment(entity), IsRead = true, UserAvatarPath = creator.GetBigPhotoURL(), UserPost = creator.Title, CommentList = new List <CommentInfo>() }; if (allComments != null) { foreach (var com in allComments.Where(com => com.Parent == comment.OldGuidId)) { oCommentInfo.CommentList.Add(GetCommentInfo(allComments, com, entity)); } } return(oCommentInfo); }
public CommentWrapper(ProjectApiBase projectApiBase, Comment comment, ProjectEntity entity) { Id = comment.OldGuidId; ParentId = comment.Parent; Text = comment.Content; Created = Updated = (ApiDateTime)comment.CreateOn; CreatedBy = projectApiBase.GetEmployeeWraper(comment.CreateBy); Inactive = comment.Inactive; CanEdit = ProjectSecurity.CanEditComment(entity, comment); }
private CommentInfo GetCommentInfo(Comment comment, ProjectEntity entity) { var creator = EngineFactory.ParticipantEngine.GetByID(comment.CreateBy).UserInfo; var oCommentInfo = new CommentInfo { TimeStamp = comment.CreateOn, TimeStampStr = comment.CreateOn.Ago(), CommentBody = comment.Content, CommentID = comment.OldGuidId.ToString(), UserID = comment.CreateBy, UserFullName = creator.DisplayUserName(), UserProfileLink = creator.GetUserProfilePageURL(), Inactive = comment.Inactive, IsEditPermissions = ProjectSecurity.CanEditComment(entity != null ? entity.Project : null, comment), IsResponsePermissions = ProjectSecurity.CanCreateComment(entity), IsRead = true, UserAvatarPath = creator.GetBigPhotoURL(), UserPost = creator.Title }; return(oCommentInfo); }
private string GetHTMLComment(Comment comment, bool isPreview) { var creator = Global.EngineFactory.GetParticipantEngine().GetByID(comment.CreateBy); var commentInfo = new CommentInfo { CommentID = comment.ID.ToString(), UserID = comment.CreateBy, TimeStamp = comment.CreateOn, TimeStampStr = comment.CreateOn.Ago(), UserPost = creator.UserInfo.Title, IsRead = true, Inactive = comment.Inactive, CommentBody = comment.Content, UserFullName = DisplayUserSettings.GetFullUserName(creator.UserInfo), UserAvatar = Global.GetHTMLUserAvatar(creator.UserInfo) }; var defComment = new CommentsList(); ConfigureComments(defComment, null); if (!isPreview) { var targetID = Convert.ToInt32(comment.TargetUniqID.Split('_')[1]); var target = Global.EngineFactory.GetMessageEngine().GetByID(targetID); Discussion = target; commentInfo.IsEditPermissions = ProjectSecurity.CanEditComment(Discussion, comment); commentInfo.IsResponsePermissions = ProjectSecurity.CanCreateComment(Discussion); commentInfo.IsRead = true; } return(CommentsHelper.GetOneCommentHtmlWithContainer( defComment, commentInfo, comment.Parent == Guid.Empty, false)); }
private string GetHTMLComment(Comment comment, bool isPreview) { var commentInfo = new CommentInfo { CommentID = comment.ID.ToString(), UserID = comment.CreateBy, TimeStamp = comment.CreateOn, TimeStampStr = comment.CreateOn.Ago(), UserPost = Global.EngineFactory.GetParticipantEngine().GetByID(comment.CreateBy).UserInfo.Title, IsRead = true, Inactive = comment.Inactive, CommentBody = comment.Content, UserFullName = DisplayUserSettings.GetFullUserName( Global.EngineFactory.GetParticipantEngine().GetByID(comment.CreateBy).UserInfo), UserAvatar = Global.GetHTMLUserAvatar(comment.CreateBy) }; var defComment = new CommentsList(); ConfigureComments(defComment, null); if (!isPreview) { commentInfo.IsEditPermissions = ProjectSecurity.CanEditComment(Discussion.Project, comment); commentInfo.IsResponsePermissions = ProjectSecurity.CanCreateComment(); var when = Global.EngineFactory.GetParticipantEngine().WhenReaded(Page.Participant.ID, Discussion.UniqID); commentInfo.IsRead = when.HasValue && when.Value > comment.CreateOn; } return(CommentsHelper.GetOneCommentHtmlWithContainer( defComment, commentInfo, comment.Parent == Guid.Empty, false)); }