AJH.CMS.Core.Data.ArticleDataMapper.FillFromReader C# (CSharp) Method

FillFromReader() static private method

static private FillFromReader ( Article article, System.Data.SqlClient.SqlDataReader reader ) : void
article AJH.CMS.Core.Entities.Article
reader System.Data.SqlClient.SqlDataReader
return void
        internal static void FillFromReader(Article article, SqlDataReader reader)
        {
            int colIndex = 0;
            colIndex = reader.GetOrdinal(CN_ARTICLE_CATEGORY_ID);
            if (!reader.IsDBNull(colIndex))
                article.CategoryID = reader.GetInt32(colIndex);

            int days = 0, seconds = 0;
            colIndex = reader.GetOrdinal(CN_ARTICLE_CREATION_DAY);
            if (!reader.IsDBNull(colIndex))
                days = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_CREATION_SEC);
            if (!reader.IsDBNull(colIndex))
                seconds = reader.GetInt32(colIndex);

            article.CreationDate = CMSCoreHelper.GetDateTime(days, seconds);

            colIndex = reader.GetOrdinal(CN_ARTICLE_DESCRIPTION);
            if (!reader.IsDBNull(colIndex))
                article.Description = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_DETAILS);
            if (!reader.IsDBNull(colIndex))
                article.Details = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_ID);
            if (!reader.IsDBNull(colIndex))
                article.ID = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_IMAGE);
            if (!reader.IsDBNull(colIndex))
                article.Image = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_IS_DELETED);
            if (!reader.IsDBNull(colIndex))
                article.IsDeleted = reader.GetBoolean(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_KEYWORDS);
            if (!reader.IsDBNull(colIndex))
                article.KeyWords = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_LANGUAGE_ID);
            if (!reader.IsDBNull(colIndex))
                article.LanguageID = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_NAME);
            if (!reader.IsDBNull(colIndex))
                article.Name = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_SUMMARY);
            if (!reader.IsDBNull(colIndex))
                article.Summary = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_PORTAL_ID);
            if (!reader.IsDBNull(colIndex))
                article.PortalID = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_SEO_NAME);
            if (!reader.IsDBNull(colIndex))
                article.SEOName = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_URL);
            if (!reader.IsDBNull(colIndex))
                article.URL = reader.GetString(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_TYPE);
            if (!reader.IsDBNull(colIndex))
                article.ArticleType = (CMSEnums.ArticleType)reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_ORDER);
            if (!reader.IsDBNull(colIndex))
                article.Order = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_CREATED_BY);
            if (!reader.IsDBNull(colIndex))
                article.CreatedBy = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_PARENT_OBJ_ID);
            if (!reader.IsDBNull(colIndex))
                article.ParentObjectID = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(CN_ARTICLE_VIEW_COUNT);
            if (!reader.IsDBNull(colIndex))
                article.ViewCount = reader.GetInt32(colIndex);

            colIndex = reader.GetOrdinal(PublishDataMapper.CN_PUBLISH_TYPE_ID);
            if (!reader.IsDBNull(colIndex))
                article.IsPublished = reader.GetInt32(colIndex) == (int)CMSEnums.PublishType.PublishNow;
        }