예제 #1
0
                                                             public async Task <IHttpActionResult> AccesoArchivo(AccesoArchivo Id)
                                                             {
                                                                 try{ log.Info(new MDCSet(this.ControllerContext.RouteData));            //TODO:  new InfoException(Id)
                                                                      var result = await _repository.AccesoArchivo(Id);

                                                                      return(Ok(result)); }
                                                                 catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e);

                                                                                       return(InternalServerError(e)); }
                                                             }
                                                           public async Task <int> AccesoArchivo(AccesoArchivo id)
                                                           {
                                                               try
                                                               {
                                                                   var result = await _ctxGen.dbSetSolicitudAcceso
                                                                                .Where(e => e.ClavePersonaSolicitante == id.clavePersonaSolicitante &&
                                                                                       e.TipoInformacionId == id.tipoInformacionId &&
                                                                                       e.InformacionOCId == id.informacionOCId &&
                                                                                       e.ModuloId == id.moduloId &&
                                                                                       e.idAdicional == id.tipoArchivo)
                                                                                .OrderByDescending(x => x.FechaSolicitud)
                                                                                .AsNoTracking().FirstOrDefaultAsync();

                                                                   if (result == null || result.EstadoFlujoId == 9)
                                                                   {
                                                                       return(0);
                                                                   }
                                                                   else
                                                                   {
                                                                       if (result.EstadoFlujoId == 8)
                                                                       {
                                                                           return(2);
                                                                       }
                                                                       if (result.EstadoFlujoId == 10)
                                                                       {
                                                                           return(1);
                                                                       }
                                                                   }
                                                                   return(0);
                                                               }
                                                               catch (Exception e)
                                                               {
                                                                   throw new Exception(e.Message, e);
                                                               }
                                                           }