public IList<Core.Business.Web_News> GetAllWeb_News() { IList<Core.Business.Web_News> web_Newslist = new List<Core.Business.Web_News>(); SqlServerUtility sql = new SqlServerUtility(); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllWeb_News); if (reader != null) { while (reader.Read()) { Core.Business.Web_News web_News = new Core.Business.Web_News(); if (!reader.IsDBNull(0)) web_News.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) web_News.News_Content = reader.GetString(1); if (!reader.IsDBNull(2)) web_News.News_PubDate = reader.GetDateTime(2); if (!reader.IsDBNull(3)) web_News.News_Title = reader.GetString(3); if (!reader.IsDBNull(4)) web_News.Module_Code = reader.GetString(4); if (!reader.IsDBNull(5)) web_News.Manager_Code = reader.GetString(5); web_News.MarkOld(); web_Newslist.Add(web_News); } reader.Close(); } return web_Newslist; }
public IList<CY.GFive.Core.Business.Web_News> Search(string strModuleCode, string keyword) { IList<Core.Business.Web_News> list_news = new List<Core.Business.Web_News>(); SqlServerUtility sqlhelper = new SqlServerUtility(); SqlDataReader reader; if (!string.IsNullOrEmpty(keyword) && (keyword.Trim() != "")) { sqlhelper.AddParameter("@KeyWord", SqlDbType.VarChar, keyword.Trim(), 50); } if (!strModuleCode.Trim().Equals("")) { sqlhelper.AddParameter("@Module_Code", SqlDbType.VarChar, strModuleCode, 10); reader = sqlhelper.ExecuteSqlReader(SqlSelectByModuleCodeSearch.ToString()); } else { if (!string.IsNullOrEmpty(keyword) && (keyword.Trim() != "")) { reader = sqlhelper.ExecuteSqlReader(SqlGetAllWeb_NewsSearch.ToString()); } else // ȫ�� { reader = sqlhelper.ExecuteSqlReader(SqlGetAllWeb_News); } } if (reader != null && !reader.IsClosed) { while (reader.Read()) { Core.Business.Web_News web_News = new Core.Business.Web_News(); if (!reader.IsDBNull(0)) web_News.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) web_News.News_Content = reader.GetString(1); if (!reader.IsDBNull(2)) web_News.News_PubDate = reader.GetDateTime(2); if (!reader.IsDBNull(3)) web_News.IsCheck = reader.GetBoolean(3); if (!reader.IsDBNull(4)) web_News.News_Title = reader.GetString(4); if (!reader.IsDBNull(5)) web_News.Module_Code = reader.GetString(5); if (!reader.IsDBNull(6)) web_News.Manager_Code = reader.GetString(6); web_News.MarkOld(); list_news.Add(web_News); } reader.Close(); return list_news; } return null; }