예제 #1
0
        public IPageList<EArea> SearchAreas(int userId, EnumAreaType areaTypType, EnumMapCoordinates coordinates, string searchKeyword, string orderName, string orderType, int pageIndex, int pageSize)
        {
            Spec<EArea> sp = new Spec<EArea>();

            sp.And(p => p.UserId == userId && p.AreaType == areaTypType);

            if (searchKeyword.HasValue())
            {
                sp.And(p => p.AreaName.Like(searchKeyword));
            }

            CSpec<EArea> csp = new CSpec<EArea>();

            if (orderName.HasValue())
            {
                csp.And(orderName, orderType);
            }

            var list = _rep.GetPageList<EArea>(pageIndex, pageSize, sp, csp);
            switch (coordinates)
            {
                case EnumMapCoordinates.Gcj02:
                    foreach (var item in list.List)
                    {
                        item.AreaPoints = _mapService.Wgs84ToGcj02(item.AreaPoints.ToObject<IList<EMapPoint>>().ToArray()).ToJson();
                    }
                    break;
                case EnumMapCoordinates.Bd09:
                    foreach (var item in list.List)
                    {
                        item.AreaPoints = _mapService.Wgs84ToBd09(item.AreaPoints.ToObject<IList<EMapPoint>>().ToArray()).ToJson();
                    }
                    break;
                default:
                    break;
            }
            return list;
        }
예제 #2
0
 public ActionResult GetAreas(EnumAreaType areaType, EnumMapCoordinates coordinates)
 {
     var os = _areaService.SearchAreas(Passport.User.Id, areaType, coordinates, base.SearchKeyword,
         base.OrderName, base.OrderType, base.PageIndex, base.PageSize);
     return JsonResult(os);
 }