/// <summary> /// 分页查询新闻信息 /// </summary> /// <param name="stuName"></param> /// <param name="pageSize"></param> /// <param name="currentCount"></param> /// <param name="TotalCount"></param> /// <returns></returns> public List <News> GetNews(string CategoryId, int pageSize, int currentCount, out int TotalCount) { string order = string.Format("PublishTime DESC"); string TableName = string.Format("News"); string Where = "1=1"; if (!string.IsNullOrEmpty(CategoryId)) { Where += string.Format(" And CategoryId='{0}'", CategoryId); } DataSet ds = SQLCommon.GetList(pageSize, order, currentCount, TableName, Where, out TotalCount); List <News> result = new List <News>(); if (ds != null && ds.Tables.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { result.Add(new News() { CategoryId = Convert.ToInt32(dr["CategoryId"]), NewsContents = dr["NewsContents"].ToString(), NewsId = Convert.ToInt32(dr["NewsId"]), NewsTitle = dr["NewsTitle"].ToString(), PublishTime = Convert.ToDateTime(dr["PublishTime"].ToString()) }); } } return(result); }