private IActionResult generar(int id)
        {
            Guid guid = Guid.NewGuid();

            _log.RegistrarEvento($"{guid}{Environment.NewLine}{JsonConvert.SerializeObject(id)}");

            ImpresionOrdenProcesoResponseDTO response = new ImpresionOrdenProcesoResponseDTO();

            try
            {
                ConsultarImpresionOrdenProcesoRequestDTO request = new ConsultarImpresionOrdenProcesoRequestDTO {
                    OrdenProcesoId = id
                };
                ConsultarImpresionOrdenProcesoResponseDTO resImpresion = ordenProcesoService.ConsultarImpresionOrdenProceso(request);

                var path = $"{this._webHostEnvironment.ContentRootPath}\\Reportes\\rptOrdenProceso.rdlc";

                LocalReport lr = new LocalReport(path);
                Dictionary <string, string> parameters = new Dictionary <string, string>();

                //TODO: impresionListaProductores
                lr.AddDataSource("dsOrdenProceso", resImpresion.listOrdenProceso.ToList());
                lr.AddDataSource("dsDetalleOrdenProceso", resImpresion.listDetalleOrdenProceso.ToList());
                var result = lr.Execute(RenderType.Pdf, 1, parameters, "");

                return(File(result.MainStream, "application/pdf"));
            }
            catch (ResultException ex)
            {
                response.Result = new Result()
                {
                    Success = true, ErrCode = ex.Result.ErrCode, Message = ex.Result.Message
                };
            }
            catch (Exception ex)
            {
                response.Result = new Result()
                {
                    Success = false, Message = "Ocurrio un problema en el servicio, intentelo nuevamente."
                };
                _log.RegistrarEvento(ex, guid.ToString());
            }

            _log.RegistrarEvento($"{guid}{Environment.NewLine}{JsonConvert.SerializeObject(response)}");

            return(Ok(response));
        }
Example #2
0
        public ConsultarImpresionOrdenProcesoResponseDTO ConsultarImpresionOrdenProceso(ConsultarImpresionOrdenProcesoRequestDTO request)
        {
            ConsultarImpresionOrdenProcesoResponseDTO response = new ConsultarImpresionOrdenProcesoResponseDTO();

            response.listOrdenProceso        = _IOrdenProcesoRepository.ConsultarImpresionOrdenProceso(request.OrdenProcesoId);
            response.listDetalleOrdenProceso = _IOrdenProcesoRepository.ConsultarOrdenProcesoDetallePorId(request.OrdenProcesoId);
            return(response);
        }