void BuildGroupedDetails(IContainerConverter converter, Point startPosition) { var pagePosition = startPosition; var sectionPosition = pagePosition; foreach (IGrouping <object, object> grouping in DataSource.GroupedList) { var groupHeader = (BaseRowItem)CurrentSection.Items.Where(p => p.GetType() == typeof(GroupHeader)).FirstOrDefault(); var sectionContainer = CreateContainerForSection(CurrentPage, pagePosition); DataSource.Fill(groupHeader.Items, grouping.FirstOrDefault()); var headerRow = converter.ConvertToExportContainer(groupHeader); headerRow.Location = new Point(headerRow.Location.X, groupHeader.Location.Y); var headerItems = converter.CreateConvertedList(groupHeader.Items); converter.SetParent(sectionContainer, headerItems); headerRow.ExportedItems.AddRange(headerItems); headerRow.Parent = sectionContainer; sectionContainer.ExportedItems.Add(headerRow); EvaluateExpressionsInGroups(sectionContainer, grouping); pagePosition = new Point(CurrentSection.Location.X, pagePosition.Y + sectionContainer.DesiredSize.Height + 1); // Set Position Child Elements sectionPosition = new Point(pagePosition.X, headerRow.Location.Y + headerRow.Size.Height + 3); //Childs foreach (var child in grouping) { // var dataItems = CurrentSection.Items.Where(p => p.GetType() == typeof(BaseDataItem)).ToList(); var dataItems = ExtractDataItems(CurrentSection.Items); List <IExportColumn> convertedItems = FillAndConvert(sectionContainer, child, dataItems, converter); AdjustLocationInSection(sectionPosition, convertedItems); sectionContainer.ExportedItems.AddRange(convertedItems); MeasureAndArrangeContainer(sectionContainer); if (PageFull(sectionContainer)) { PerformPageBreak(); InsertContainer(sectionContainer); pagePosition = DetailStart; sectionContainer.Location = DetailStart; } sectionPosition = new Point(CurrentSection.Location.X, sectionPosition.Y + convertedItems[0].DisplayRectangle.Size.Height + 5); sectionContainer.Size = new Size(sectionContainer.Size.Width, sectionContainer.Size.Height + convertedItems[0].Size.Height); } MeasureAndArrangeContainer(sectionContainer); InsertContainer(sectionContainer); pagePosition = new Point(pagePosition.X, sectionContainer.DisplayRectangle.Bottom + 1); } }
void BuildSortedDetails(IContainerConverter converter, Point startPosition) { var exportRows = new List <IExportContainer>(); var pagePosition = startPosition; foreach (var element in DataSource.SortedList) { var sectionContainer = CreateContainerForSection(CurrentPage, pagePosition); var convertedItems = FillAndConvert(sectionContainer, element, ReportModel.DetailSection.Items, converter); sectionContainer.ExportedItems.AddRange(convertedItems); MeasureAndArrangeContainer(sectionContainer); if (PageFull(sectionContainer)) { InsertExportRows(exportRows); exportRows.Clear(); PerformPageBreak(); pagePosition = DetailStart; sectionContainer.Location = pagePosition; } exportRows.Add(sectionContainer); pagePosition = new Point(CurrentSection.Location.X, pagePosition.Y + sectionContainer.DesiredSize.Height + 1); } InsertExportRows(exportRows); }
void BuildGroupedDetails (IContainerConverter converter,Point startPosition) { var pagePosition = startPosition; var sectionPosition = pagePosition; foreach (IGrouping<object, object> grouping in DataSource.GroupedList) { var groupHeader = (BaseRowItem)CurrentSection.Items.Where(p => p.GetType() == typeof(GroupHeader)).FirstOrDefault(); var sectionContainer = CreateContainerForSection(CurrentPage, pagePosition); DataSource.Fill(groupHeader.Items,grouping.FirstOrDefault()); var headerRow = converter.ConvertToExportContainer(groupHeader); headerRow.Location = new Point(headerRow.Location.X,groupHeader.Location.Y); var headerItems = converter.CreateConvertedList(groupHeader.Items); converter.SetParent(sectionContainer, headerItems); headerRow.ExportedItems.AddRange(headerItems); headerRow.Parent = sectionContainer; sectionContainer.ExportedItems.Add(headerRow); EvaluateExpressionsInGroups(sectionContainer,grouping); pagePosition = new Point(CurrentSection.Location.X, pagePosition.Y + sectionContainer.DesiredSize.Height + 1); // Set Position Child Elements sectionPosition = new Point(pagePosition.X,headerRow.Location.Y + headerRow.Size.Height + 3); //Childs foreach (var child in grouping) { // var dataItems = CurrentSection.Items.Where(p => p.GetType() == typeof(BaseDataItem)).ToList(); var dataItems = ExtractDataItems(CurrentSection.Items); List<IExportColumn> convertedItems = FillAndConvert(sectionContainer, child, dataItems, converter); AdjustLocationInSection(sectionPosition, convertedItems); sectionContainer.ExportedItems.AddRange(convertedItems); MeasureAndArrangeContainer(sectionContainer); if (PageFull(sectionContainer)) { PerformPageBreak(); InsertContainer(sectionContainer); pagePosition = DetailStart; sectionContainer.Location = DetailStart; } sectionPosition = new Point(CurrentSection.Location.X, sectionPosition.Y + convertedItems[0].DisplayRectangle.Size.Height + 5); sectionContainer.Size = new Size(sectionContainer.Size.Width,sectionContainer.Size.Height + convertedItems[0].Size.Height); } MeasureAndArrangeContainer(sectionContainer); InsertContainer(sectionContainer); pagePosition = new Point(pagePosition.X,sectionContainer.DisplayRectangle.Bottom + 1); } }
List <IExportColumn> FillAndConvert(ExportContainer parent, object current, List <IPrintableObject> dataItems, IContainerConverter converter) { DataSource.Fill(dataItems, current); var convertedItems = converter.CreateConvertedList(dataItems.ToList()); converter.SetParent(parent, convertedItems); return(convertedItems); }
List<IExportColumn> FillAndConvert(ExportContainer parent, object current, List<IPrintableObject> dataItems, IContainerConverter converter) { DataSource.Fill(dataItems, current); var convertedItems = converter.CreateConvertedList(dataItems.ToList()); converter.SetParent(parent, convertedItems); return convertedItems; }
void BuildSortedDetails(IContainerConverter converter,Point startPosition){ var exportRows = new List<IExportContainer>(); var pagePosition = startPosition; foreach (var element in DataSource.SortedList) { var sectionContainer = CreateContainerForSection(CurrentPage, pagePosition); var convertedItems = FillAndConvert(sectionContainer,element,ReportModel.DetailSection.Items,converter); sectionContainer.ExportedItems.AddRange(convertedItems); MeasureAndArrangeContainer(sectionContainer); if (PageFull(sectionContainer)) { InsertExportRows(exportRows); exportRows.Clear(); PerformPageBreak(); pagePosition = DetailStart; sectionContainer.Location = pagePosition; } exportRows.Add(sectionContainer); pagePosition = new Point(CurrentSection.Location.X, pagePosition.Y + sectionContainer.DesiredSize.Height + 1); } InsertExportRows(exportRows); }