public CommentTest() { LoginTest login = new LoginTest(); AddDependentObject(login); mComment = new Comment(); mComment.IpAddress = "127.0.0.1"; mComment.Created = mComment.Modified = DateTime.UtcNow; mComment.Text = Guid.NewGuid().ToString(); ; mComment.OwnerLogin = login.Login; }
public static bool HasAccess(ISession session, DBlog.Data.Comment comment, string ticket) { if (comment.PostComments == null || comment.PostComments.Count == 0) { return(true); } foreach (PostComment pi in comment.PostComments) { if (TransitPost.GetAccess(session, pi.Post, ticket)) { return(true); } } return(false); }
public TransitComment(ISession session, DBlog.Data.Comment o, bool hasaccess) : base(o.Id) { if (hasaccess) { Text = o.Text; IpAddress = o.IpAddress; LoginName = o.OwnerLogin.Name; LoginWebsite = o.OwnerLogin.Website; } LoginId = o.OwnerLogin.Id; ParentCommentId = (o.Threads != null && o.Threads.Count > 0) ? ((Thread)o.Threads[0]).ParentComment.Id : 0; Created = o.Created; Modified = o.Modified; }
public TransitAssociatedComment(ISession session, int id, DBlog.Data.Comment o, bool hasaccess) : base(id) { AssociatedId = id; CommentId = o.Id; if (hasaccess) { CommentIpAddress = o.IpAddress; CommentText = o.Text; if (o.OwnerLogin != null) { CommentLoginName = o.OwnerLogin.Name; CommentLoginWebsite = o.OwnerLogin.Website; } CommentCreated = o.Created; CommentModified = o.Modified; CommentLevel = GetLevel(o); } }
public static int GetLevel(Comment comment) { int result = 0; do { if (comment.Threads == null) break; if (comment.Threads.Count == 0) break; result++; comment = ((Thread)comment.Threads[0]).ParentComment; } while (comment != null); return result; }
public TransitComment(ISession session, DBlog.Data.Comment o, string ticket) : this(session, o, HasAccess(session, o, ticket)) { }
public TransitAssociatedComment(ISession session, int id, DBlog.Data.Comment o) : this(session, id, o, true) { }