Пример #1
0
        private JasperResultAsync GetAsync(string FileUrl, object Param, JasperReportFormat JasperReportFormat)
        {
            JasperExecutionRequest request = new JasperExecutionRequest();

            request.reportUnitUri = FileUrl;
            request.async = true;
            request.freshData = false;
            request.saveDataSnapshot = false;
            request.outputFormat = JasperReportFormat.ToString();
            request.interactive = false;
            request.ignorePagination = true;

            return GetAsync(FileUrl, Param, JasperReportFormat.PDF, request);
        }
Пример #2
0
        private JasperResultAsync GetAsync(string FileUrl, object Param, JasperReportFormat JasperReportFormat, JasperExecutionRequest RequestParam)
        {
            WebClient web = new WebClient();
            web.Credentials = new NetworkCredential(Auth.GetUsuario(), Auth.GetPassword());
            web.Headers.Add("Content-Type", "application/json");

            string Endereco = string.Format("{0}reportExecutions", Config.GetBaseUrl());

            JasperExecutionRequest request = RequestParam;

            if (RequestParam == null)
            {
                request.reportUnitUri = FileUrl;
                request.async = false;
                request.freshData = false;
                request.saveDataSnapshot = false;
                request.outputFormat = JasperReportFormat.ToString();
                request.interactive = false;
            }

            string param = request.ToJson();
            var Response = web.UploadString(Endereco, "POST", param);

            return new JasperResultAsync(Response, web.ResponseHeaders);
        }
Пример #3
0
        /// <summary>
        /// Efetuar download do relatório
        /// </summary>
        /// <param name="FileUrl">Local onde se encontra o relatório</param>
        /// <param name="Param">objeto com so paramentros necessários para executar o relatório.</param>
        /// <param name="JasperReportFormat">Formato desejado do relatório.</param>
        /// <returns>objeto contendo o documento e varias informações uteis para o download do mesmo.</returns>
        public JasperResult Get(string FileUrl, object Param, JasperReportFormat JasperReportFormat)
        {
            WebClient web = new WebClient();
            web.Credentials = new NetworkCredential(Auth.GetUsuario(), Auth.GetPassword());

            string url = string.Format("{0}reports{1}.{2}", Config.GetBaseUrl(), FileUrl, JasperReportFormat.ToString());

            web.QueryString = Param.ToQueryString();

            var responseFile = web.DownloadData(url);

            return new JasperResult(responseFile, url, Param, JasperReportFormat);
        }