public List<ArticleTag> GetAll() { ArticleTagDAC _articleTagComponent = new ArticleTagDAC(); IDataReader reader = _articleTagComponent.GetAllArticleTag().CreateDataReader(); List<ArticleTag> _articleTagList = new List<ArticleTag>(); while(reader.Read()) { if(_articleTagList == null) _articleTagList = new List<ArticleTag>(); ArticleTag _articleTag = new ArticleTag(); if(reader["ArticleTagId"] != DBNull.Value) _articleTag.ArticleTagId = Convert.ToInt32(reader["ArticleTagId"]); if(reader["ArticleId"] != DBNull.Value) _articleTag.ArticleId = Convert.ToInt32(reader["ArticleId"]); if(reader["Name"] != DBNull.Value) _articleTag.Name = Convert.ToString(reader["Name"]); if(reader["LanguageId"] != DBNull.Value) _articleTag.LanguageId = Convert.ToInt32(reader["LanguageId"]); if(reader["PostDate"] != DBNull.Value) _articleTag.PostDate = Convert.ToDateTime(reader["PostDate"]); _articleTag.NewRecord = false; _articleTagList.Add(_articleTag); } reader.Close(); return _articleTagList; }
public bool Insert(ArticleTag articletag) { int autonumber = 0; ArticleTagDAC articletagComponent = new ArticleTagDAC(); bool endedSuccessfuly = articletagComponent.InsertNewArticleTag( ref autonumber, articletag.ArticleId, articletag.Name, articletag.LanguageId, articletag.PostDate); if(endedSuccessfuly) { articletag.ArticleTagId = autonumber; } return endedSuccessfuly; }
public ArticleTag GetByID(int _articleTagId) { ArticleTagDAC _articleTagComponent = new ArticleTagDAC(); IDataReader reader = _articleTagComponent.GetByIDArticleTag(_articleTagId); ArticleTag _articleTag = null; while(reader.Read()) { _articleTag = new ArticleTag(); if(reader["ArticleTagId"] != DBNull.Value) _articleTag.ArticleTagId = Convert.ToInt32(reader["ArticleTagId"]); if(reader["ArticleId"] != DBNull.Value) _articleTag.ArticleId = Convert.ToInt32(reader["ArticleId"]); if(reader["Name"] != DBNull.Value) _articleTag.Name = Convert.ToString(reader["Name"]); if(reader["LanguageId"] != DBNull.Value) _articleTag.LanguageId = Convert.ToInt32(reader["LanguageId"]); if(reader["PostDate"] != DBNull.Value) _articleTag.PostDate = Convert.ToDateTime(reader["PostDate"]); _articleTag.NewRecord = false; } reader.Close(); return _articleTag; }
public bool Update(ArticleTag articletag ,int old_articleTagId) { ArticleTagDAC articletagComponent = new ArticleTagDAC(); return articletagComponent.UpdateArticleTag( articletag.ArticleId, articletag.Name, articletag.LanguageId, articletag.PostDate, old_articleTagId); }