public bool Insert(ArticleViews articleviews) { int autonumber = 0; ArticleViewsDAC articleviewsComponent = new ArticleViewsDAC(); bool endedSuccessfuly = articleviewsComponent.InsertNewArticleViews( ref autonumber, articleviews.ArticleID, articleviews.IPString, articleviews.DateViewed); if(endedSuccessfuly) { articleviews.ArticleViewID = autonumber; } return endedSuccessfuly; }
public ArticleViews GetByID(int _articleViewID) { ArticleViewsDAC _articleViewsComponent = new ArticleViewsDAC(); IDataReader reader = _articleViewsComponent.GetByIDArticleViews(_articleViewID); ArticleViews _articleViews = null; while(reader.Read()) { _articleViews = new ArticleViews(); if(reader["ArticleViewID"] != DBNull.Value) _articleViews.ArticleViewID = Convert.ToInt32(reader["ArticleViewID"]); if(reader["ArticleID"] != DBNull.Value) _articleViews.ArticleID = Convert.ToInt32(reader["ArticleID"]); if(reader["IPString"] != DBNull.Value) _articleViews.IPString = Convert.ToString(reader["IPString"]); if(reader["DateViewed"] != DBNull.Value) _articleViews.DateViewed = Convert.ToDateTime(reader["DateViewed"]); _articleViews.NewRecord = false; } reader.Close(); return _articleViews; }
public List<ArticleViews> GetAll() { ArticleViewsDAC _articleViewsComponent = new ArticleViewsDAC(); IDataReader reader = _articleViewsComponent.GetAllArticleViews().CreateDataReader(); List<ArticleViews> _articleViewsList = new List<ArticleViews>(); while(reader.Read()) { if(_articleViewsList == null) _articleViewsList = new List<ArticleViews>(); ArticleViews _articleViews = new ArticleViews(); if(reader["ArticleViewID"] != DBNull.Value) _articleViews.ArticleViewID = Convert.ToInt32(reader["ArticleViewID"]); if(reader["ArticleID"] != DBNull.Value) _articleViews.ArticleID = Convert.ToInt32(reader["ArticleID"]); if(reader["IPString"] != DBNull.Value) _articleViews.IPString = Convert.ToString(reader["IPString"]); if(reader["DateViewed"] != DBNull.Value) _articleViews.DateViewed = Convert.ToDateTime(reader["DateViewed"]); _articleViews.NewRecord = false; _articleViewsList.Add(_articleViews); } reader.Close(); return _articleViewsList; }
public bool Update(ArticleViews articleviews ,int old_articleViewID) { ArticleViewsDAC articleviewsComponent = new ArticleViewsDAC(); return articleviewsComponent.UpdateArticleViews( articleviews.ArticleID, articleviews.IPString, articleviews.DateViewed, old_articleViewID); }