Пример #1
0
        public HttpResponseMessage ObtenerReporteExcel(List <EDReporte> resultReporte, List <EDActividadesActosInseguros> resultActividades)
        {
            HttpResponseMessage response = null;

            try
            {
                var logica  = new LNReporte();
                var archivo = logica.ObtenerReporteExcel(resultReporte, resultActividades);
                if (archivo != null)
                {
                    response = Request.CreateResponse <byte[]>(HttpStatusCode.OK, archivo);
                    return(response);
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.ExpectationFailed);
                    return(response);
                }
            }
            catch (Exception ex)
            {
                response = Request.CreateResponse(HttpStatusCode.InternalServerError);
                return(response);
            }
        }
Пример #2
0
        public FileResult DescargarReporteExcelCondiciones(EDReporte reporte)
        {
            reporte = resReporte;

            List <EDReporte> listaReportes = new List <EDReporte>();
            List <EDActividadesActosInseguros> listaActividades = new List <EDActividadesActosInseguros>();
            var usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current);


            ServiceClient.EliminarParametros();
            var resultReporte = ServiceClient.RealizarPeticionesArrayPostJsonRest <EDReporte>(UrlServicioParticipacion, CapacidadVerReportesFiltrados, reporte);

            listaReportes = resultReporte.ToList();
            ServiceClient.EliminarParametros();
            var resultActividades = ServiceClient.RealizarPeticionesArrayPostJsonRest <EDActividadesActosInseguros>(UrlServicioParticipacion, CapacidadVerActividadesFiltrados, reporte);

            listaActividades = resultActividades.ToList();
            var result = lnReporte.ObtenerReporteExcel(listaReportes, listaActividades);

            //ServiceClient.AdicionarParametro("rep", resultReporte.ToList());
            //var result = ServiceClient.ObtenerObjetoJsonRestFul<byte[]>(UrlServicioParticipacion, CapacidadDescargarExcelReportesCondicionesInseguras, RestSharp.Method.POST);

            return(File(result, "application/vnd.ms-excel", "ReporteDeCondicionesInseguras" + DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "") + ".xlsx"));
        }