//------------------------------------------------------------------------------------------------------------------- private List <ArticleContents> Init(string LogFilePath, string LogFileName, SqlCommand cmd) { SqlConnection con = db.getConnection(); cmd.Connection = con; List <ArticleContents> l_ArticleContents = new List <ArticleContents>(); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SmartDataReader smartReader = new SmartDataReader(reader); while (smartReader.Read()) { ArticleContents m_ArticleContents = new ArticleContents(db.ConnectionString); m_ArticleContents.ArticleContentId = smartReader.GetInt32("ArticleContentId"); m_ArticleContents.ArticleId = smartReader.GetInt32("ArticleId"); m_ArticleContents.RawContent = smartReader.GetString("RawContent"); m_ArticleContents.MediaItemId = smartReader.GetInt32("MediaItemId"); m_ArticleContents.CrUserId = smartReader.GetInt32("CrUserId"); m_ArticleContents.CrDateTime = smartReader.GetDateTime("CrDateTime"); l_ArticleContents.Add(m_ArticleContents); } smartReader.disposeReader(reader); db.closeConnection(con); } catch (SqlException ex) { LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name); } return(l_ArticleContents); }
//-------------------------------------------------------------------------------------------------------------------- public ArticleContents GetByArticleId(string LogFilePath, string LogFileName, int ArticleId) { ArticleContents RetVal = new ArticleContents(db.ConnectionString); try { List <ArticleContents> list = GetListByArticleId(LogFilePath, LogFileName, ArticleId); if (list.Count > 0) { RetVal = (ArticleContents)list[0]; } } catch (Exception ex) { LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name); } return(RetVal); }