/// <summary> /// 获取所有已发送短信列表,默认按时间排序 /// </summary> /// <returns></returns> public SentSMSListViewData GetSentSMSList() { SentSMSListViewData SentList = new SentSMSListViewData(); SentList.SentSMSList = (from s in CQGJ.T_SendTask orderby s.SendTime descending select s).ToList(); return SentList; }
/// <summary> /// 分页显示已发送短信 /// </summary> /// <param name="id"></param> public void ListSentSMSByPager(int id) { // 将id转化为page(由于Global文件中路由设置的顺序问题) int page = id; // 获取所有已发送短信 SentSMSListViewData AllOfSentSMS = GetSentSMSList(); // 计算已发送短信总数 int count = 0; count = AllOfSentSMS.SentSMSList.Count(); // 定义每页中显示的已发送短信 SentSMSListViewData SentSMSPerPage = new SentSMSListViewData(); // 每页显示50条已发送短信 SentSMSPerPage.SentSMSList = AllOfSentSMS.SentSMSList.Skip(50 * (page - 1)).Take(50).ToList(); // 设置分页信息 UrlManager urlManager = new DefaultUrlManager(count, 50); Pager pager = new Pager(urlManager); // 绑定分页信息 SentSMSPerPage.PagerString = pager.PagerString; // 页面渲染 RenderView("ListSentSMS", SentSMSPerPage); }
/// <summary> /// 分页显示已发送短信 /// </summary> /// <param name="id"></param> public ActionResult SentList(int id) { // 将id转化为page int page = id; // 获取所有已发送短信 SentSMSListViewData AllOfSentSMS = GetSentSMSList(); // 计算已发送短信总数 int count = 0; count = AllOfSentSMS.SentSMSList.Count(); // 定义每页中显示的已发送短信 SentSMSListViewData SentSMSPerPage = new SentSMSListViewData(); // 每页显示50条已发送短信 SentSMSPerPage.SentSMSList = AllOfSentSMS.SentSMSList.Skip(50 * (page - 1)).Take(50).ToList(); // 设置分页信息 UrlManager urlManager = new DefaultUrlManager(count, 50); Pager pager = new Pager(urlManager); // 绑定分页信息 SentSMSPerPage.PagerString = pager.PagerString; // 页面渲染 return View("SentList", SentSMSPerPage); }