コード例 #1
0
        public Map GetMap(string id)
        {
            var item = Repository.Get(id);

            if (item == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            return(item);
        }
コード例 #2
0
        /// <summary>
        /// 根据MapID查询
        /// </summary>
        /// <param name="mapId"></param>
        /// <returns></returns>
        public ListResultOutput <MapReleationDto> GetAllListBylayerID(string layerId)
        {
            try
            {
                ListResultOutput <MapReleationDto> list = new ListResultOutput <MapReleationDto>();
                var query = _IMapReleationRepository.GetAllList().Where(q => q.DataConfigID == layerId);

                if (query.Count() > 0)
                {
                    list = new ListResultOutput <MapReleationDto>(query.MapTo <List <MapReleationDto> >());
                    if (list.Items.Count > 0)
                    {
                        for (int i = 0; i < list.Items.Count; i++)
                        {
                            if (!string.IsNullOrWhiteSpace(list.Items[i].MapID))
                            {
                                var map = _IMapRepository.Get(list.Items[i].MapID);
                                list.Items[i].MapName = (map != null) ? map.MapName : "";
                            }
                            if (!string.IsNullOrWhiteSpace(list.Items[i].DataConfigID))
                            {
                                var layer = _ILayerContentRepository.Get(list.Items[i].DataConfigID);
                                list.Items[i].DataConfigName = (layer != null) ? layer.LayerName : "";
                            }
                            if (!string.IsNullOrWhiteSpace(list.Items[i].DataStyleID))
                            {
                                var style = _IDataStyleRepository.Get(list.Items[i].DataStyleID);
                                list.Items[i].DataStyleName = (style != null) ? style.StyleName : "";
                            }
                        }
                    }
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #3
0
        /// <summary>
        /// 更新数据
        /// </summary>
        public async Task <MapDto> Update(MapInputDto input)
        {
            try
            {
                await UpdateMapBBox(input.Id);

                var entity = _IMapRepository.Get(input.Id);
                //entity.MapName = input.MapName;
                //entity.MapBBox = input.MapBBox;
                entity.MapPublishAddress = input.MapPublishAddress;
                entity.MapStatus         = input.MapStatus;
                entity.MapDesc           = input.MapDesc;
                entity.MapType           = input.MapType;
                entity.MapTag            = input.MapTag;
                entity.PublishDT         = input.PublishDT;
                entity.SortCode          = input.SortCode;
                entity.EnabledMark       = input.EnabledMark;
                entity.DeleteMark        = input.DeleteMark;
                entity.CreateUserId      = input.CreateUserId;
                entity.CreateUserName    = input.CreateUserId;
                //entity.CreateDT = input.CreateDT;
                entity.ModifyUserId   = input.ModifyUserId;
                entity.ModifyUserName = input.ModifyUserName;
                entity.ModifyDate     = DateTime.Now;
                entity.MapScale       = input.MapScale;
                entity.SpatialRefence = input.SpatialRefence;
                var query = await _IMapRepository.UpdateAsync(entity);

                var result = entity.MapTo <MapDto>();

                _IOperateLogAppService.WriteOperateLog(input.Id, input.CreateUserId, 1002, 1102, 1201, 1431, null);
                return(result);
            }
            catch (Exception ex)
            {
                _IOperateLogAppService.WriteOperateLog(input.Id, input.CreateUserId, 1002, 1102, 1202, 1432, null);
                throw new Exception(ex.Message);
            }
        }
コード例 #4
0
        public async Task <PagingQueryResult <MapPagingQueryDTO> > Handle(MapPagingQuery request, CancellationToken cancellationToken)
        {
            var result = new PagingQueryResult <MapPagingQueryDTO>();

            request.CheckPagingParam();

            var clientOrganId = await clientAssetPermissionControlService.ClientAssetOrganIdRedirection();

            var specification = new MapPagingSpecification(clientOrganId, request.Page, request.PageSize, request.Search);
            var datas         = await mapRepository.Paging(specification).Select(x => new { x.Id, x.Name, x.CreatedTime, x.ModifiedTime }).ToListAsync();

            result.Total = await mapRepository.Get(specification).CountAsync();

            result.Data = datas.Select(x => MapPagingQueryDTO.From(x.Id, x.Name, x.CreatedTime, x.ModifiedTime)).ToList();
            return(result);
        }
コード例 #5
0
        public IActionResult Get(string id)
        {
            Map map = mapRepo.Get(id);

            if (map == null)
            {
                return(NotFound());
            }

            // Map the Domain Model to the Resource model.
            var mapResource = new MapResource {
                Id        = map.Id,
                Name      = map.Name,
                MapLayout = map.GetMapAsMatrix()
            };

            //mapResource.Relations.Add(Link.CreateLink(Url.Link("UserDetailsRoute", new {id = map.Creator.Id})));
            return(new OkObjectResult(mapResource));
        }