WPF Multipage Reports Part II - Data Grouping

In my first post about building WPF multipage reports I described the overall problem definition and a high level design.
Today I will describe the data layer that reads data from a data source and provides simple grouping calculations (sorry no WPF stuff today).  I decided not to use GROUPING and CUBE clauses that are in SQL Server, because I wanted to be data source independent and also support a more extensible computational model that allows much more than SQL language. I also tried to perform all calculations in one pass, enabling a partial processing in the future and also for performance reasons.
Do not expect full featured data engine created in one post, but you can get the idea. The result will be the data prepared for presentation layer as one encapsulating class.
Here is the Report data class:

 

public class ReportData
    {
        DataTable rows;

        /// <summary>
        /// Represents the raw underlying data
        /// </summary>
        public DataTable Rows
        {
            get { return rows; }
        }

        List<GroupData> groups;

        /// <summary>
        /// Contains calculated values for each groupl level
        /// </summary>
        public List<GroupData> Groups
        {
            get { return groups; }
        }

        public ReportData(DataTable rows, List<GroupData> groups,GroupData reportGroup)
        {
            this.rows = rows;
            this.groups = groups;
            this.reportGroup = reportGroup;
        }

        private GroupData reportGroup;

        /// <summary>
        /// Contains calculated values for whole report
        /// </summary>
        public GroupData ReportGroup
        {
            get { return reportGroup; }
           
        }
    }



Posted 1/19/2011 3:02:24 PM by admin
Filed under: .NET