// GET: authority public ActionResult Index(int pageIndex = 1, int pageSize = 10) { ViewData["pageIndex"] = pageIndex; ViewData["pageSize"] = pageSize; int totalcount = 0; List <Authority> list = new List <Authority>(); string where = " and del =1 "; list = _aBLL.GetPage(out totalcount, pageIndex, pageSize, where); // list = _aBLL.getall(); ViewData["total"] = totalcount; return(View(list)); }
public ActionResult AuthorityList(int pageIndex = 1, int pageSize = 10) { List <Authority> list = new List <Authority>(); 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 authorityName 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); list = _aBLL.GetPage(out totalcount, pageIndex, pageSize, where.ToString(), "", ot); // list = _aBLL.getall(); ViewData["total"] = totalcount; } catch (Exception) { } return(View(list)); }