Ejemplo n.º 1
0
 public Result Add(AuthentyDto dto, UserType roleId)
 {
     try
     {
         var rlt = UnitOfWorkService.Execute(() =>
         {
             var id        = _authentyRepository.InsertAndGetId(dto.MapTo <AuthentyEntity>());
             var orgId     = _staffRepository.GetOrgId(dto.SalesMan).OrgId;
             var dataInOrg = new DataInOrgEntity
             {
                 DataId   = id,
                 DataType = (int)DataType.Authenty,
                 OrgId    = orgId,
                 RoleId   = ((int)roleId).ToString()
             };
             var dataRlt = _dataInOrgRepository.Inserts(dataInOrg);
             if (id.IsNullOrEmpty() && !dataRlt)
             {
                 return(new Result(false, "数据库写入失败"));
             }
             return(new Result {
                 Status = true
             });
         });
         return(rlt);
     }
     catch (Exception ex)
     {
         Logger.Error("添加实名认证发生错误", ex);
         return(new Result(false, "实名认证报错"));
     }
 }
Ejemplo n.º 2
0
 public Result Update(AuthentyDto dto)
 {
     try
     {
         var entity = dto.MapTo <AuthentyEntity>();
         var rlt    = UnitOfWorkService.Execute(() => _authentyRepository.Update(entity));
         if (rlt)
         {
             return new Result {
                        Status = true
             }
         }
         ;
         return(new Result {
             Status = false, Message = "数据库操作失败"
         });
     }
     catch (Exception ex)
     {
         Logger.Error("update authenty error", ex);
         return(new Result {
             Status = false, Message = "内部服务器错误"
         });
     }
 }