Esempio n. 1
0
        public byte[] GetReportFromRS(ReportCallContext reportContext, out string mimeType, out string extension)
        {
            reportContext.ReportName = "/eSoda/" + reportContext.ReportName;

            ReportExecutionService ws = new ReportingServices.ReportExecutionService();

            Warning[] warnings;
            string[]  sids;
            string    encoding;

            ws.Credentials = System.Net.CredentialCache.DefaultCredentials;

            ws.Timeout = 1000 * 600;
            //parameters[0] = new ParameterValue();
            //parameters[0].Name = "params";
            //parameters[0].Value = reportContext.ReportParameters.ToString(SaveOptions.DisableFormatting);

            ExecutionInfo   execInfo   = new ExecutionInfo();
            ExecutionHeader execHeader = new ExecutionHeader();

            ws.ExecutionHeaderValue = execHeader;
            byte[] reportContent = null;
            try
            {
                execInfo = ws.LoadReport(reportContext.ReportName, null);
                ws.SetExecutionParameters(reportContext.Parameters, "pl-PL");
                string sessionID = ws.ExecutionHeaderValue.ExecutionID;
                reportContent = ws.Render(reportContext.ReportFormat, null, out extension, out mimeType, out encoding, out warnings, out sids);
            }
            catch (Exception ex)
            {
                mimeType  = null;
                extension = null;
                System.Diagnostics.Trace.WriteLine(ex.Message);
                throw;
            }
            return(reportContent);
        }