Ejemplo n.º 1
0
        public static ArticleSummary CreateArticleSummaryFromReader(IDnaDataReader reader)
        {

            ArticleSummary articleSummary = new ArticleSummary();

            articleSummary.H2G2ID = reader.GetInt32NullAsZero("h2g2id");
            articleSummary.Name = reader.GetStringNullAsEmpty("subject");
            articleSummary.StrippedName = StringUtils.StrippedName(reader.GetStringNullAsEmpty("subject"));

            if (reader.DoesFieldExist("Type"))
            {
                articleSummary.Type = Article.GetArticleTypeFromInt(reader.GetInt32NullAsZero("Type"));
            }

            if (reader.DoesFieldExist("editor"))
            {
                articleSummary.Editor = new UserElement() { user = User.CreateUserFromReader(reader, "editor") };
            }
                        
            articleSummary.DateCreated = new DateElement(reader.GetDateTime("datecreated"));

            if (reader.DoesFieldExist("lastupdated"))
            {
                articleSummary.LastUpdated = new DateElement(reader.GetDateTime("lastupdated")); ;
            }

            articleSummary.Status = ArticleStatus.GetStatus(reader.GetInt32NullAsZero("status"));

            return articleSummary;
        }
Ejemplo n.º 2
0
        public static List<ArticleSummary> GetChildArticles(IDnaDataReaderCreator readerCreator, int nodeID, int siteID)
        {
 
            List<ArticleSummary> childArticles = new List<ArticleSummary>();
            using (IDnaDataReader reader = readerCreator.CreateDnaDataReader("getarticlesinhierarchynode"))
            {
                reader.AddParameter("nodeID", nodeID);
                reader.AddParameter("currentsiteid", siteID);
                reader.Execute();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ArticleSummary childArticle = new ArticleSummary();
                        childArticle.H2G2ID = reader.GetInt32NullAsZero("h2g2id");
                        childArticle.Name = reader.GetStringNullAsEmpty("subject");
                        childArticle.StrippedName = StringUtils.StrippedName(reader.GetStringNullAsEmpty("subject"));
                        childArticle.Type = Article.GetArticleTypeFromInt(reader.GetInt32NullAsZero("Type"));
                        childArticle.Editor = new UserElement() { user = User.CreateUserFromReader(reader, "editor")} ;
                        childArticle.DateCreated = new DateElement(reader.GetDateTime("datecreated"));
                        childArticle.LastUpdated = new DateElement(reader.GetDateTime("lastupdated")); ;
                        //childArticle.SortOrder = null;
                        childArticle.Status = ArticleStatus.GetStatus(reader.GetInt32NullAsZero("status"));
                        childArticles.Add(childArticle);
                    }
                }
            }
            return childArticles;
        }
Ejemplo n.º 3
0
 public static ArticleSummary CreateChildArticles()
 {
     ArticleSummary returnValue = new ArticleSummary()
     {
         DateCreated = new DateElement(DateTime.Now),
         Editor = new UserElement()
         {
             user = UserTest.CreateTestUser()
         },
         Type = Article.ArticleType.Article,
         H2G2ID = 1,
         LastUpdated = new DateElement(DateTime.Now),
         Name = "Test",
         SortOrder = 1,
         Status = new ArticleStatus()
         {                   
             Type = 1,
             Value = "1"
         },
          StrippedName = "StrippedName"
     }; 
    
     return returnValue;
 }