/// <summary> /// 煤车篷布资讯 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="id"></param> /// <returns></returns> public ActionResult Index(int pageIndex = 1, int pageSize = 5, int?id = 0) { ViewData["pageIndex"] = pageIndex; ViewData["pageSize"] = pageSize; ViewData["total"] = 0; int totalcount = 0; List <newst> list = new List <newst>(); // list = newsbll.getall(); StringBuilder where = new StringBuilder(); where.Append(" and del =1"); SortParameter sa = new SortParameter(); sa.Field = "creationtime"; sa.Direction = SortDirection.DESC; SortParameters ot = new SortParameters(); ot.Add(sa); list = newsbll.GetPage(out totalcount, pageIndex, pageSize, where.ToString(), "", ot); ViewData["total"] = totalcount; return(View(list)); }
/// <summary> /// 添加排序列名参数 /// Add by Jason.Song on 2018/10/18 /// </summary> /// <param name="name">待排序的列名</param> /// <param name="sort">排序类型</param> public void AddSortParameter(string name, SortType sort) { if (!SortParameters.ContainsKey(name)) { SortParameters.Add(name, sort); } }
public ActionResult videoList(int pageIndex = 1, int pageSize = 10) { List <video> list = new List <sjth.Model.video>(); List <video> li = new List <video>(); ViewData["pageIndex"] = pageIndex; ViewData["pageSize"] = pageSize; ViewData["total"] = 0; string name = Request["name"]; string start = Request["start"]; string end = Request["end"]; try { StringBuilder where = new StringBuilder(); where.Append(" and del =1 "); if (!string.IsNullOrWhiteSpace(name)) { where.Append(" and name like'%" + name.Trim() + "%'"); } if (!string.IsNullOrWhiteSpace(start) && !string.IsNullOrWhiteSpace(end)) { //where.Append(" and creationtime>='" + start + "'"); //creationtime between '2016-12-07' and '2016-12-08 23:59:59' where.Append(" and datatimes between '" + start + "' and '" + end + " 23:59:59'"); } if (!string.IsNullOrWhiteSpace(start) && string.IsNullOrWhiteSpace(end)) { where.Append(" and datatimes>='" + start + "'"); } if (string.IsNullOrWhiteSpace(start) && !string.IsNullOrWhiteSpace(end)) { where.Append(" and datatimes<='" + end + " 23:59:59'"); } SortParameter sa = new SortParameter(); sa.Field = "datatimes"; sa.Direction = SortDirection.DESC; SortParameters ot = new SortParameters(); ot.Add(sa); int totalcount = 0; list = _video.GetPage(out totalcount, pageIndex, pageSize, where.ToString(), "", ot); // list = newsbll.getall(); ViewData["total"] = totalcount; // list = _video.allList(); return(View(list)); } catch (Exception) { return(View(list)); } }
public ActionResult school(int pageIndex = 1, int pageSize = 10, int?id = 0) { List <newstype> typelist = new List <newstype>(); string whereS = " PPID=2 and del =1"; typelist = newstypeBLL.GetAll(whereS); ViewBag.data = typelist; List <newst> list = new List <newst>(); List <newsName> li = new List <newsName>(); ViewData["pageIndex"] = pageIndex; ViewData["pageSize"] = pageSize; ViewData["total"] = 0; ViewData["name"] = newstypeBLL.GetById((int)id).typename; int totalcount = 0; StringBuilder where = new StringBuilder(); where.Append(" and del =1 and newstype = " + id); SortParameter sa = new SortParameter(); sa.Field = "creationtime"; sa.Direction = SortDirection.DESC; SortParameters ot = new SortParameters(); ot.Add(sa); list = newsbll.GetPage(out totalcount, pageIndex, pageSize, where.ToString(), "", ot); // list = newsbll.getall(); ViewData["total"] = totalcount; if (list.Count > 0) { foreach (var item in list) { newsName model = new newsName(); model.id = item.id; model.headline = item.headline; model.newstype = item.newstype; model.newstypename = newstypeBLL.GetById((int)item.newstype).typename; model.userid = item.userid; model.del = item.del; model.creationtime = item.creationtime; model.contenttext = item.contenttext; li.Add(model); } } return(View(li)); }
public ActionResult product(int pageIndex = 1, int pageSize = 10) { ViewData["pageIndex"] = pageIndex; ViewData["pageSize"] = pageSize; ViewData["total"] = 0; int totalcount = 0; List <product> list = new List <product>(); StringBuilder where = new StringBuilder(); SortParameter sa = new SortParameter(); sa.Field = "datatimes"; sa.Direction = SortDirection.DESC; SortParameters ot = new SortParameters(); ot.Add(sa); where.Append(" and del =1 "); list = _productbll.GetPage(out totalcount, pageIndex, pageSize, where.ToString(), "", ot); ViewData["total"] = totalcount; return(View(list)); }
public ActionResult newsList(int pageIndex = 1, int pageSize = 10) { List <newst> list = new List <newst>(); List <newsName> li = new List <newsName>(); ViewData["pageIndex"] = pageIndex; ViewData["pageSize"] = pageSize; ViewData["total"] = 0; try { string name = Request["name"]; string start = Request["start"]; string end = Request["end"]; int totalcount = 0; StringBuilder where = new StringBuilder(); where.Append(" and del =1 "); if (!string.IsNullOrWhiteSpace(name)) { where.Append(" and headline like'%" + name.Trim() + "%'"); } if (!string.IsNullOrWhiteSpace(start) && !string.IsNullOrWhiteSpace(end)) { //where.Append(" and creationtime>='" + start + "'"); //creationtime between '2016-12-07' and '2016-12-08 23:59:59' where.Append(" and creationtime between '" + start + "' and '" + end + " 23:59:59'"); } if (!string.IsNullOrWhiteSpace(start) && string.IsNullOrWhiteSpace(end)) { where.Append(" and creationtime>='" + start + "'"); } if (string.IsNullOrWhiteSpace(start) && !string.IsNullOrWhiteSpace(end)) { where.Append(" and creationtime<='" + end + " 23:59:59'"); } SortParameter sa = new SortParameter(); sa.Field = "creationtime"; sa.Direction = SortDirection.DESC; SortParameters ot = new SortParameters(); ot.Add(sa); list = newsbll.GetPage(out totalcount, pageIndex, pageSize, where.ToString(), "", ot); // list = newsbll.getall(); ViewData["total"] = totalcount; if (list.Count > 0) { foreach (var item in list) { newsName model = new newsName(); model.id = item.id; model.headline = item.headline; model.newstype = item.newstype; model.newstypename = newstypeBLL.GetById((int)item.newstype).typename; model.userid = item.userid; model.del = item.del; model.creationtime = item.creationtime; model.contenttext = item.contenttext; li.Add(model); } } } catch (Exception) { } return(View(li)); }