public ExpressionRunner(Collection<ExportPage> pages,ReportSettings reportSettings,CollectionDataSource dataSource) { this.pages = pages; this.dataSource = dataSource; this.reportSettings = reportSettings; Visitor = new ExpressionVisitor(reportSettings); }
public WpfVisitor(ReportSettings reportSettings) { if (reportSettings == null) throw new ArgumentNullException("reportSettings"); this.reportSettings = reportSettings; documentCreator = new FixedDocumentCreator(reportSettings); }
public void GroupbyOneColumnSortSubList () { var rs = new ReportSettings(); var gc = new GroupColumn() { ColumnName ="GroupItem", SortDirection = ListSortDirection.Ascending, GroupSortColumn = new SortColumn() { ColumnName = "Randomint", SortDirection = ListSortDirection.Ascending } }; rs.GroupColumnsCollection.Add(gc); var collectionSource = new CollectionDataSource (list,rs); collectionSource.Bind(); var testKey = String.Empty; var testSubKey = -1; var groupedList = collectionSource.GroupedList; foreach (var element in groupedList) { Assert.That(element.Key,Is.GreaterThan(testKey)); testKey = element.Key.ToString(); foreach (Contributor sub in element) { Assert.That(sub.RandomInt,Is.GreaterThanOrEqualTo(testSubKey)); testSubKey = sub.RandomInt; } testSubKey = -1; } }
public WpfExporter(ReportSettings reportSettings,Collection<IPage> pages):base(pages) { if (reportSettings == null) throw new ArgumentNullException("reportSettings"); this.reportSettings = reportSettings; visitor = new WpfVisitor(reportSettings); }
static FixedDocument CreateFixedDocument(ReportSettings reportSettings) { var document = new FixedDocument(); document.DocumentPaginator.PageSize = new System.Windows.Size(reportSettings.PageSize.Width, reportSettings.PageSize.Height); return document; }
public FixedDocumentCreator(ReportSettings reportSettings) { if (reportSettings == null) throw new ArgumentNullException("reportSettings"); this.reportSettings = reportSettings; Console.WriteLine("FixedDocumentCreator()"); brushConverter = new BrushConverter(); }
public CollectionSource(IList list,ReportSettings reportSettings) { if (list.Count > 0) { itemType = list[0].GetType(); this.baseList = new DataCollection <object>(itemType); this.baseList.AddRange(list); } this.reportSettings = reportSettings; this.listProperties = this.baseList.GetItemProperties(null); IndexList = new IndexList(); }
public void GroupbyOneColumn () { var rs = new ReportSettings(); rs.GroupColumnsCollection.Add( new GroupColumn("GroupItem",1,ListSortDirection.Ascending)); var collectionSource = new CollectionDataSource (list,rs); collectionSource.Bind(); var testKey = String.Empty; var groupedList = collectionSource.GroupedList; foreach (var element in groupedList) { Assert.That(element.Key,Is.GreaterThan(testKey)); testKey = element.Key.ToString(); } }
public CollectionDataSource(IEnumerable list, Type elementType, ReportSettings reportSettings) { if (list == null) throw new ArgumentNullException("list"); if (reportSettings == null) throw new ArgumentNullException("reportSettings"); baseList = CreateBaseList(list); CurrentList = baseList; this.reportSettings = reportSettings; this.listProperties = this.baseList.GetItemProperties(null); OrderGroup = OrderGroup.AsIs; }
public PreviewViewModel(ReportSettings reportSettings, Collection<ExportPage> pages) { if (pages == null) throw new ArgumentNullException("pages"); if (reportSettings == null) throw new ArgumentNullException("reportSettings"); Document = CreateFixedDocument(reportSettings); var wpfExporter = new WpfExporter(pages); wpfExporter.Run(); this.document = wpfExporter.Document; }
public PreviewViewModel(ReportSettings reportSettings, Collection<IPage> pages) { if (pages == null) throw new ArgumentNullException("pages"); if (reportSettings == null) throw new ArgumentNullException("reportSettings"); Document = new FixedDocument(); var s = Document.DocumentPaginator.PageSize; Document.DocumentPaginator.PageSize = new System.Windows.Size(reportSettings.PageSize.Width,reportSettings.PageSize.Height); var wpfExporter = new WpfExporter(reportSettings,pages); wpfExporter.Run(); var fixedPage = wpfExporter.FixedPage; AddPageToDocument(Document,fixedPage); }
public void CreateExportlist() { reportItemCollection = new Collection<ExportText>(); reportItemCollection.Add(new ExportText() { Text = String.Empty }); var contributorList = new ContributorsList(); list = contributorList.ContributorCollection; reportSettings = new ReportSettings(); reportSettings.GroupColumnsCollection.Add( new GroupColumn("groupItem",1,ListSortDirection.Ascending ) ); dataSource = new CollectionDataSource(list,reportSettings); dataSource.Bind(); }
public void DataItemWithNoColumnNameHasErrorMessageInDbValue() { var baseRow = new BaseRowItem(); var dataItem = new BaseDataItem() { }; baseRow.Items.Add(dataItem); var row = new System.Collections.Generic.List<IPrintableObject>(); row.Add(baseRow); var reportSettings = new ReportSettings(); var collectionSource = new CollectionDataSource (list,reportSettings); collectionSource.Bind(); foreach (var element in collectionSource.SortedList) { collectionSource.Fill(row,element); var r = (BaseRowItem)row[0]; foreach (var result in r.Items) { Assert.That(((BaseDataItem)result).DBValue.StartsWith("Missing"),Is.EqualTo(true)); } } }
public void SortColumnNotExist() { var rs = new ReportSettings(); rs.SortColumnsCollection.Add(new SortColumn("aa",ListSortDirection.Ascending)); var collectionSource = new CollectionSource (list,rs); collectionSource.Bind(); Assert.That(collectionSource.IndexList,Is.Not.Null); Assert.That(collectionSource.IndexList.Count,Is.EqualTo(0)); }
public void SortTwoColumnsAscending() { var rs = new ReportSettings(); rs.SortColumnsCollection.Add(new SortColumn("Lastname",ListSortDirection.Ascending)); rs.SortColumnsCollection.Add(new SortColumn("RandomInt",ListSortDirection.Ascending)); var collectionSource = new CollectionSource (list,rs); collectionSource.Bind(); string compare = collectionSource.IndexList[0].ObjectArray[0].ToString(); foreach (var element in collectionSource.IndexList) { string result = String.Format("{0} - {1} - {2}",element.ListIndex,element.ObjectArray[0],element.ObjectArray[1].ToString()); Console.WriteLine(result); Assert.That(compare,Is.LessThanOrEqualTo(element.ObjectArray[0].ToString())); compare = element.ObjectArray[0].ToString(); } }
public void Setup () { reportSettings = new ReportSettings(); }
public void GroupbyOneColumn () { var rs = new ReportSettings(); rs.GroupColumnCollection.Add( new GroupColumn("GroupItem",1,ListSortDirection.Ascending)); var collectionSource = new CollectionSource (list,rs); collectionSource.Bind(); }
public ExpressionVisitor(ReportSettings reportSettings) { grammar = new ReportingLanguageGrammer(); evaluator = new ReportingExpressionEvaluator(grammar); evaluator.AddReportSettings(reportSettings); }
ReportSettings CreateReportSettings(ParameterCollection parameters) { var reportSettings = new ReportSettings(); reportSettings.ParameterCollection.AddRange(parameters); return reportSettings; }
public void GroupbyOneColumnAndFill() { var dataItemsCollection = CreateDataItems(); var reportsettings = new ReportSettings(); reportsettings.GroupColumnsCollection.Add( new GroupColumn("GroupItem",1,ListSortDirection.Ascending)); var collectionSource = new CollectionDataSource (list,reportsettings); collectionSource.Bind(); int i = 0; foreach (var element in collectionSource.GroupedList) { Console.WriteLine("Key {0} ",element.Key); foreach (var l in element) { collectionSource.Fill(dataItemsCollection,l); // Console.WriteLine("first : <{0}> Last <{1}> Group <{2}> Randomint <{3}>",((BaseDataItem)dataItemsCollection[0]).DBValue, // ((BaseDataItem)dataItemsCollection[1]).DBValue, // ((BaseDataItem)dataItemsCollection[2]).DBValue, // ((BaseDataItem)dataItemsCollection[3]).DBValue); i++; } } /* do { collectionSource.Fill(dataItemsCollection); Console.WriteLine("first : <{0}> Last <{1}> Group <{2}> Randomint <{3}>",((BaseDataItem)dataItemsCollection[0]).DBValue, ((BaseDataItem)dataItemsCollection[1]).DBValue, ((BaseDataItem)dataItemsCollection[2]).DBValue, ((BaseDataItem)dataItemsCollection[3]).DBValue); i ++; }while (collectionSource.MoveNext()); */ Assert.That(i,Is.EqualTo(collectionSource.Count)); }
public static void AddReportSettings (this ReportingExpressionEvaluator app,ReportSettings reportSettings) { if (reportSettings == null) throw new ArgumentNullException("reportSettings"); app.Globals.Add("ReportSettings",reportSettings); }
public ReportModel() { SectionCollection = new Collection<BaseSection>(); ReportSettings = new ReportSettings(); }
public ReportModel() { SectionCollection = new Collection <BaseSection>(); ReportSettings = new ReportSettings(); }
public void RowContainsRowAndItem() { var row = new System.Collections.Generic.List<IPrintableObject>(); var gItem = new BaseDataItem(){ ColumnName = "GroupItem" }; row.Add(gItem); var baseRow = new BaseRowItem(); var ric = new System.Collections.Generic.List<IPrintableObject>(){ new BaseDataItem(){ ColumnName = "Lastname" }, new BaseDataItem(){ ColumnName = "Firstname" } }; baseRow.Items.AddRange(ric); row.Add(baseRow); var rs = new ReportSettings(); var collectionSource = new CollectionDataSource (list,rs); collectionSource.Bind(); int i = 0; foreach (var element in collectionSource.SortedList) { collectionSource.Fill(row,element); var res = (BaseDataItem)row.Find(c => ((BaseDataItem)c).ColumnName == "GroupItem"); Assert.That(res.DBValue,Is.Not.Empty); i ++; } Assert.That(i,Is.EqualTo(collectionSource.Count)); }
public void FillDataIncludedInRow() { var baseRow = new BaseRowItem(); var dataItemsCollection = CreateDataItems(); baseRow.Items.AddRange(dataItemsCollection); var row = new System.Collections.Generic.List<IPrintableObject>(); row.Add(baseRow); var reportSettings = new ReportSettings(); var collectionSource = new CollectionDataSource (list,reportSettings); collectionSource.Bind(); int i = 0; foreach (var element in collectionSource.SortedList) { collectionSource.Fill(row,element); var r = (BaseRowItem)row[0]; foreach (var result in r.Items) { Assert.That(((BaseDataItem)result).DBValue,Is.Not.Empty); } i ++; } Assert.That(i,Is.EqualTo(collectionSource.Count)); }
public void SortOneColumnAscending() { var ric = new System.Collections.Generic.List<IPrintableObject>(){ new BaseDataItem(){ ColumnName = "Lastname" }, new BaseDataItem(){ ColumnName = "Firstname" } }; var rs = new ReportSettings(); rs.SortColumnsCollection.Add(new SortColumn("Lastname",ListSortDirection.Ascending)); var collectionSource = new CollectionDataSource (list,rs); collectionSource.Bind(); string compare = String.Empty; int i = 0; foreach (var element in collectionSource.SortedList) { collectionSource.Fill(ric,element); // Console.WriteLine("first : <{0}> Last <{1}> ",((BaseDataItem)ric[0]).DBValue,((BaseDataItem)ric[1]).DBValue); Assert.That(((BaseDataItem)ric[0]).DBValue,Is.GreaterThanOrEqualTo(compare)); compare = ((BaseDataItem)ric[0]).DBValue; i++; } /* do { collectionSource.Fill(ric); Console.WriteLine("first : <{0}> Last <{1}> ",((BaseDataItem)ric[0]).DBValue, ((BaseDataItem)ric[1]).DBValue); Assert.That(((BaseDataItem)ric[0]).DBValue,Is.GreaterThanOrEqualTo(compare)); compare = ((BaseDataItem)ric[0]).DBValue; i ++; }while (collectionSource.MoveNext()); */ Assert.That(i,Is.EqualTo(collectionSource.Count)); }