This project has moved. For the latest updates, please go here.

Creation of Report

Info

This Example use the Microsoft Reporting Services. For other technologies another approach would be necessary or more useful.

Structure and Content

A Report Project is a regular Class, which contain some additional resources.

Core Element
  • Report.cs (the Class and Entry Point)
  • ReportTranslation.resx (For Translation on Report Level)

Technology Focused Element (MSRS)
  • Report.rdlc (Report Layout)
  • ReportDatabase.xsd (Necessary for Layout, just a kind of placeholder/template)

Creation and configuration

  • Create a new Project with Type "Class", Use a Naming you can recognize later
  • Rename the Class to "Report.cs"
  • Change the Class and extend with MEF Attributes
    using System.ComponentModel.Composition;
    using CrumbleLibrary;

    [Export("Reports", typeof(IReport))]
    [ExportMetadata("Id", "AnUniqueID_CanbeAnyString")]
    [ExportMetadata("Reportname", "Reportname")]
    [ExportMetadata("ReportType", HelperLibrary.ReportType.MSRS)]
    public class Report : TemplateReport
    {
        ...
  • Make the Settings and Initial Works
        /// <summary>
        /// Says if the Report should be loaded after startup.
        /// </summary>
        public const bool LoadReportOnStartup = true;
/// <summary>
        /// The list parameter.
        /// </summary>
        private Dictionary<string, FilterParameterItem> internalParameterList =
            new Dictionary<string, FilterParameterItem>
                {
                    {
                        "@dateFrom",
                        new FilterParameterItem(
                        HelperLibrary.FilterParameterType.MSSQL,
                        "@dateFrom",
                        new SqlParameter("@dateFrom", SqlDbType.DateTime)
                            {
                                Value = DateTime.Now.AddDays(-1)
                            })
                    },
                    {
                        "@dateTo",new FilterParameterItem(
                        HelperLibrary.FilterParameterType.MSSQL,
                        "@dateTo",
                        new SqlParameter("@dateTo", SqlDbType.DateTime)
                            {
                                Value = DateTime.Now
                            })
                    }
                };


Still in Progress

Last edited Sep 18, 2013 at 7:35 AM by Telaran, version 1