Beispiel #1
0
        public Report(string name,
                      IReportTableProvider tableProvider,
                      IFormulaProvider formulaProvider,
                      ReportDataProvider reportDataProvider)
        {
            if (tableProvider == null)
            {
                throw new ArgumentNullException("tableProvider");
            }
            if (formulaProvider == null)
            {
                throw new ArgumentNullException("formulaProvider");
            }
            if (reportDataProvider == null)
            {
                throw new ArgumentNullException("reportDataProvider");
            }

            Names = new List<string> {name};
            ReportTables = new List<ReportTable>();

            foreach (var xmlTable in tableProvider.GetTables())
            {
                var reportTable = new ReportTable(xmlTable, formulaProvider, reportDataProvider);
                ReportTables.Add(reportTable);
            }
        }
        public static ReportTable Unify(ICollection<ReportTable> reportTables)
        {
            if (reportTables == null || reportTables.Count == 0)
            {
                throw new ArgumentException("reportTable");
            }

            CheckNames(reportTables);

            var newTable = new ReportTable
            {
                Name = reportTables.First().Name,
                ReportGroups = new List<ReportGroup>()
            };

            for (var i = 0; i < reportTables.First().ReportGroups.Count; i++)
            {
                var collection = GetGroupsCollection(reportTables, i);
                newTable.ReportGroups.Add(ReportGroup.Unify(collection));
            }

            return newTable;
        }