コード例 #1
0
        /// <summary>
        /// 更新数据
        /// </summary>
        public async Task <MapReleationDto> Update(MapReleationInputDto input, string user)
        {
            try
            {
                //update by hu
                MapReleationEntity entity = new MapReleationEntity
                {
                    MapID        = input.MapID,
                    DataConfigID = input.DataConfigID,
                    DataStyleID  = input.DataStyleID,
                    DataSort     = input.DataSort,
                    ConfigDT     = input.ConfigDT,
                    ModifyDT     = input.ModifyDT,
                    Id           = input.Id
                };
                //var entity = _IMapReleationRepository.Get(input.Id);
                //if (entity != null)
                //{
                //    entity.MapID = input.MapID;
                //    entity.DataConfigID = input.DataConfigID;
                //    entity.DataStyleID = input.DataStyleID;
                //    //entity.DataSort = input.DataSort;
                //    entity.ConfigDT = input.ConfigDT;
                //    entity.ModifyDT = input.ModifyDT;
                //}
                var query = await _IMapReleationRepository.UpdateAsync(entity);

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

                _IOperateLogAppService.WriteOperateLog(input.MapID, user, 1002, 1102, 1201, 1431, null);
                return(result);
            }
            catch (Exception ex)
            {
                _IOperateLogAppService.WriteOperateLog(input.MapID, user, 1002, 1102, 1202, 1432, null);
                throw new Exception(ex.Message);
            }
        }
コード例 #2
0
 /// <summary>
 /// 新增数据
 /// </summary>
 public MapReleationDto Insert(MapReleationInputDto input)
 {
     try
     {
         input.Id = Guid.NewGuid().ToString();
         MapReleationEntity entity = new MapReleationEntity
         {
             Id           = input.Id,
             MapID        = input.MapID,
             DataConfigID = input.DataConfigID,
             DataStyleID  = input.DataStyleID,
             DataSort     = input.DataSort,
             ConfigDT     = input.ConfigDT,
             ModifyDT     = input.ModifyDT
         };
         var query  = _IMapReleationRepository.Insert(entity);
         var result = entity.MapTo <MapReleationDto>();
         return(result);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
コード例 #3
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);
            }
        }