Exemple #1
0
 private void SaveGeneratedReportItemInstance()
 {
     if (this.m_dynamicWidth == null && this.m_dynamicHeight == null)
     {
         OnDemandProcessingContext odpContext = base.RenderingContext.OdpContext;
         AspNetCore.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot = odpContext.OdpMetadata.ReportSnapshot;
         IChunkFactory chunkFactory = odpContext.ChunkFactory;
         if (this.CriDef.RepeatWith == null)
         {
             string text = CustomReportItem.CreateChunkName();
             using (Stream stream = chunkFactory.CreateChunk(text, AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.GeneratedReportItems, null))
             {
                 new IntermediateFormatWriter(stream, odpContext.GetActiveCompatibilityVersion()).Write(this.m_generatedReportItem.Instance);
                 stream.Flush();
             }
             reportSnapshot.AddGeneratedReportItemChunkName(this.GetGeneratedInstanceChunkKey(), text);
         }
         else
         {
             ImageInstance imageInstance = (ImageInstance)this.m_generatedReportItem.Instance;
             string        text          = imageInstance.StreamName = ImageHelper.StoreImageDataInChunk(AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.Image, imageInstance.ImageData, imageInstance.MIMEType, base.RenderingContext.OdpContext.OdpMetadata, base.RenderingContext.OdpContext.ChunkFactory);
             reportSnapshot.AddImageChunkName(this.GetGeneratedInstanceChunkKey(), text);
         }
     }
 }
Exemple #2
0
        private void GenerateReportItemDefinition()
        {
            this.m_generatedReportItem = null;
            ICustomReportItem controlInstance = base.RenderingContext.OdpContext.CriProcessingControls.GetControlInstance(this.CriDef.Type, base.RenderingContext.OdpContext.ExtFactory);

            if (controlInstance != null)
            {
                try
                {
                    controlInstance.GenerateReportItemDefinition(this);
                }
                catch (Exception ex)
                {
                    base.RenderingContext.ErrorContext.Register(ProcessingErrorCode.rsCRIProcessingError, Severity.Warning, this.Name, this.Type);
                    Global.Tracer.TraceException(TraceLevel.Error, RPRes.rsCRIProcessingError(this.Name, this.Type) + " " + ex.ToString());
                    return;
                }
                if (this.m_generatedReportItem == null)
                {
                    base.RenderingContext.ErrorContext.Register(ProcessingErrorCode.rsCRIRenderItemNull, Severity.Warning, this.CriDef.ObjectType, this.Name, this.Type);
                }
                else
                {
                    this.m_generatedReportItem.ConstructReportItemDefinition();
                    this.m_generatedReportItem.CriGenerationPhase = CriGenerationPhases.None;
                    string text = CustomReportItem.CreateChunkName();
                    OnDemandProcessingContext odpContext = base.RenderingContext.OdpContext;
                    AspNetCore.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot = odpContext.OdpMetadata.ReportSnapshot;
                    IChunkFactory chunkFactory = odpContext.ChunkFactory;
                    using (Stream stream = chunkFactory.CreateChunk(text, AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.GeneratedReportItems, null))
                    {
                        IntermediateFormatWriter intermediateFormatWriter = new IntermediateFormatWriter(stream, odpContext.GetActiveCompatibilityVersion());
                        AspNetCore.ReportingServices.ReportIntermediateFormat.Visibility visibility = this.m_generatedReportItem.ReportItemDef.Visibility;
                        this.m_generatedReportItem.ReportItemDef.Visibility = null;
                        intermediateFormatWriter.Write(this.m_generatedReportItem.ReportItemDef);
                        this.m_generatedReportItem.ReportItemDef.Visibility = visibility;
                        stream.Flush();
                    }
                    reportSnapshot.AddGeneratedReportItemChunkName(this.GetGeneratedDefinitionChunkKey(), text);
                }
            }
        }