Ejemplo n.º 1
0
 /// <summary>
 /// 更新企业信息
 /// </summary>
 /// <param name="inputDtos"></param>
 /// <returns></returns>
 public async Task<OperationResult> UpdateEnterprises(params EnterpriseInfoInputDto[] inputDtos)
 {
     inputDtos.CheckNotNull("inputDtos");
     foreach (EnterpriseInfoInputDto dtoData in inputDtos)
     {
         if (string.IsNullOrEmpty(dtoData.EnterpriseCode))
             return new OperationResult(OperationResultType.Error, "请正确填写企业编号!");
         if (string.IsNullOrEmpty(dtoData.EnterpriseName))
             return new OperationResult(OperationResultType.Error, "请正确填写企业名称!");
         if (EnterpriseRepository.CheckExists(x => x.EnterpriseCode == dtoData.EnterpriseCode && x.Id != dtoData.Id /*&& x.IsDeleted == false*/))
             return new OperationResult(OperationResultType.Error, "该企业编号已存在,无法保存!");
         if (EnterpriseRepository.CheckExists(x => x.EnterpriseName == dtoData.EnterpriseName && x.Id != dtoData.Id /*&& x.IsDeleted == false*/))
             return new OperationResult(OperationResultType.Error, "该企业名称已存在,无法保存!");
     }
     EnterpriseRepository.UnitOfWork.BeginTransaction();
     var result = await EnterpriseRepository.UpdateAsync(inputDtos);
     EnterpriseRepository.UnitOfWork.Commit();
     return result;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 检查企业信息是否存在
 /// </summary>
 /// <param name="predicate"></param>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool CheckEnterpriseExists(Expression<Func<EnterpriseInfo, bool>> predicate, Guid id)
 {
     return EnterpriseRepository.CheckExists(predicate, id);
 }