Example #1
0
 public List<ArticleCategory> GetAllByArticleId(int ArticleId)
 {
     ArticleCategoryDAC _articleCategoryComponent = new ArticleCategoryDAC();
     IDataReader reader = _articleCategoryComponent.GetAllArticleCategory("ArticleId = " + ArticleId).CreateDataReader();
     List<ArticleCategory> _articleCategoryList = new List<ArticleCategory>();
     while (reader.Read())
     {
         if (_articleCategoryList == null)
             _articleCategoryList = new List<ArticleCategory>();
         ArticleCategory _articleCategory = new ArticleCategory();
         if (reader["ArticleCategoryId"] != DBNull.Value)
             _articleCategory.ArticleCategoryId = Convert.ToInt32(reader["ArticleCategoryId"]);
         if (reader["SiteCategoryId"] != DBNull.Value)
             _articleCategory.SiteCategoryId = Convert.ToInt32(reader["SiteCategoryId"]);
         if (reader["ArticleId"] != DBNull.Value)
             _articleCategory.ArticleId = Convert.ToInt32(reader["ArticleId"]);
         if (reader["PostDate"] != DBNull.Value)
             _articleCategory.PostDate = Convert.ToDateTime(reader["PostDate"]);
         _articleCategory.NewRecord = false;
         _articleCategoryList.Add(_articleCategory);
     } reader.Close();
     return _articleCategoryList;
 }
Example #2
0
 public ArticleCategory GetByID(int _articleCategoryId)
 {
     ArticleCategoryDAC _articleCategoryComponent = new ArticleCategoryDAC();
      IDataReader reader = _articleCategoryComponent.GetByIDArticleCategory(_articleCategoryId);
      ArticleCategory _articleCategory = null;
      while(reader.Read())
      {
          _articleCategory = new ArticleCategory();
          if(reader["ArticleCategoryId"] != DBNull.Value)
              _articleCategory.ArticleCategoryId = Convert.ToInt32(reader["ArticleCategoryId"]);
          if(reader["SiteCategoryId"] != DBNull.Value)
              _articleCategory.SiteCategoryId = Convert.ToInt32(reader["SiteCategoryId"]);
          if(reader["ArticleId"] != DBNull.Value)
              _articleCategory.ArticleId = Convert.ToInt32(reader["ArticleId"]);
          if(reader["PostDate"] != DBNull.Value)
              _articleCategory.PostDate = Convert.ToDateTime(reader["PostDate"]);
      _articleCategory.NewRecord = false;             }             reader.Close();
      return _articleCategory;
 }
Example #3
0
 public bool Update(ArticleCategory articlecategory ,int old_articleCategoryId)
 {
     ArticleCategoryDAC articlecategoryComponent = new ArticleCategoryDAC();
     return articlecategoryComponent.UpdateArticleCategory( articlecategory.SiteCategoryId,  articlecategory.ArticleId,  articlecategory.PostDate,  old_articleCategoryId);
 }
Example #4
0
 public bool Insert(ArticleCategory articlecategory)
 {
     int autonumber = 0;
     ArticleCategoryDAC articlecategoryComponent = new ArticleCategoryDAC();
     bool endedSuccessfuly = articlecategoryComponent.InsertNewArticleCategory( ref autonumber,  articlecategory.SiteCategoryId,  articlecategory.ArticleId,  articlecategory.PostDate);
     if(endedSuccessfuly)
     {
         articlecategory.ArticleCategoryId = autonumber;
     }
     return endedSuccessfuly;
 }