Exemplo n.º 1
0
        /// <summary>
        /// 新增或编辑功能
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public IActionResult Edit(DataDictionaryDto dto)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new
                {
                    Result = "Faild",
                    Message = GetModelStateError()
                }));
            }

            if (_dataDictionaryRepository.IsExist(p => p.Name == dto.Name && p.ParentId == Guid.Empty) && dto.Id == Guid.Empty && dto.ParentId == Guid.Empty)
            {
                return(Json(new { Result = "Faild",
                                  Message = "根字典名称已存在" }));
            }
            if (_dataDictionaryAppService.InsertOrUpdate(dto))
            {
                return(Json(new { Result = "Success" }));
            }

            return(Json(new
            {
                Result = "Faild",
                Message = "保存失败"
            }));
        }
Exemplo n.º 2
0
        public bool InsertOrUpdate(DataDictionaryDto dto)
        {
            var dataDictonary = _dataDictonaryRepository.InsertOrUpdate(Mapper.Map <DataDictionary>(dto));

            return(dataDictonary == null ? false : true);
        }
Exemplo n.º 3
0
        public HttpResponseMessage RetrieveDictionaryDataTranslation(int companyId, int equipmentId, [FromUri] DataDictionaryDto dataDictionaryDto)
        {
            var dataDictionary = new DataDictionary
            {
                Active      = dataDictionaryDto.Active,
                CompanyId   = companyId,
                EquipmentId = equipmentId,
                Key1        = dataDictionaryDto.Key1,
                Key2        = dataDictionaryDto.Key2,
                Key3        = dataDictionaryDto.Key3,
                Key4        = dataDictionaryDto.Key4,
                Key5        = dataDictionaryDto.Key5,
                Key6        = dataDictionaryDto.Key6,
                Key7        = dataDictionaryDto.Key7,
                Key8        = dataDictionaryDto.Key8,
                Key9        = dataDictionaryDto.Key9
            };

            try
            {
                Setup();

                _logger.WriteLogEntry(_tenantId.ToString(), null, string.Format(MethodBase.GetCurrentMethod().Name + " in " + _name), LogLevelType.Info);
                var data = _equipmentService.RetrieveDictionaryDataTranslation(dataDictionary);
                return(this.Request.CreateResponse(HttpStatusCode.Created, data));
            }
            catch (Exception ex)
            {
                _logger.WriteLogEntry(_tenantId.ToString(), new List <object> {
                    dataDictionary
                }, string.Format(MethodBase.GetCurrentMethod().Name + " in " + _name), LogLevelType.Error, ex);
                throw;
            }
        }
Exemplo n.º 4
0
 public Task <DataDictionaryQueryDto> UpdateAsync(int id, DataDictionaryDto input)
 {
     return(_dataDictionaryAppService.UpdateAsync(id, input));
 }
Exemplo n.º 5
0
 public Task <DataDictionaryQueryDto> CreateAsync(DataDictionaryDto input)
 {
     return(_dataDictionaryAppService.CreateAsync(input));
 }