public JsonResult List(Int64 userId, int pageIndex = 1, int pageSize = 10) { //检查访问权限 CheckPermission(); using (var result = new ResponseResult <RoleVerificationViewModel>()) { //获取登录用户所管理地区信息 var whereModel = ManagementRange(userId); long recordCount; var modelList = this.roleVerificationRepository.GetAll(pageIndex, pageSize, out recordCount, whereModel); modelList.Select(m => { var addressNames = this.areaRepository.GetAreaNamesBy(string.Format("{0}|{1}|{2}", m.Province, m.City, m.Region)); var addressNamesArray = addressNames.Split('|'); m.Province = addressNamesArray[0]; m.City = addressNamesArray[1]; m.Region = addressNamesArray[2]; return(m); }).Count(); var verificationViewModel = new RoleVerificationViewModel() { Pager = new PagedList <string>(new string[0], pageIndex, pageSize, (int)recordCount), PendingAuditList = modelList, }; result.TotalNums = recordCount; result.PageIndex = pageIndex; result.PageSize = pageSize; result.IsSuccess = true; result.Entity = verificationViewModel; return(new JsonResultEx(result)); } }
public ActionResult List(WhereModel model, int pageIndex = 1, int pageSize = 10) { var userId = GetLoginInfo().User.Id; var wheremodel = new WhereModel() { RoleId = Convert.ToInt32(string.IsNullOrEmpty(Request["RoleId"]) ? "0" : Request["RoleId"]), Province = string.IsNullOrEmpty(Request["Province"]) ? "0" : Request["Province"], City = string.IsNullOrEmpty(Request["City"]) ? "0" : Request["City"], Region = string.IsNullOrEmpty(Request["Region"]) ? "0" : Request["Region"], PhoneNumber = string.IsNullOrEmpty(Request["PhoneNumber"]) ? "" : Request["PhoneNumber"].ToString(), }; var str_startTime = Request["StartTime"]; var str_endTime = Request["EndTime"]; if (!string.IsNullOrEmpty(str_startTime)) { str_startTime = str_startTime.Replace("年", "-").Replace("月", "-").Replace("日", ""); } if (!string.IsNullOrEmpty(str_endTime)) { str_endTime = str_endTime.Replace("年", "-").Replace("月", "-").Replace("日", ""); } DateTime dt_now = DateTime.Now; DateTime startTime = dt_now; DateTime endTime = dt_now; if (string.IsNullOrEmpty(str_startTime)) { startTime = dt_now.AddMonths(-3); } else { startTime = DateTime.Parse(str_startTime); } if (string.IsNullOrEmpty(str_endTime)) { endTime = dt_now; } else { endTime = DateTime.Parse(str_endTime); } wheremodel.StartTime = startTime; wheremodel.EndTime = new DateTime(endTime.Year, endTime.Month, endTime.Day, 23, 59, 59); var postParas = new Dictionary <string, string>() { { "UserId", userId.ToString() }, { "pageIndex", pageIndex.ToString() }, { "pageSize", pageSize.ToString() }, { "RoleId", wheremodel.RoleId.ToString() }, { "Province", wheremodel.Province }, { "City", wheremodel.City.ToString() }, { "Region", wheremodel.Region.ToString() }, { "PhoneNumber", wheremodel.PhoneNumber.ToString() }, { "StartTime", wheremodel.StartTime.ToString() }, { "EndTime", wheremodel.EndTime.ToString() } }; //证书的路径 var certification = GetCertificationFilePath(); //证书的密码 var certificationPwd = GetCertificationPwd(); if (postParas.ContainsKey(DataKey.UserId) == false) { postParas.Add(DataKey.UserId, GetLoginInfo().User.Id.ToString()); } var responseResult = RestSharpHelper.PostWithStandard <ResponseResult <RoleVerificationViewModelWithoutPager> >(GetPostUrl("Search"), postParas, GetCertificationFilePath(), GetCertificationPwd()); if (responseResult != null && responseResult.IsSuccess) { var roleVerification = new RoleVerificationViewModel(); roleVerification.Pager = new PagedList <string>(new string[0], responseResult.PageIndex, responseResult.PageSize, (int)responseResult.TotalNums); roleVerification.PendingAuditList = responseResult.Entity.PendingAuditList; roleVerification.Wheremodel = wheremodel; return(View("List", roleVerification)); } return(View()); }