Ejemplo n.º 1
0
 public JsonResult BusinessList(BusinessSeachModel seachModel)
 {
     //CheckPermission();
     using (var result = new ResponseResult <List <BusinessListModel> >())
     {
         int totalCount = 0;
         result.Entity = _business.GetAll(seachModel, out totalCount).Select(model => new BusinessListModel
         {
             Id           = model.Id,
             City         = string.IsNullOrEmpty(model.City) ? "" : _areaService.GetAreaNamesBy(model.City),
             CreateTime   = model.CreateTime,
             CreateUser   = _userService.GetByKey(model.CreateUserId) == null ? "" : _userService.GetByKey(model.CreateUserId).UserName,
             DemandType   = _sysDictionary.GetByKey(model.DemandTypeId) == null ? "" : _sysDictionary.GetByKey(model.DemandTypeId).DisplayName,
             Province     = string.IsNullOrEmpty(model.Province) ? "" : _areaService.GetAreaNamesBy(model.Province),
             PublishState = _sysDictionary.GetByKey(model.PublishStateId) == null ? "" : _sysDictionary.GetByKey(model.PublishStateId).DisplayName,
             Region       = string.IsNullOrEmpty(model.Region) ? "" : _areaService.GetAreaNamesBy(model.Region),
             IsDeleted    = model.IsDeleted
         }).ToList();
         result.PageIndex = seachModel.pageIndex;
         result.PageSize  = seachModel.pageSize;
         result.TotalNums = totalCount;
         result.IsSuccess = true;
         return(Json(result));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取用户列表
        /// </summary>
        /// <returns></returns>
        public JsonResult List(SearchUserListInputDto input)
        {
            //检查访问权限
            CheckPermission();

            using (ResponseResult <UserModel> result = new ResponseResult <UserModel>())
            {
                WhereModel wheremodel = new WhereModel()
                {
                    RoleId      = Convert.ToInt32(input.RoleId),
                    Province    = input.Province,
                    City        = input.City,
                    Region      = input.Region,
                    PhoneNumber = input.PhoneNumber,
                    StartTime   = Convert.ToDateTime(input.StartTime),
                    EndTime     = Convert.ToDateTime(input.EndTime),
                    UserTypeId  = input.UserTypeId
                };
                long recordCount;
                var  modelList = this._userService.GetUserList(input.pageIndex.Value, input.pageSize.Value, out recordCount, wheremodel);
                modelList.Select(m =>
                {
                    var addressNames      = _areaRepository.GetAreaNamesBy(string.Format("{0}|{1}|{2}|{3}|{4}", m.Province, m.City, m.Region, m.Township, m.Village));
                    var addressNamesArray = addressNames.Split('|');
                    m.Province            = addressNamesArray[0];
                    m.City     = addressNamesArray[1];
                    m.Region   = addressNamesArray[2];
                    m.Township = addressNamesArray[3];
                    m.Village  = addressNamesArray[4];
                    return(m);
                }).Count();
                var usersModel = new UserModel()
                {
                    Pager            = new PagedList <string>(new string[0], input.pageIndex.Value, input.pageSize.Value, (int)recordCount),
                    PendingAuditList = modelList,
                    Wheremodel       = wheremodel
                };
                result.IsSuccess = true;
                result.Entity    = usersModel;
                result.TotalNums = recordCount;
                result.PageIndex = input.pageIndex.Value;
                result.PageSize  = input.pageSize.Value;
                return(new JsonResultEx(result));
            }
        }