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);
        }
Example #3
0
		/*
		void NewMethod(IContainerConverter converter, ref Point pagePosition, ref Point sectionPosition, IGrouping<object, object> grouping, ExportContainer sectionContainer)
		{
			foreach (var child in grouping) {
				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);
			}
		}
*/

		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 groupHeader = (BaseRowItem)CurrentSection
					.Items.
					FirstOrDefault(p => p.GetType() == typeof(GroupHeader));
				
				var sectionContainer = CreateContainerForSection(CurrentPage, pagePosition);
				DataSource.Fill(groupHeader.Items,grouping.FirstOrDefault());
				
				var headerRow = converter.ConvertToExportContainer(groupHeader);
				headerRow.Location = groupHeader.Location;

				
				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 = ExtractDataItems(CurrentSection.Items);

					var convertedItems = FillAndConvert(sectionContainer, child, dataItems, converter)
						.OrderBy(p => p.Location.X).ToList();
					
					var xx = convertedItems.FirstOrDefault().Location;
					
					Console.WriteLine(xx);
					
					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);
			}
		}
Example #4
0
		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;
		}