public List<ArticleComment> GetAll() { ArticleCommentDAC _articleCommentComponent = new ArticleCommentDAC(); IDataReader reader = _articleCommentComponent.GetAllArticleComment().CreateDataReader(); List<ArticleComment> _articleCommentList = new List<ArticleComment>(); while(reader.Read()) { if(_articleCommentList == null) _articleCommentList = new List<ArticleComment>(); ArticleComment _articleComment = new ArticleComment(); if(reader["ArticleCommentId"] != DBNull.Value) _articleComment.ArticleCommentId = Convert.ToInt32(reader["ArticleCommentId"]); if(reader["ArticleId"] != DBNull.Value) _articleComment.ArticleId = Convert.ToInt32(reader["ArticleId"]); if(reader["ArticleComment"] != DBNull.Value) _articleComment.ArticleCommentContent = Convert.ToString(reader["ArticleComment"]); if(reader["ModifiedDate"] != DBNull.Value) _articleComment.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); if(reader["PersonId"] != DBNull.Value) _articleComment.PersonId = Convert.ToInt32(reader["PersonId"]); if(reader["CommentStatusId"] != DBNull.Value) _articleComment.CommentStatusId = Convert.ToInt32(reader["CommentStatusId"]); _articleComment.NewRecord = false; _articleCommentList.Add(_articleComment); } reader.Close(); return _articleCommentList; }
public ArticleComment GetByID(int _articleCommentId) { ArticleCommentDAC _articleCommentComponent = new ArticleCommentDAC(); IDataReader reader = _articleCommentComponent.GetByIDArticleComment(_articleCommentId); ArticleComment _articleComment = null; while(reader.Read()) { _articleComment = new ArticleComment(); if(reader["ArticleCommentId"] != DBNull.Value) _articleComment.ArticleCommentId = Convert.ToInt32(reader["ArticleCommentId"]); if(reader["ArticleId"] != DBNull.Value) _articleComment.ArticleId = Convert.ToInt32(reader["ArticleId"]); if(reader["ArticleComment"] != DBNull.Value) _articleComment.ArticleCommentContent = Convert.ToString(reader["ArticleComment"]); if(reader["ModifiedDate"] != DBNull.Value) _articleComment.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); if(reader["PersonId"] != DBNull.Value) _articleComment.PersonId = Convert.ToInt32(reader["PersonId"]); if(reader["CommentStatusId"] != DBNull.Value) _articleComment.CommentStatusId = Convert.ToInt32(reader["CommentStatusId"]); _articleComment.NewRecord = false; } reader.Close(); return _articleComment; }
public bool Insert(ArticleComment articlecomment) { int autonumber = 0; ArticleCommentDAC articlecommentComponent = new ArticleCommentDAC(); bool endedSuccessfuly = articlecommentComponent.InsertNewArticleComment(ref autonumber, articlecomment.ArticleId, articlecomment.ArticleCommentContent, articlecomment.ModifiedDate, articlecomment.PersonId, articlecomment.CommentStatusId); if(endedSuccessfuly) { articlecomment.ArticleCommentId = autonumber; } return endedSuccessfuly; }
public bool Update(ArticleComment articlecomment ,int old_articleCommentId) { ArticleCommentDAC articlecommentComponent = new ArticleCommentDAC(); return articlecommentComponent.UpdateArticleComment( articlecomment.ArticleId, articlecomment.ArticleCommentContent, articlecomment.ModifiedDate, articlecomment.PersonId, articlecomment.CommentStatusId, old_articleCommentId); }