public List<ArticleSources> GetAllByArticleID(int ArticleID) { ArticleSourcesDAC _articleSourcesComponent = new ArticleSourcesDAC(); IDataReader reader = _articleSourcesComponent.GetAllArticleSources("ArticleID = " + ArticleID).CreateDataReader(); List<ArticleSources> _articleSourcesList = new List<ArticleSources>(); while (reader.Read()) { if (_articleSourcesList == null) _articleSourcesList = new List<ArticleSources>(); ArticleSources _articleSources = new ArticleSources(); if (reader["ArticleSourceID"] != DBNull.Value) _articleSources.ArticleSourceID = Convert.ToInt32(reader["ArticleSourceID"]); if (reader["SourceID"] != DBNull.Value) _articleSources.SourceID = Convert.ToInt32(reader["SourceID"]); if (reader["ArticleID"] != DBNull.Value) _articleSources.ArticleID = Convert.ToInt32(reader["ArticleID"]); _articleSources.NewRecord = false; _articleSourcesList.Add(_articleSources); } reader.Close(); return _articleSourcesList; }
public ArticleSources GetByID(int _articleSourceID) { ArticleSourcesDAC _articleSourcesComponent = new ArticleSourcesDAC(); IDataReader reader = _articleSourcesComponent.GetByIDArticleSources(_articleSourceID); ArticleSources _articleSources = null; while(reader.Read()) { _articleSources = new ArticleSources(); if(reader["ArticleSourceID"] != DBNull.Value) _articleSources.ArticleSourceID = Convert.ToInt32(reader["ArticleSourceID"]); if(reader["SourceID"] != DBNull.Value) _articleSources.SourceID = Convert.ToInt32(reader["SourceID"]); if(reader["ArticleID"] != DBNull.Value) _articleSources.ArticleID = Convert.ToInt32(reader["ArticleID"]); _articleSources.NewRecord = false; } reader.Close(); return _articleSources; }
public bool Update(ArticleSources articlesources ,int old_articleSourceID) { ArticleSourcesDAC articlesourcesComponent = new ArticleSourcesDAC(); return articlesourcesComponent.UpdateArticleSources( articlesources.SourceID, articlesources.ArticleID, old_articleSourceID); }
public bool Insert(ArticleSources articlesources) { int autonumber = 0; ArticleSourcesDAC articlesourcesComponent = new ArticleSourcesDAC(); bool endedSuccessfuly = articlesourcesComponent.InsertNewArticleSources( ref autonumber, articlesources.SourceID, articlesources.ArticleID); if(endedSuccessfuly) { articlesources.ArticleSourceID = autonumber; } return endedSuccessfuly; }