Exemplo n.º 1
0
        /// <summary>
        /// Gets a component generator for the report component type
        /// </summary>
        /// <param name="componentType">The component type</param>
        /// <returns>The component generator</returns>
        public static IReportComponentGenerator GetGenerator
        (
            this ReportComponentType componentType
        )
        {
            switch (componentType)
            {
            case ReportComponentType.Chart:
                return(new ChartGenerator());

            case ReportComponentType.Graphic:
                return(new GraphicGenerator());

            case ReportComponentType.Statistic:
                return(new StatisticGenerator());

            case ReportComponentType.Repeater:
                return(new RepeaterGenerator());

            case ReportComponentType.Table:
                return(new TableGenerator());

            case ReportComponentType.Separator:
                return(new SeparatorGenerator());

            default:
                throw new InvalidOperationException
                      (
                          $"The component type {componentType} is not supported."
                      );
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the template content for a report component type
        /// </summary>
        /// <param name="componentType">The component type</param>
        /// <param name="content">The content</param>
        public void SetComponentContent
        (
            ReportComponentType componentType,
            string content
        )
        {
            var templateContent = this.ComponentContents.FirstOrDefault
                                  (
                c => c.ComponentType == componentType
                                  );

            if (templateContent == null)
            {
                templateContent = new ComponentTemplateContent
                                  (
                    this,
                    content,
                    componentType
                                  );

                this.ComponentContents.Add(templateContent);
            }
            else
            {
                templateContent.SetContent(content);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Constructs the template content with the content
 /// </summary>
 /// <param name="template">The report template</param>
 /// <param name="content">The content</param>
 /// <param name="componentType">The component type</param>
 internal ComponentTemplateContent
 (
     ReportTemplate template,
     string content,
     ReportComponentType componentType
 )
     : base(template, content)
 {
     this.ComponentType = componentType;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Determines if the template has content for a component type
 /// </summary>
 /// <param name="componentType">The component type</param>
 /// <returns>True, if content was found; otherwise false</returns>
 public bool HasContentForComponent
 (
     ReportComponentType componentType
 )
 {
     return(this.ComponentContents.Any
            (
                c => c.ComponentType == componentType
            ));
 }
Exemplo n.º 5
0
        /// <summary>
        /// Gets the template content for a specific component type
        /// </summary>
        /// <param name="componentType">The component type</param>
        /// <returns>The template content</returns>
        public ComponentTemplateContent GetComponentContent
        (
            ReportComponentType componentType
        )
        {
            var templateContent = this.ComponentContents.FirstOrDefault
                                  (
                c => c.ComponentType == componentType
                                  );

            if (templateContent == null)
            {
                throw new KeyNotFoundException
                      (
                          $"The content for the component type {componentType} has not been set."
                      );
            }

            return(templateContent);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Constructs the chart definition with the details
        /// </summary>
        /// <param name="name">The name</param>
        /// <param name="title">The title</param>
        /// <param name="type">The chart type</param>
        public ChartDefinition
        (
            string name,
            string title,
            ReportComponentType type
        )
            : base(name, title)
        {
            if (type != ReportComponentType.Chart)
            {
                throw new ArgumentException
                      (
                          "The chart component type is invalid."
                      );
            }

            this.DataSets = new Collection <ChartDataSetDefinition>();

            _chartType = type;
        }