Beispiel #1
0
        /// <summary>
        /// 新增数据
        /// </summary>
        public async Task <MapDto> Insert(MapInputDto input)
        {
            try
            {
                input.Id = Guid.NewGuid().ToString();
                MapEntity entity = new MapEntity
                {
                    Id                = input.Id,
                    MapName           = input.MapName,
                    MapBBox           = input.MapBBox,
                    MapPublishAddress = input.MapPublishAddress,
                    MapStatus         = input.MapStatus,
                    MapDesc           = input.MapDesc,
                    MapType           = input.MapType,
                    MapTag            = input.MapTag,
                    PublishDT         = input.PublishDT,
                    SortCode          = input.SortCode,
                    EnabledMark       = input.EnabledMark,
                    DeleteMark        = input.DeleteMark,
                    CreateUserId      = input.CreateUserId,
                    CreateUserName    = input.CreateUserId,
                    CreateDT          = DateTime.Now,
                    ModifyUserId      = input.ModifyUserId,
                    ModifyUserName    = input.ModifyUserName,
                    ModifyDate        = input.ModifyDate,
                    MapScale          = input.MapScale,
                    SpatialRefence    = input.SpatialRefence,
                    MapLegend         = input.MapLegend
                };
                ChineseConvert chn       = new ChineseConvert();
                string         mapEnName = chn.GetPinyinInitials(entity.MapName);
                string         lastIndex = (System.DateTime.Now.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString());
                entity.MapEnName = mapEnName + lastIndex;
                var query = await _IMapRepository.InsertAsync(entity);

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

                _IOperateLogAppService.WriteOperateLog(input.Id, input.ModifyUserId, 1002, 1101, 1201, 1411, "(" + input.MapName + ")");
                return(result);
            }
            catch (Exception ex)
            {
                _IOperateLogAppService.WriteOperateLog(input.Id, input.ModifyUserId, 1002, 1101, 1202, 1412, "(" + input.MapName + ")");
                throw new Exception(ex.Message);
            }
        }
Beispiel #2
0
        public async Task <bool> InsertMapInfo(MapInfoDto input)
        {
            try
            {
                #region [地图主信息]

                input.mapDto.Id = Guid.NewGuid().ToString();
                MapEntity entity = new MapEntity
                {
                    Id                = input.mapDto.Id,
                    MapName           = input.mapDto.MapName,
                    MapBBox           = input.mapDto.MapBBox,
                    MapPublishAddress = input.mapDto.MapPublishAddress,
                    MapStatus         = input.mapDto.MapStatus,
                    MapDesc           = input.mapDto.MapDesc,
                    MapType           = input.mapDto.MapType,
                    MapTag            = input.mapDto.MapTag,
                    PublishDT         = input.mapDto.PublishDT,
                    SortCode          = input.mapDto.SortCode,
                    EnabledMark       = input.mapDto.EnabledMark,
                    DeleteMark        = input.mapDto.DeleteMark,
                    CreateUserId      = input.mapDto.CreateUserId,
                    CreateUserName    = input.mapDto.CreateUserName,
                    CreateDT          = DateTime.Now,
                    ModifyUserId      = input.mapDto.ModifyUserId,
                    ModifyUserName    = input.mapDto.ModifyUserName,
                    ModifyDate        = input.mapDto.ModifyDate,
                    MapScale          = input.mapDto.MapScale,
                    SpatialRefence    = input.mapDto.SpatialRefence,
                    MapLegend         = input.mapDto.MapLegend
                };
                ChineseConvert chn = new ChineseConvert();
                entity.MapEnName = chn.GetPinyinInitials(entity.MapName);
                var query = await _IMapRepository.InsertAsync(entity);

                #endregion

                #region [地图图层关系]

                if (input.listMapReleationDto.Count > 0)
                {
                    foreach (var item in input.listMapReleationDto)
                    {
                        MapReleationEntity mapReleation = new MapReleationEntity
                        {
                            Id           = Guid.NewGuid().ToString(),
                            MapID        = input.mapDto.Id,
                            DataConfigID = item.DataConfigID,
                            DataStyleID  = item.DataStyleID,
                            DataSort     = item.DataSort,
                            ConfigDT     = item.ConfigDT,
                            ModifyDT     = item.ModifyDT
                        };
                        var result = await _IMapReleationRepository.InsertAsync(mapReleation);
                    }
                }

                #endregion

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }