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;
        }
Esempio n. 2
0
        public ForumInfo(IForumPostInfo latestPost)
        {
            if (latestPost == null)
            {
                throw new ArgumentNullException("latestPost");
            }

            LatestPost = latestPost;
        }
Esempio n. 3
0
        public static string PostedOn(IForumPostInfo postInfo, string format)
        {
            if (postInfo == null)
            {
                return(string.Empty);
            }

            return(postInfo.PostedOn.ToString(format, CultureInfo.InvariantCulture));
        }
Esempio n. 4
0
        public ForumPost(Entity entity, IPortalViewEntity viewEntity, IForumPostInfo postInfo,
                         Lazy <ApplicationPath> getEditPath = null, Lazy <ApplicationPath> getDeletePath = null,
                         Lazy <bool> editable = null, Lazy <bool> canMarkAsAnswer = null, string url = null, IForumThread thread = null,
                         Lazy <bool> canEdit  = null)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (viewEntity == null)
            {
                throw new ArgumentNullException("viewEntity");
            }
            if (postInfo == null)
            {
                throw new ArgumentNullException("postInfo");
            }

            Entity           = entity;
            _viewEntity      = viewEntity;
            _editable        = editable;
            AttachmentInfo   = postInfo.AttachmentInfo ?? new IForumPostAttachmentInfo[] { };
            Author           = postInfo.Author;
            _getEditPath     = getEditPath ?? new Lazy <ApplicationPath>(() => null, LazyThreadSafetyMode.None);
            _getDeletePath   = getDeletePath ?? new Lazy <ApplicationPath>(() => null, LazyThreadSafetyMode.None);
            _canMarkAsAnswer = canMarkAsAnswer ?? new Lazy <bool>(() => false, LazyThreadSafetyMode.None);
            _canEdit         = canEdit ?? new Lazy <bool>(() => false, LazyThreadSafetyMode.None);
            _url             = url;
            Thread           = thread;

            Content          = entity.GetAttributeValue <string>("adx_content");
            IsAnswer         = entity.GetAttributeValue <bool?>("adx_isanswer").GetValueOrDefault();
            HelpfulVoteCount = entity.GetAttributeValue <int?>("adx_helpfulvotecount").GetValueOrDefault();
            Name             = entity.GetAttributeValue <string>("adx_name");
            PostedOn         = entity.GetAttributeValue <DateTime?>("adx_date").GetValueOrDefault(postInfo.PostedOn);
        }