Ejemplo n.º 1
0
        private IBoardPostEntity LoadPost(IEsentSession session, ref LoadPostDataContext loadContext, bool getPostCount, PostStoreEntityType?entityType)
        {
            BasicEntityInfo    bi = default(BasicEntityInfo);
            PostModelStorePost r  = IsOriginalPageSequence(entityType) ? new PostModelStorePostWithSequence() : new PostModelStorePost();

            SetPostData(session, ref loadContext, getPostCount, r, ref bi);
            return(r);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Заполнить данные в объекте поста.
 /// </summary>
 /// <param name="post">Объект поста.</param>
 /// <param name="linkSerialization">Сервис сериализации ссылок.</param>
 /// <param name="posterName">Имя постера.</param>
 internal void FillPostData(PostModelStorePost post, ILinkSerializationService linkSerialization, string posterName)
 {
     if (post == null)
     {
         throw new ArgumentNullException(nameof(post));
     }
     if (linkSerialization == null)
     {
         throw new ArgumentNullException(nameof(linkSerialization));
     }
     if (Country?.ImageLink != null)
     {
         post.Country = new PostModelStorePost.CountryFlag()
         {
             ImageLink = linkSerialization.Deserialize(Country.ImageLink)
         };
     }
     if (Icon?.ImageLink != null)
     {
         post.Icon = new PostModelStorePost.PostIcon()
         {
             ImageLink   = linkSerialization.Deserialize(Icon.ImageLink),
             Description = Icon.Description
         };
     }
     if (Poster != null || posterName != null)
     {
         post.Poster = new PostModelStorePost.PosterInfo()
         {
             Name         = posterName,
             Tripcode     = Poster?.Tripcode,
             NameColor    = Poster?.NameColor,
             NameColorStr = Poster?.NameColorStr
         };
     }
     post.UniqueId = UniqueId;
     post.Email    = Email;
     post.Hash     = Hash;
 }
Ejemplo n.º 3
0
 private void SetPostData(IEsentSession session, ref LoadPostDataContext loadContext, bool getPostCount, PostModelStorePost data, ref BasicEntityInfo bi)
 {
     SetPostData(session, ref loadContext, loadContext.table.Views.PostFullLoadView.Fetch(), getPostCount, data, ref bi);
 }
Ejemplo n.º 4
0
        private void SetPostData(IEsentSession session, ref LoadPostDataContext loadContext, PostsTable.ViewValues.PostFullLoadView v, bool getPostCount, PostModelStorePost data, ref BasicEntityInfo bi)
        {
            SetPostLightData(session, v, getPostCount, data, ref bi);
            var posterName = v.PosterName;
            var otherData  = DeserializeDataContract <PostOtherData>(v.OtherDataBinary);

            otherData?.FillPostData(data, LinkSerialization, posterName);
            data.Comment    = ObjectSerializationService.Deserialize(v.Document) as IPostDocument;
            data.LoadedTime = FromUtcToOffset(v.LoadedTime) ?? DateTimeOffset.MinValue;
            data.MediaFiles = LoadPostMedia(loadContext.mediaTable ?? throw new InvalidOperationException("Таблица медиафайлов не открыта"), ref bi, false);
            data.Quotes     = LoadQuotesForPost(loadContext.quotesTable ?? throw new InvalidOperationException("Таблица цитат не открыта"), false, ref bi);
        }