public ForumThreadInfo(IForumAuthor author, DateTime postedOn, IForumThreadType threadType, IEnumerable <IForumThreadTag> tags, IForumPostInfo latestPost)
        {
            if (author == null)
            {
                throw new ArgumentNullException("author");
            }
            if (threadType == null)
            {
                throw new ArgumentNullException("threadType");
            }
            if (tags == null)
            {
                throw new ArgumentNullException("tags");
            }
            if (latestPost == null)
            {
                throw new ArgumentNullException("latestPost");
            }

            Author     = author;
            PostedOn   = postedOn;
            ThreadType = threadType;
            Tags       = tags.ToArray();
            LatestPost = latestPost;
        }
 public static string AuthorUrl(this UrlHelper urlHelper, IForumAuthor author)
 {
     try
     {
         return(author == null || author.EntityReference == null
                                            ? _defaultAuthorUrl
                                            : urlHelper.RouteUrl("PublicProfileForumPosts", new { contactId = author.EntityReference.Id }));
     }
     catch
     {
         return(_defaultAuthorUrl);
     }
 }
 public AuthorDrop(IPortalLiquidContext portalLiquidContext, IForumAuthor author)
     : this(
         portalLiquidContext,
         author.DisplayName,
         author.EmailAddress,
         author.EntityReference.Id,
         url => url.RouteUrl("PublicProfileForumPosts", new { contactId = author.EntityReference.Id }))
 {
     if (author == null)
     {
         throw new ArgumentNullException("author");
     }
 }
Ejemplo n.º 4
0
        public ForumPostInfo(EntityReference entityReference, IForumAuthor author, DateTime postedOn,
                             IEnumerable <IForumPostAttachmentInfo> attachmentInfo = null, EntityReference forumThread = null)
        {
            if (entityReference == null)
            {
                throw new ArgumentNullException("entityReference");
            }
            //if (author == null) throw new ArgumentNullException("author");

            EntityReference = entityReference;
            Author          = author;
            PostedOn        = postedOn;
            AttachmentInfo  = attachmentInfo == null ? new IForumPostAttachmentInfo[] {} : attachmentInfo.ToArray();
            ThreadEntity    = forumThread;
        }
Ejemplo n.º 5
0
        public ForumThreadSubmission(string name, DateTime postedOn, IForumAuthor author, IForumThreadType threadType)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Value can't be null or empty.", "name");
            }
            if (postedOn.Kind != DateTimeKind.Utc)
            {
                throw new ArgumentException("Value must be UTC.", "postedOn");
            }
            if (author == null)
            {
                throw new ArgumentNullException("author");
            }

            Name       = name;
            PostedOn   = postedOn;
            Author     = author;
            ThreadType = threadType;
        }
Ejemplo n.º 6
0
        private static IForumPostInfo GetForumPostInfo(string alias, Entity entity, IForumAuthor author)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (author == null)
            {
                throw new ArgumentNullException("author");
            }

            IForumPostInfo unknownLatestPostInfo = new UnknownForumPostInfo();
            var            latestPostId          = entity.GetAttributeAliasedValue <Guid?>("{0}.adx_communityforumpostid".FormatWith(alias));

            return(latestPostId == null
                                ? unknownLatestPostInfo
                                : new ForumPostInfo(
                       new EntityReference("adx_communityforumpost", latestPostId.Value),
                       author,
                       entity.GetAttributeAliasedValue <DateTime?>("{0}.adx_date".FormatWith(alias)).GetValueOrDefault(unknownLatestPostInfo.PostedOn)));
        }
Ejemplo n.º 7
0
        public HtmlForumPostSubmission(string name, string htmlContent, DateTime postedOn, IForumAuthor author)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Value can't be null or empty.", "name");
            }
            if (postedOn.Kind != DateTimeKind.Utc)
            {
                throw new ArgumentException("Value must be UTC.", "postedOn");
            }
            if (author == null)
            {
                throw new ArgumentNullException("author");
            }

            Name        = name;
            Content     = SafeHtml.SafeHtmSanitizer.GetSafeHtml(htmlContent ?? string.Empty);
            PostedOn    = postedOn;
            Author      = author;
            Attachments = new List <IForumPostAttachment>();
        }
 public static string UserImageUrl(this UrlHelper urlHelper, IForumAuthor author, int?size = null)
 {
     return(author == null ? null : urlHelper.UserImageUrl(author.EmailAddress, size));
 }