public byte[] RenderStream(string format, string deviceInfo, string streamID, out string mimeType)
        {
            if (this.m_executionSession.Snapshot != null)
            {
                Stream chunk = ((SnapshotBase)this.m_executionSession.Snapshot).GetChunk(streamID, ReportProcessing.ReportChunkTypes.StaticImage, out mimeType);
                if (chunk == null)
                {
                    chunk = ((SnapshotBase)this.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())
            {
                this.m_itemContext.RSRequestParameters.SetRenderingParameters(deviceInfo);
                ReportProcessing    reportProcessing = this.CreateAndConfigureReportProcessing();
                IRenderingExtension newRenderer      = this.CreateRenderer(format, true);
                AspNetCore.ReportingServices.ReportProcessing.RenderingContext rc = this.CreateRenderingContext();
                ProcessingContext        pc     = this.CreateProcessingContext(streamCache.StreamCallback);
                OnDemandProcessingResult result = reportProcessing.RenderSnapshotStream(newRenderer, streamID, rc, pc);
                this.m_executionSession.SaveProcessingResult(result);

                string text2 = default(string);
                return(streamCache.GetMainStream(out Encoding text, out mimeType, out text2));
            }
        }
 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));
     }
 }
        public int PerformSort(string paginationMode, string sortId, SortOptions sortDirection, bool clearSort, out string uniqueName)
        {
            this.SetProcessingCulture();
            ControlSnapshot snapshot = this.m_executionSession.Snapshot;

            try
            {
                this.m_executionSession.Snapshot = new ControlSnapshot();
                snapshot.PrepareExecutionSnapshot(this.m_executionSession.Snapshot, null);
                using (ProcessingStreamHandler @object = new ProcessingStreamHandler())
                {
                    this.m_itemContext.RSRequestParameters.PaginationModeValue = paginationMode;
                    ReportProcessing  reportProcessing = this.CreateAndConfigureReportProcessing();
                    ProcessingContext pc = this.CreateProcessingContext(@object.StreamCallback);
                    AspNetCore.ReportingServices.ReportProcessing.RenderingContext rc = this.CreateRenderingContext();
                    int result = default(int);
                    OnDemandProcessingResult onDemandProcessingResult = reportProcessing.ProcessUserSortEvent(sortId, sortDirection, clearSort, pc, rc, (IChunkFactory)snapshot, out uniqueName, out result);
                    if (onDemandProcessingResult != null && onDemandProcessingResult.SnapshotChanged)
                    {
                        this.m_executionSession.SaveProcessingResult(onDemandProcessingResult);
                    }
                    else
                    {
                        this.m_executionSession.Snapshot = snapshot;
                    }
                    return(result);
                }
            }
            catch
            {
                this.m_executionSession.Snapshot = snapshot;
                throw;
            }
        }
 public void SaveProcessingResult(OnDemandProcessingResult result)
 {
     HasDocMap           = result.HasDocumentMap;
     AutoRefreshInterval = result.AutoRefresh;
     if (result.NumberOfPages != 0)
     {
         TotalPages     = result.NumberOfPages;
         PaginationMode = result.UpdatedPaginationMode;
     }
 }
 public int PerformSearch(int startPage, int endPage, string searchText)
 {
     using (ProcessingStreamHandler @object = new ProcessingStreamHandler())
     {
         ProcessingContext        processingContext        = this.CreateProcessingContext(@object.StreamCallback);
         ReportProcessing         reportProcessing         = this.CreateAndConfigureReportProcessing();
         OnDemandProcessingResult onDemandProcessingResult = default(OnDemandProcessingResult);
         return(reportProcessing.ProcessFindStringEvent(startPage, endPage, searchText, this.m_executionSession.EventInfo, processingContext, out onDemandProcessingResult));
     }
 }
Esempio n. 6
0
 public void SaveProcessingResult(OnDemandProcessingResult result)
 {
     if (result != null)
     {
         result.Save();
         if (result.EventInfoChanged)
         {
             this.EventInfo = result.NewEventInfo;
         }
         this.ExecutionInfo.SaveProcessingResult(result);
     }
 }
        public ProcessingMessageList Render(string format, string deviceInfo, string paginationMode, bool allowInternalRenderers, IEnumerable dataSources, CreateAndRegisterStream createStreamCallback)
        {
            this.SetProcessingCulture();
            this.m_itemContext.RSRequestParameters.FormatParamValue = format;
            this.m_itemContext.RSRequestParameters.SetRenderingParameters(deviceInfo);
            this.m_itemContext.RSRequestParameters.PaginationModeValue = paginationMode;
            ReportProcessing    reportProcessing   = this.CreateAndConfigureReportProcessing();
            IRenderingExtension renderingExtension = this.CreateRenderer(format, allowInternalRenderers);
            //renderingExtension.Report = report;

            bool flag = false;

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

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

            if (flag)
            {
                try
                {
                    if (renderingExtension == null)
                    {
                        onDemandProcessingResult = reportProcessing.CreateSnapshot(DateTime.Now, pc, null);
                    }
                    else
                    {
                        this.m_itemContext.RSRequestParameters.SetReportParameters(this.m_executionSession.ExecutionInfo.ReportParameters.AsNameValueCollectionInUserCulture);
                        onDemandProcessingResult = this.CreateSnapshotAndRender(reportProcessing, renderingExtension, pc, rc, subreportHandler, this.m_executionSession.ExecutionInfo.ReportParameters, this.m_executionSession.Credentials);
                    }
                }
                catch (Exception ex)
                {
                    this.m_executionSession.Snapshot = null;
                    throw;
                }
            }
            else if (renderingExtension != null)
            {
                onDemandProcessingResult = reportProcessing.RenderSnapshot(renderingExtension, rc, pc);
            }
            this.m_executionSession.SaveProcessingResult(onDemandProcessingResult);
            return(onDemandProcessingResult.Warnings);
        }
 public int PerformDocumentMapNavigation(string documentMapId)
 {
     if (documentMapId == null)
     {
         return(0);
     }
     using (ProcessingStreamHandler @object = new ProcessingStreamHandler())
     {
         ProcessingContext        processingContext        = this.CreateProcessingContext(@object.StreamCallback);
         ReportProcessing         reportProcessing         = this.CreateAndConfigureReportProcessing();
         OnDemandProcessingResult onDemandProcessingResult = default(OnDemandProcessingResult);
         return(reportProcessing.ProcessDocumentMapNavigationEvent(documentMapId, this.m_executionSession.EventInfo, processingContext, out onDemandProcessingResult));
     }
 }
 public string PerformDrillthrough(string drillthroughId, out NameValueCollection resultParameters)
 {
     resultParameters = null;
     if (drillthroughId == null)
     {
         return(null);
     }
     using (ProcessingStreamHandler @object = new ProcessingStreamHandler())
     {
         ProcessingContext        processingContext        = this.CreateProcessingContext(@object.StreamCallback);
         ReportProcessing         reportProcessing         = this.CreateAndConfigureReportProcessing();
         OnDemandProcessingResult onDemandProcessingResult = default(OnDemandProcessingResult);
         return(reportProcessing.ProcessDrillthroughEvent(drillthroughId, this.m_executionSession.EventInfo, processingContext, out resultParameters, out onDemandProcessingResult));
     }
 }
 public int PerformBookmarkNavigation(string bookmarkId, out string uniqueName)
 {
     uniqueName = null;
     if (bookmarkId == null)
     {
         return(0);
     }
     using (ProcessingStreamHandler @object = new ProcessingStreamHandler())
     {
         ProcessingContext        processingContext        = this.CreateProcessingContext(@object.StreamCallback);
         ReportProcessing         reportProcessing         = this.CreateAndConfigureReportProcessing();
         OnDemandProcessingResult onDemandProcessingResult = default(OnDemandProcessingResult);
         return(reportProcessing.ProcessBookmarkNavigationEvent(bookmarkId, this.m_executionSession.EventInfo, processingContext, out uniqueName, out onDemandProcessingResult));
     }
 }
 public IDocumentMap GetDocumentMap()
 {
     if (!this.m_executionSession.ExecutionInfo.HasDocMap)
     {
         return(null);
     }
     using (ProcessingStreamHandler @object = new ProcessingStreamHandler())
     {
         ProcessingContext        processingContext = this.CreateProcessingContext(@object.StreamCallback);
         ReportProcessing         reportProcessing  = this.CreateAndConfigureReportProcessing();
         OnDemandProcessingResult result            = default(OnDemandProcessingResult);
         IDocumentMap             documentMap       = reportProcessing.GetDocumentMap(this.m_executionSession.EventInfo, processingContext, out result);
         this.m_executionSession.SaveProcessingResult(result);
         return(documentMap);
     }
 }