Exemple #1
0
 /// <summary>
 /// 点击地图,查询缓冲区内其他图层要素
 /// </summary>
 private void menuSpaceQuery_Click(object sender, EventArgs e)
 {
     //声明并初始化
     pSpaceQuery = new SpaceQuery(this.axMapControl1);
     //关联MapControl
     pSpaceQuery.OnCreate(this.axMapControl1.Object);
 }
Exemple #2
0
        public IHttpActionResult Search(SpaceQuery query)
        {
            query.Count = true;
            var result = SpaceService.Search(query);

            return(Ok(new ScrollableList <Space>(result, Request.RequestUri)));
        }
Exemple #3
0
 private IQueryable <Space> FilterSpaces(SpaceQuery query, IQueryable <Space> spaces)
 {
     if (query.Price > 0)
     {
         spaces = spaces.Where(sp => (sp.PricePH.Price <= query.Price || sp.PricePD.Price <= query.Price || sp.PricePW.Price <= query.Price));
     }
     if (query.Price > 500000)
     {
         spaces = spaces.Where(sp => (sp.PricePH.Price >= query.Price || sp.PricePD.Price >= query.Price || sp.PricePW.Price >= query.Price));
     }
     if (!string.IsNullOrWhiteSpace(query.Location))
     {
         spaces = spaces.Where(sp => sp.Location.Name.ToLower().Contains(query.Location));
     }
     if (!string.IsNullOrWhiteSpace(query.SearchString))
     {
         spaces = spaces.Where(sp => sp.Location.Name.ToLower().StartsWith(query.SearchString) || sp.Location.Name.ToLower().Contains(query.SearchString) || sp.Name.StartsWith(query.SearchString) || sp.Name.ToLower().Contains(query.SearchString) || sp.Description.Contains(query.SearchString));
     }
     if (query.Size > 0)
     {
         spaces = spaces.Where(sp => Convert.ToInt64(sp.Size) >= query.Size);
     }
     if (!string.IsNullOrWhiteSpace(query.SpaceType) && query.SpaceType.Length > 0)
     {
         spaces = spaces.Where(sp => sp.Type.Type.ToLower().Contains(query.SpaceType.ToLower()));
     }
     return(spaces);
 }
Exemple #4
0
        public async Task <QueryResult <Space> > GetMerchantSpaces(SpaceQuery query)
        {
            var spaces = _context.Spaces
                         .Where(sp => sp.UserId == query.UserId)
                         // .Where(sp => sp.Type.Type.ToLower().Contains(query.SpaceType.ToLower()))
                         .Include(sp => sp.Type)
                         .Include(space => space.Location)
                         .Include(space => space.PricePH)
                         .Include(space => space.PricePD)
                         .Include(space => space.PricePW)
                         .Include(sp => sp.Photos)
                         .AsQueryable();

            spaces = FilterSpaces(query, spaces);
            int count = spaces.Count();

            spaces = spaces.Skip((query.CurrentPage - 1) * query.PageSize)
                     .Take(query.PageSize);
            var queryResult = new QueryResult <Space>();

            queryResult.TotalItems = count;
            queryResult.Items      = await spaces.ToListAsync();

            return(queryResult);
        }
        /// <summary>
        /// グループの取得
        /// </summary>
        /// <returns></returns>
        public async Task<IEnumerable<GroupViewModel>> GetSpageGroups()
        {
            var spaceCommunicator = new SpaceCommunicator(this.SpaceName, this.APIKey);
            IEnumerable<GroupViewModel> groups = null;

            await Task.Run(() =>
            {
                var param = new SpaceQuery
                {
                    Offset = 0,
                    Order = CSJSONBacklog.Model.Issues.Order.asc,
                    Count = 100,
                };
                var quary = param.GetParametersForAPI();

                groups = spaceCommunicator.GetGroupList(param).Select(x => new GroupViewModel(x)).ToList();
                //groups = spaceCommunicator.GetGroupList(param).ToList();
            });
            return groups;
        }