예제 #1
0
 public byte[] RenderStream(string format, string deviceInfo, string streamID, out string mimeType)
 {
     if (m_executionSession.Snapshot != null)
     {
         Stream chunk = m_executionSession.Snapshot.GetChunk(streamID, ReportProcessing.ReportChunkTypes.StaticImage, out mimeType);
         if (chunk == null)
         {
             chunk = m_executionSession.Snapshot.GetChunk(streamID, ReportProcessing.ReportChunkTypes.Image, out mimeType);
         }
         if (chunk != null)
         {
             byte[] array = new byte[chunk.Length];
             chunk.Read(array, 0, (int)chunk.Length);
             return(array);
         }
     }
     using (StreamCache streamCache = new StreamCache())
     {
         m_itemContext.RSRequestParameters.SetRenderingParameters(deviceInfo);
         ReportProcessing    reportProcessing = CreateAndConfigureReportProcessing();
         IRenderingExtension newRenderer      = CreateRenderer(format, allowInternal: true);
         Microsoft.ReportingServices.ReportProcessing.RenderingContext rc = CreateRenderingContext();
         ProcessingContext        pc     = CreateProcessingContext(streamCache.StreamCallback);
         OnDemandProcessingResult result = reportProcessing.RenderSnapshotStream(newRenderer, streamID, rc, pc);
         m_executionSession.SaveProcessingResult(result);
         string encoding;
         string fileExtension;
         return(streamCache.GetMainStream(out encoding, out mimeType, out fileExtension));
     }
 }
예제 #2
0
        public int PerformSort(string paginationMode, string sortId, SortOptions sortDirection, bool clearSort, out string uniqueName)
        {
            SetProcessingCulture();
            ControlSnapshot snapshot = m_executionSession.Snapshot;

            try
            {
                m_executionSession.Snapshot = new ControlSnapshot();
                snapshot.PrepareExecutionSnapshot(m_executionSession.Snapshot, null);
                using (ProcessingStreamHandler @object = new ProcessingStreamHandler())
                {
                    m_itemContext.RSRequestParameters.PaginationModeValue = paginationMode;
                    ReportProcessing  reportProcessing = CreateAndConfigureReportProcessing();
                    ProcessingContext pc = CreateProcessingContext(@object.StreamCallback);
                    Microsoft.ReportingServices.ReportProcessing.RenderingContext rc = CreateRenderingContext();
                    int page;
                    OnDemandProcessingResult onDemandProcessingResult = reportProcessing.ProcessUserSortEvent(sortId, sortDirection, clearSort, pc, rc, snapshot, out uniqueName, out page);
                    if (onDemandProcessingResult != null && onDemandProcessingResult.SnapshotChanged)
                    {
                        m_executionSession.SaveProcessingResult(onDemandProcessingResult);
                    }
                    else
                    {
                        m_executionSession.Snapshot = snapshot;
                    }
                    return(page);
                }
            }
            catch
            {
                m_executionSession.Snapshot = snapshot;
                throw;
            }
        }
예제 #3
0
        public ProcessingMessageList Render(string format, string deviceInfo, string paginationMode, bool allowInternalRenderers, IEnumerable dataSources, CreateAndRegisterStream createStreamCallback)
        {
            SetProcessingCulture();
            m_itemContext.RSRequestParameters.FormatParamValue = format;
            m_itemContext.RSRequestParameters.SetRenderingParameters(deviceInfo);
            m_itemContext.RSRequestParameters.PaginationModeValue = paginationMode;
            ReportProcessing    reportProcessing   = CreateAndConfigureReportProcessing();
            IRenderingExtension renderingExtension = CreateRenderer(format, allowInternalRenderers);
            bool flag = false;

            if (format == null || m_executionSession.Snapshot == null)
            {
                ReinitializeSnapshot(null);
                flag = true;
            }
            SubreportCallbackHandler subreportHandler = CreateSubreportCallbackHandler();
            ProcessingContext        pc = CreateProcessingContext(m_executionSession.ExecutionInfo.ReportParameters, dataSources, m_executionSession.Credentials, m_executionSession.Snapshot, createStreamCallback, subreportHandler);

            Microsoft.ReportingServices.ReportProcessing.RenderingContext rc = CreateRenderingContext();
            OnDemandProcessingResult onDemandProcessingResult = null;

            if (flag)
            {
                try
                {
                    if (renderingExtension == null)
                    {
                        onDemandProcessingResult = reportProcessing.CreateSnapshot(DateTime.Now, pc, null);
                    }
                    else
                    {
                        m_itemContext.RSRequestParameters.SetReportParameters(m_executionSession.ExecutionInfo.ReportParameters.AsNameValueCollectionInUserCulture);
                        onDemandProcessingResult = CreateSnapshotAndRender(reportProcessing, renderingExtension, pc, rc, subreportHandler, m_executionSession.ExecutionInfo.ReportParameters, m_executionSession.Credentials);
                    }
                }
                catch
                {
                    m_executionSession.Snapshot = null;
                    throw;
                }
            }
            else if (renderingExtension != null)
            {
                onDemandProcessingResult = reportProcessing.RenderSnapshot(renderingExtension, rc, pc);
            }
            m_executionSession.SaveProcessingResult(onDemandProcessingResult);
            return(onDemandProcessingResult.Warnings);
        }
예제 #4
0
 protected virtual OnDemandProcessingResult CreateSnapshotAndRender(ReportProcessing repProc, IRenderingExtension renderer, ProcessingContext pc, Microsoft.ReportingServices.ReportProcessing.RenderingContext rc, SubreportCallbackHandler subreportHandler, ParameterInfoCollection parameters, DatasourceCredentialsCollection credentials)
 {
     return(repProc.RenderReport(renderer, DateTime.Now, pc, rc, null));
 }