public ResponseBase <PageInfoResponse <List <tb_user> > > LoadUserList(LoadUserListRequest req) { try { DateTime starttime = Convert.ToDateTime(req.UserCreateTimeRange.Split('/')[0]); DateTime endtime = Convert.ToDateTime(req.UserCreateTimeRange.Split('/')[1]).AddDays(1); int pageIndex = (req.iDisplayStart / req.iDisplayLength) + 1; int totalCount = 0; List <tb_user> user = userrepository.Find(out totalCount, pageIndex, req.iDisplayLength, k => k.id.ToString(), x => x.useremail == (string.IsNullOrEmpty(req.UserEmail) ? x.useremail : req.UserEmail) && x.usermobile == (string.IsNullOrEmpty(req.UserMobile) ? x.usermobile : req.UserMobile) && x.realname == (string.IsNullOrEmpty(req.UserRealName) ? x.realname : req.UserRealName) && x.createtime >= starttime && x.createtime < endtime ).ToList(); if (user == null || user.Count <= 0) { return(ResponseToClient <PageInfoResponse <List <tb_user> > >(ResponesStatus.Failed, "当前未查到任何用户")); } return(ResponseToClient <PageInfoResponse <List <tb_user> > >(ResponesStatus.Success, "", new PageInfoResponse <List <tb_user> >() { aaData = user, iTotalDisplayRecords = totalCount, iTotalRecords = totalCount, sEcho = req.sEcho })); } catch (Exception ex) { return(ResponseToClient <PageInfoResponse <List <tb_user> > >(ResponesStatus.Exception, ex.Message)); } }
public JsonResult Index(LoadUserListRequest req) { ViewBag.adminid = req.AdminId == null?"-1":req.AdminId.ToString(); ViewBag.UserCreateTimeRange = req.UserCreateTimeRange == null ? "1900-01-01/2099-12-30" : req.UserCreateTimeRange.ToString(); ViewBag.UserMobile = req.UserMobile == null ? "" : req.UserMobile.ToString(); ViewBag.UserEmail = req.UserEmail == null ? "" : req.UserEmail.ToString(); ViewBag.UserRealName = req.UserRealName == null?"":req.UserRealName.ToString(); req.UserCreateTimeRange = req.UserCreateTimeRange == null ? "1900-01-01/2099-12-30" : req.UserCreateTimeRange; ResponseBase <PageInfoResponse <List <tb_user> > > list = PostToServer <PageInfoResponse <List <tb_user> >, LoadUserListRequest>(ClientProxy.LoadUserList_Url, req); if (list.Status != ResponesStatus.Success) { return(Json(new { sEcho = 0, iTotalRecords = 0, iTotalDisplayRecords = 0, aaData = new List <string>() })); } return(Json(list.Data)); }