Beispiel #1
0
 public Report(string name, string width)
 {
     m_Name    = name;
     m_Width   = width;
     m_Columns = new ReportColumnCollection();
     m_Items   = new ReportItemCollection();
 }
        private Point ConvertGroupHeader(ExporterCollection exportList, BaseSection section, Point offset)
        {
            var retVal  = Point.Empty;
            var rowSize = Size.Empty;
            ReportItemCollection groupCollection = null;
            var groupedRows = section.Items.FindGroupHeader();

            if (groupedRows.Count == 0)
            {
                groupCollection = section.Items.ExtractGroupedColumns();
                base.DataNavigator.Fill(groupCollection);
                base.FireSectionRendering(section);
                ExporterCollection list = ExportHelper.ConvertPlainCollection(groupCollection, offset);

                EvaluationHelper.EvaluateRow(base.Evaluator, list);

                exportList.AddRange(list);

                retVal = new Point(DefaultLeftPosition, offset.Y + groupCollection[0].Size.Height + 20 + (3 * GlobalValues.GapBetweenContainer));
            }
            else
            {
                FillRow(groupedRows[0], base.DataNavigator);
                rowSize = groupedRows[0].Size;
                base.FireGroupHeaderRendering(groupedRows[0]);
                retVal = ConvertStandardRow(exportList, groupedRows[0]);

                groupedRows[0].Size = rowSize;
            }
            return(retVal);
        }
        public void Collection_Contains_Subclass()
        {
            var            modifyedCollection = this.ModifyCollection();
            IDataManager   dm = ICSharpCode.Reports.Core.DataManager.CreateInstance(modifyedCollection, new ReportSettings());
            IDataNavigator dn = dm.GetNavigator;

            ReportItemCollection searchCol = new ReportItemCollection();

            searchCol.Add(new BaseDataItem()
            {
                ColumnName = "DummyClass.DummyString"
            }
                          );

            searchCol.Add(new BaseDataItem()
            {
                Name       = "GroupItem",
                ColumnName = "GroupItem"
            }
                          );

            dn.Reset();
            dn.MoveNext();

            while (dn.MoveNext())
            {
                dn.Fill(searchCol);
                var a = (BaseDataItem)searchCol[0];
                var b = (BaseDataItem)searchCol[1];
                var c = modifyedCollection[dn.CurrentRow];
                Assert.AreEqual(a.DBValue, c.DummyClass.DummyString);
                Assert.AreEqual(b.DBValue, c.GroupItem);
            }
        }
        public void DateTimeCan_FillChild()
        {
            var dataNavigator = PrepareDateTimeGrouping();
            ReportItemCollection searchCol = new ReportItemCollection();

            searchCol.Add(new BaseDataItem()
            {
                Name       = "RandomDate",
                ColumnName = "Last"
            }
                          );

            var compare = System.DateTime.MinValue;

            while (dataNavigator.MoveNext())
            {
                Contributor groupResult = dataNavigator.Current as Contributor;
                Assert.LessOrEqual(compare, groupResult.RandomDate);
                if (dataNavigator.HasChildren)
                {
                    var childNavigator = dataNavigator.GetChildNavigator;
                    do
                    {
                        Assert.That(dataNavigator.HasChildren, Is.True);
                        // we know that current is a 'contributor'
                        Contributor c = dataNavigator.Current as Contributor;
                        Assert.IsNotNull(c);
//						string v2 = c.Last + " GroupVal :" +  c.RandomDate;
//						Console.WriteLine(v2);
                    }while (childNavigator.MoveNext());
                }
            }
        }
        /// <summary>
        /// Determines if the specified report is FPL report
        /// </summary>
        private ExportForm.ReportType DetermineReportType()
        {
            var sectionReport = arDesigner.Report as SectionReport;

            if (sectionReport != null)
            {
                return(ExportForm.ReportType.Section);
            }

            var pageReport = arDesigner.Report as PageReport;

            if (pageReport == null)
            {
                return(DefaultReportType);
            }

            var report = pageReport.Report;

            if (report == null || report.Body == null)
            {
                return(DefaultReportType);
            }

            ReportItemCollection items = report.Body.ReportItems;

            return(items != null && items.Count == 1 && items[0] is FixedPage ? ExportForm.ReportType.PageFpl : ExportForm.ReportType.PageCpl);
        }
Beispiel #6
0
 public ListLayout(ReportModel reportModel, ReportItemCollection reportItemCollection) : base(reportModel)
 {
     this.reportItems = reportItemCollection;
     ICSharpCode.Reports.Core.BaseRowItem row = new ICSharpCode.Reports.Core.BaseRowItem();
     AdjustContainer(base.ReportModel.DetailSection, row);
     base.SetParent(row);
 }
Beispiel #7
0
 private static void AdjustParentInternal(ReportItemCollection items, BaseReportItem parent)
 {
     foreach (BaseReportItem item in items)
     {
         item.Parent = parent;
     }
 }
Beispiel #8
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (this.reportItemCollection != null)
                {
                    this.reportItemCollection.Clear();
                    this.reportItemCollection = null;
                }
                if (this.availableFieldsCollection != null)
                {
                    this.availableFieldsCollection.Clear();
                    this.availableFieldsCollection = null;
                }
                if (this.SqlQueryParameters != null)
                {
                    this.SqlQueryParameters.Clear();
                    this.SqlQueryParameters = null;
                }
            }

            // Release unmanaged resources.
            // Set large fields to null.
            // Call Dispose on your base class.
        }
Beispiel #9
0
        private void WriteResult()
        {
            if (this.resultDataSet != null)
            {
                // check reordering of columns
                DataGridViewColumn[]         displayCols;
                DataGridViewColumnCollection dc = this.grdQuery.Columns;

                displayCols = new DataGridViewColumn[dc.Count];
                for (int i = 0; i < dc.Count; i++)
                {
                    if (dc[i].Visible)
                    {
                        displayCols[dc[i].DisplayIndex] = dc[i];
                    }
                }

                ReportItemCollection destItems = WizardHelper.CreateItemsCollection(this.resultDataSet, displayCols);
                reportStructure.ReportItemCollection.Clear();
                reportStructure.ReportItemCollection.AddRange(destItems);


                var abstractColumns = WizardHelper.AvailableFieldsCollection(this.resultDataSet);
                if (abstractColumns != null)
                {
                    reportStructure.AvailableFieldsCollection.Clear();
                    reportStructure.AvailableFieldsCollection.AddRange(abstractColumns);
                }
            }
            base.EnableNext   = true;
            base.EnableFinish = true;
        }
 protected void CreateChildren(ReportItemCollection childrenDef, PageContext pageContext)
 {
     if (childrenDef != null && childrenDef.Count != 0 && m_children == null)
     {
         double num  = 0.0;
         double num2 = 0.0;
         m_children           = new PageItem[childrenDef.Count + 1];
         m_indexesLeftToRight = new int[childrenDef.Count + 1];
         for (int i = 0; i < childrenDef.Count; i++)
         {
             ReportItem source = childrenDef[i];
             m_children[i]           = PageItem.Create(source, tablixCellParent: false, pageContext);
             m_indexesLeftToRight[i] = i;
             num  = Math.Max(num, m_children[i].ItemPageSizes.Right);
             num2 = Math.Max(num2, m_children[i].ItemPageSizes.Bottom);
         }
         double num3 = 0.0;
         num3 = ((!pageContext.ConsumeWhitespace) ? Math.Max(num2, base.ItemPageSizes.Height) : num2);
         m_children[m_children.Length - 1]           = new HiddenPageItem(num3, 0.0);
         m_indexesLeftToRight[m_children.Length - 1] = m_children.Length - 1;
         m_rightPadding           = Math.Max(0.0, m_itemPageSizes.Width - num);
         m_definitionRightPadding = m_rightPadding;
         m_bottomPadding          = Math.Max(0.0, m_itemPageSizes.Height - num2);
         Array.Sort(m_indexesLeftToRight, this);
         VerticalDependency();
         HorizontalDependecy();
     }
 }
        public void  Convert_SimpleItems_Should_Calculate_Correct_Locations()
        {
            ReportItemCollection ri     = new ReportItemCollection();
            Point          itemLocation = new Point(10, 10);
            BaseReportItem r            = new BaseTextItem()
            {
                Location = itemLocation,
                Size     = new Size(20, 100)
            };

            ri.Add(r);

            Point     offset          = new Point(20, 20);
            Rectangle parentRectangle = new Rectangle(50, 50, 700, 50);

            Sut.ParentRectangle = parentRectangle;

            ExporterCollection ec = Sut.ConvertSimpleItems(offset, ri);

            BaseExportColumn be = ec[0];

//			this.ParentRectangle.Location.X + lineItem.StyleDecorator.Location.X,
//				                                             lineItem.StyleDecorator.Location.Y + offset.Y);


            Point resultLocation = new Point(parentRectangle.Location.X + itemLocation.X, itemLocation.Y + offset.Y);

            Assert.AreEqual(resultLocation, be.StyleDecorator.Location);
        }
        internal static ReportItemCollection CreateItemsCollection(DataSet resultDataSet, DataGridViewColumn[] displayCols)
        {
            ReportItemCollection sourceItems = WizardHelper.ReportItemCollection(resultDataSet);
            ReportItemCollection destItems   = WizardHelper.ExtractSelectedItems(sourceItems, displayCols);

            return(destItems);
        }
Beispiel #13
0
 public void ClearAllItems()
 {
     itemCollection = this.PlainCollection();
     Assert.AreEqual(3, itemCollection.Count);
     itemCollection.Clear();
     Assert.AreEqual(0, itemCollection.Count);
 }
        public void NullValue_In_Property_Should_Return_EmptyString()
        {
            ContributorsList contributorsList = new ContributorsList();
            var contColl = contributorsList.ContributorCollection;

            foreach (Contributor element in contColl)
            {
                element.GroupItem = null;
            }

            IDataManager   dm      = ICSharpCode.Reports.Core.DataManager.CreateInstance(contColl, new ReportSettings());
            IDataNavigator dataNav = dm.GetNavigator;


            ReportItemCollection searchCol = new ReportItemCollection();

            searchCol.Add(new BaseDataItem()
            {
                Name       = "GroupItem",
                ColumnName = "GroupItem"
            }
                          );
            dataNav.Reset();
            dataNav.MoveNext();
            do
            {
                dataNav.Fill(searchCol);
                BaseDataItem resultItem = searchCol[0] as BaseDataItem;

                Assert.That(resultItem.Name, Is.EqualTo("GroupItem"));
                Assert.That(resultItem.DBValue, Is.EqualTo(String.Empty));
            }while (dataNav.MoveNext());
        }
Beispiel #15
0
        public void Constructor()
        {
            ReportItemCollection it = new ReportItemCollection();

            Assert.IsNotNull(it, "Should not be 'null'");
            Assert.AreEqual(0, it.Count, "Count should be '0'");
        }
Beispiel #16
0
        public void PlainCollectionFind()
        {
            this.itemCollection = this.PlainCollection();
            BaseReportItem r = itemCollection.Find("t2");

            Assert.AreEqual("t2", r.Name);
        }
Beispiel #17
0
		public Report( string name, string width )
		{
			m_Name = name;
			m_Width = width;
			m_Columns = new ReportColumnCollection();
			m_Items = new ReportItemCollection();
		}
Beispiel #18
0
		public ListLayout(ReportModel reportModel,ReportItemCollection reportItemCollection):base(reportModel)
		{
			this.reportItems = reportItemCollection;
			ICSharpCode.Reports.Core.BaseRowItem row = new ICSharpCode.Reports.Core.BaseRowItem();
			AdjustContainer(base.ReportModel.DetailSection,row);
			base.ParentItem = row;
		}
Beispiel #19
0
        public void PageHeaderShouldContainNoItem()
        {
            ICSharpCode.Reports.Core.BaseSection s = this.mockReportModel.ReportHeader;
            ReportItemCollection c = s.Items;

            Assert.AreEqual(0, s.Items.Count);
        }
Beispiel #20
0
 private static void AdjustParentInternal(ReportItemCollection items, ISimpleContainer parent)
 {
     foreach (BaseReportItem item in items)
     {
         item.Parent = parent as BaseReportItem;
     }
 }
Beispiel #21
0
        private void WriteResult()
        {
            if (this.resultDataSet != null)
            {
                // check reordering of columns
                DataGridViewColumn[]         displayCols;
                DataGridViewColumnCollection dc = this.grdQuery.Columns;

                displayCols = new DataGridViewColumn[dc.Count];
                for (int i = 0; i < dc.Count; i++)
                {
                    if (dc[i].Visible)
                    {
                        displayCols[dc[i].DisplayIndex] = dc[i];
                    }
                }


                ReportItemCollection sourceItems = WizardHelper.ReportItemCollection(this.resultDataSet);

                AvailableFieldsCollection abstractColumns = WizardHelper.AvailableFieldsCollection(this.resultDataSet);

                ReportItemCollection destItems = new ReportItemCollection();

                // only checked columns are used in the report
                foreach (DataGridViewColumn cc in displayCols)
                {
                    DataGridViewColumnHeaderCheckBoxCell hc = (DataGridViewColumnHeaderCheckBoxCell)cc.HeaderCell;
                    if (hc.Checked)
                    {
                        BaseReportItem br = (BaseReportItem)sourceItems.Find(cc.HeaderText);
                        destItems.Add(br);
                    }
                }

                reportStructure.ReportItemCollection.Clear();
                reportStructure.ReportItemCollection.AddRange(destItems);

                /*
                 * if ((this.sqlParamsCollection != null) && (this.sqlParamsCollection.Count > 0)) {
                 *      reportStructure.SqlQueryParameters.AddRange(sqlParamsCollection);
                 * }
                 */
                if (abstractColumns != null)
                {
                    reportStructure.AvailableFieldsCollection.Clear();
                    reportStructure.AvailableFieldsCollection.AddRange(abstractColumns);
                }

                /*
                 * if ((this.sqlParamsCollection != null) && (this.sqlParamsCollection.Count > 0)) {
                 *      reportStructure.SqlQueryParameters.Clear();
                 *      reportStructure.SqlQueryParameters.AddRange(sqlParamsCollection);
                 * }
                 */
            }
            base.EnableNext   = true;
            base.EnableFinish = true;
        }
Beispiel #22
0
 public void RefreshDisplay()
 {
     _lookup    = ReportItem.CollectAll();
     _viewModel = new ReportItemViewModel {
         Collection = ReportItem.CollectAll()
     };
     DataContext = _viewModel;
 }
        public void RemoveFirstElementAndCheckForEvent()
        {
            itemCollection = this.PlainCollection();
            int i = itemCollection.Count;

            itemCollection.RemoveAt(1);
            Assert.AreEqual(i - 1, itemCollection.Count);
        }
Beispiel #24
0
		public void Fill (ReportItemCollection collection) {
			foreach (var item in collection) {
				IDataItem dataItem = item as IDataItem;
				if (dataItem != null) {
					this.store.Fill(dataItem);
				}
			}
		}
        public void CollectionContainsSubclass()
        {
            var            modifyedCollection = this.ModifyCollection();
            GroupColumn    gc = new GroupColumn("GroupItem", 1, ListSortDirection.Ascending);
            ReportSettings rs = new ReportSettings();

            rs.GroupColumnsCollection.Add(gc);

            IDataManager   dm            = ICSharpCode.Reports.Core.DataManager.CreateInstance(modifyedCollection, rs);
            IDataNavigator dataNavigator = dm.GetNavigator;

            ReportItemCollection searchCol = new ReportItemCollection();

            searchCol.Add(new BaseDataItem()
            {
                ColumnName = "DummyClass.DummyString"
            }
                          );
            searchCol.Add(new BaseDataItem()
            {
                Name       = "Last",
                ColumnName = "Last"
            }
                          );

            searchCol.Add(new BaseDataItem()
            {
                ColumnName = "GroupItem"
            }
                          );

            string compare = string.Empty;

            while (dataNavigator.MoveNext())
            {
                dataNavigator.Fill(searchCol);
                var b1     = (BaseDataItem)searchCol[2];
                var result = b1.DBValue;
                Assert.That(compare, Is.LessThan(result));

                if (dataNavigator.HasChildren)
                {
                    var childNavigator = dataNavigator.GetChildNavigator;
                    do
                    {
                        childNavigator.Fill(searchCol);
                        var itemDummy = (BaseDataItem)searchCol[0];
                        var itemLast  = (BaseDataItem)searchCol[1];
                        var itemGroup = (BaseDataItem)searchCol[2];
                        Console.WriteLine("\t{0} - {1} - {2}", itemDummy.DBValue, itemLast.DBValue, itemGroup.DBValue);
                        Assert.That(itemDummy.DBValue, Is.Not.Empty);
                        Assert.That(itemLast.DBValue, Is.Not.Empty);
                        Assert.That(itemGroup.DBValue, Is.Not.Empty);
                    }while (childNavigator.MoveNext());
                }
                compare = result;
            }
        }
Beispiel #26
0
        public override void Fill(int position, ReportItemCollection collection)
        {
            var current = this.CurrentFromPosition(position);

            foreach (IDataItem item in collection)
            {
                FillInternal(current, item);
            }
        }
Beispiel #27
0
        public void PageHeaderShouldContainOneItem()
        {
            ICSharpCode.Reports.Core.BaseSection section = this.createdReportModel.ReportHeader;
            ReportItemCollection c = section.Items;

            Assert.AreEqual(1, section.Items.Count);
            ICSharpCode.Reports.Core.BaseReportItem item = section.Items[0];
            Assert.IsNotNull(item);
        }
        public void SortChildrenDescending()
        {
            ReportSettings rs = new ReportSettings();
            GroupColumn    gc = new GroupColumn("GroupItem", 1, ListSortDirection.Ascending);

            rs.GroupColumnsCollection.Add(gc);

            SortColumn sc = new SortColumn("Last", ListSortDirection.Descending);

            rs.SortColumnsCollection.Add(sc);
            IDataManager dm            = ICSharpCode.Reports.Core.DataManager.CreateInstance(this.contributorCollection, rs);
            var          dataNavigator = dm.GetNavigator;

            ReportItemCollection searchCol = new ReportItemCollection();

            searchCol.Add(new BaseDataItem()
            {
                Name       = "Last",
                ColumnName = "Last"
            }
                          );

            searchCol.Add(new BaseDataItem()
            {
                ColumnName = "GroupItem"
            }
                          );

            string compare = String.Empty;

            while (dataNavigator.MoveNext())
            {
                dataNavigator.Fill(searchCol);
                var column = (BaseDataItem)searchCol[1];
                var result = column.DBValue.ToString();

                Assert.That(compare, Is.LessThan(result));
                if (dataNavigator.HasChildren)
                {
                    string compareChild   = String.Empty;
                    var    childNavigator = dataNavigator.GetChildNavigator;
                    do
                    {
                        childNavigator.Fill(searchCol);
                        var childColumn = (BaseDataItem)searchCol[0];
                        var childResult = childColumn.DBValue.ToString();
//						Console.WriteLine("\t{0}",childResult);
                        if (!String.IsNullOrEmpty(compareChild))
                        {
                            Assert.LessOrEqual(childResult, compareChild);
                        }
                        compareChild = childResult;
                    }while (childNavigator.MoveNext());
                }
            }
        }
 private static void CollectTextBoxes(ReportItemCollection collection, PageContext pageContext, bool useForPageHFEval, Dictionary <string, List <object> > textBoxes)
 {
     if (collection != null && collection.Count != 0)
     {
         for (int i = 0; i < collection.Count; i++)
         {
             HeaderFooterEval.CollectTextBoxes(((ReportElementCollectionBase <ReportItem>)collection)[i], pageContext, useForPageHFEval, textBoxes);
         }
     }
 }
Beispiel #30
0
        public void GetReportItemsTest()
        {
            TestDeviceData       dat = new TestDeviceData();
            ReportItemCollection ris = dat.GetReportItems();

            foreach (ReportItem r in ris)
            {
                Console.WriteLine(r);
            }
        }
 private static void CollectTextBoxes(ReportItemCollection collection, PageContext pageContext, bool useForPageHFEval, Dictionary <string, List <object> > textBoxes)
 {
     if (collection != null && collection.Count != 0)
     {
         for (int i = 0; i < collection.Count; i++)
         {
             CollectTextBoxes(collection[i], pageContext, useForPageHFEval, textBoxes);
         }
     }
 }
Beispiel #32
0
		public override void Fill(int position,ReportItemCollection collection)
		{
			DataRow row = this.table.Rows[position];
			foreach (var item in collection) {
				IDataItem dataItem = item as IDataItem;
				if (dataItem != null) {
					FillInternal (row,dataItem);
				}
			}
		}
        public void RemoveElementAndCheckForEvent()
        {
            itemCollection = this.PlainCollection();
            int            i = itemCollection.Count;
            BaseReportItem r = itemCollection[1];

            Assert.AreEqual("t2", r.Name);
            itemCollection.Remove(r);
            Assert.AreEqual(i - 1, itemCollection.Count);
        }
Beispiel #34
0
        public void RemoveFirstElementAndCheckForEvent()
        {
            itemCollection = this.PlainCollection();
            int i = itemCollection.Count;

            itemCollection.Removed += OnRemoveItem;
            itemCollection.RemoveAt(1);
            Assert.AreEqual(i - 1, itemCollection.Count);
            Assert.IsTrue(gotEvent, "No 'removed' Event");
            gotEvent = false;
        }
Beispiel #35
0
		public  static void AdjustParent (BaseReportItem parent,ReportItemCollection items)
		{
			foreach (BaseReportItem i in items) {
				i.Parent = parent;
				ISimpleContainer ic = i as ISimpleContainer;
				if (ic != null) {
					AdjustParentInternal(ic.Items,i);
				} else {
					AdjustParentInternal(items,parent);
				}
			}
		}
Beispiel #36
0
		internal static  ReportItemCollection ExtractSelectedItems(ReportItemCollection sourceItems,DataGridViewColumn[] displayCols)
		{
			var destItems = new ReportItemCollection();
			foreach (DataGridViewColumn cc in displayCols) {
				DataGridViewColumnHeaderCheckBoxCell hc = (DataGridViewColumnHeaderCheckBoxCell)cc.HeaderCell;
				if (hc.Checked) {
					BaseReportItem br = (BaseReportItem)sourceItems.Find(cc.HeaderText);
					destItems.Add(br);
				}
			}
			return destItems;
		}
Beispiel #37
0
		public  static void AdjustParent (ISimpleContainer parent,ReportItemCollection items)
		{
			foreach (BaseReportItem item in items) {
				item.Parent = parent as BaseReportItem;
				ISimpleContainer container = item as ISimpleContainer;
				if (container != null) {
					AdjustParentInternal(container.Items,container);
				} else {
					AdjustParentInternal(items,parent as ISimpleContainer);
				}
			}
		}
Beispiel #38
0
		public void Fill(ReportItemCollection collection)
		{
			TableStrategy tableStrategy =  store as TableStrategy;
			foreach (var item in collection) {
				IDataItem dataItem = item as IDataItem;
				if (dataItem != null) {
					CurrentItemsCollection currentItemsCollection = tableStrategy.FillDataRow(this.indexList[CurrentRow].ListIndex);
					CurrentItem s = currentItemsCollection.FirstOrDefault(x => x.ColumnName == dataItem.ColumnName);
					dataItem.DBValue = s.Value.ToString();
				}
				
			}
		}
		public void InsertOneItem ()
		{
			itemCollection = this.PlainCollection();
			int len = itemCollection.Count();
			BaseReportItem r = new BaseReportItem();
			r.Name = "Inserted";
			itemCollection.Insert(1,r);
			Assert.AreEqual (len + 1,itemCollection.Count());
		
			// read inserted element and check some default values
			BaseReportItem r1 = itemCollection.Find("Inserted");
			Assert.AreEqual(GlobalValues.DefaultBackColor,r1.BackColor);
			Assert.AreEqual(System.Drawing.Color.Black,r1.ForeColor);
		}
		public static void EvaluateReportItems (IExpressionEvaluatorFacade  evaluator,ReportItemCollection items)
		{
			foreach(BaseReportItem column in items)
			{
				var container = column as ISimpleContainer ;
				if (container != null) {
					EvaluateReportItems(evaluator,container.Items);
				}
				
				IReportExpression expressionItem = column as IReportExpression;
				if (expressionItem != null) {
					evaluator.Evaluate(expressionItem);
				}
			}
		}
		public ExporterCollection ConvertSimpleItems (Point offset,ReportItemCollection items)
		{
			if (items == null) {
				throw new ArgumentNullException("items");
			}
			ExporterCollection col = new ExporterCollection();
			if (items.Count > 0) {
				
				foreach(BaseReportItem item in items)
				{
					col.Add(ConvertToLineItem(offset,item));
				}
			}
			return col;
		}
		public static AbstractLayout CreateGenerator (GlobalEnums.ReportLayout reportLayout,
		                                              ReportModel model,
		                                              ReportItemCollection items)
		{
			AbstractLayout layout = null;
			switch (reportLayout) {
				case GlobalEnums.ReportLayout.ListLayout:
					layout = new ListLayout(model,items);
					break;
				case GlobalEnums.ReportLayout.TableLayout:
					layout = new TableLayout(model,items);
					break;
			}
			return layout;
		}
Beispiel #43
0
		private BaseReportItem FindRec (ReportItemCollection items, string name)
		{
			foreach(BaseReportItem item in items)
			{
				ISimpleContainer cont = item as ISimpleContainer;
				if (cont != null) {
					return FindRec(cont.Items,name);
				} else {
					var query = from bt in items where bt.Name == name select bt;
					if (query.Count() >0) {
						return query.FirstOrDefault();
					}
				}
			}
			return null;
		}
		private void EvaluateRecursive (IExpressionEvaluatorFacade evaluatorFassade,ReportItemCollection items)
		{
			foreach (BaseReportItem be in items) {
				
				ISimpleContainer  ec = be as ISimpleContainer;
				if (ec != null)
				{
					if (ec.Items.Count > 0) {
						EvaluateRecursive(evaluatorFassade,ec.Items);
					}
				}
				BaseTextItem bt = be as BaseTextItem;
				if (bt != null) {
					bt.Text = evaluatorFassade.Evaluate(bt.Text);
				}
			}
		}
Beispiel #45
0
		public static  ExporterCollection ConvertPlainCollection (ReportItemCollection items,Point offset)
		{
			if (items == null) {
				throw new ArgumentNullException("items");
			}

			ExporterCollection col = new ExporterCollection();
			if (items.Count > 0) {
				items.SortByLocation();
				foreach(BaseReportItem item in items)
				{
					var converteditem = ExportHelper.ConvertLineItem(item,offset);
					col.Add((BaseExportColumn)converteditem);
				}
			}
			return col;
		}
		public void TypeOfReportItemIsString () {
			var ric = new ReportItemCollection(){
				new BaseDataItem(){
					ColumnName = "Lastname"
						
				},
				new BaseDataItem(){
					ColumnName = "Firstname"
				}
			};
			var collectionSource = new CollectionSource	(list,new ReportSettings());
			collectionSource.Bind();
			collectionSource.Fill(ric);
			foreach (BaseDataItem element in ric) {
				Assert.That(element.DataType,Is.EqualTo("System.String"));
			}
		}
Beispiel #47
0
		public static  ExporterCollection ConvertPlainCollection (ReportItemCollection items,Point offset)
		{
			if (items == null) {
				throw new ArgumentNullException("items");
			}
			Console.WriteLine("Convert plain collection");
			ExporterCollection col = new ExporterCollection();
			if (items.Count > 0) {
				items.SortByLocation();
				foreach(BaseReportItem item in items)
				{
					var converteditem = ExportHelper.ConvertLineItem(item,offset);
					Console.WriteLine("{0} - {1}",converteditem.ToString(),converteditem.StyleDecorator.DisplayRectangle);
					col.Add((BaseExportColumn)converteditem);
				}
			}
			Console.WriteLine("");
			return col;
		}
Beispiel #48
0
		public void FillCollection()
		{
			var dataNavigator = PrepareStringGrouping();
			ReportItemCollection searchCol = new ReportItemCollection();
			
			searchCol.Add(new BaseDataItem ()
			              {
			              	Name ="Last",
			              	ColumnName ="Last"
			              }
			             );
			searchCol.Add(new BaseDataItem ()
			              {
			              
			              	ColumnName ="GroupItem"
			              }
			             );
			dataNavigator.Reset();
			dataNavigator.MoveNext();

			do
			{
				if (dataNavigator.HasChildren)
				{
					dataNavigator.Fill(searchCol);
					var b = (BaseDataItem)searchCol[1];
//					Console.WriteLine("-- <{0}>-",b.DBValue);
					var childNavigator = dataNavigator.GetChildNavigator;
					do
					{
						childNavigator.Fill(searchCol);
						var filledItem = (BaseDataItem)searchCol[0];
						Assert.That(filledItem.DBValue,Is.Not.Empty);
					}
					while (childNavigator.MoveNext());
				}
			}
			while (dataNavigator.MoveNext());
		}
Beispiel #49
0
		internal static ReportItemCollection ReportItemCollection (DataSet dataSet)
		{
			if (dataSet == null) {
				throw new ArgumentNullException("dataSet");
			}
		
			if (dataSet.Tables.Count > 1) {
				string s = String.Format(System.Globalization.CultureInfo.InvariantCulture,
				                         "AutoBuildFromDataSet : at this time no more than one table is allowed <{0}>",dataSet.Tables.Count);
				ICSharpCode.Core.MessageService.ShowError(s);
			}
			
			ReportItemCollection itemCol = new ReportItemCollection();
			
			foreach (DataTable tbl in dataSet.Tables) {
				foreach (DataColumn col  in tbl.Columns) {
					if (col.DataType == typeof(System.Byte[])) {
						ICSharpCode.Reports.Core.BaseImageItem rItem = new ICSharpCode.Reports.Core.BaseImageItem();
						rItem.ColumnName = col.ColumnName;
						rItem.BaseTableName = tbl.TableName;
						rItem.Name = col.ColumnName;
						rItem.ScaleImageToSize = false;
						itemCol.Add (rItem);
					} else {
						ICSharpCode.Reports.Core.BaseDataItem rItem = new ICSharpCode.Reports.Core.BaseDataItem();
						rItem.ColumnName = col.ColumnName;
						rItem.DBValue = col.ColumnName;
						rItem.BaseTableName = tbl.TableName;
						rItem.DataType = col.DataType.ToString();
						rItem.Name = col.ColumnName;
						rItem.Text = "=[" + col.ColumnName + "]";
						itemCol.Add (rItem);
					}
				}
			}
			return itemCol;
		}
		public void DataNavigator_Return_ErrMessage_If_ColumnName_NotExist ()
		{
			IDataManager dm = ICSharpCode.Reports.Core.DataManager.CreateInstance(this.contributorCollection as System.Collections.IList,new ReportSettings());
			IDataNavigator dataNav = dm.GetNavigator;
			BaseDataItem item = new BaseDataItem();
			item.ColumnName = "ColumnNotExist";
			var items = new ReportItemCollection();
			items.Add(item);
			dataNav.Fill(items);
			string str = "<" + item.ColumnName +">";
			Assert.That(item.DBValue.Contains(str));
		}
		public void FindWithNameIsEmpty ()
		{
			itemCollection = this.PlainCollection();
			BaseReportItem r = itemCollection.Find(String.Empty);
		}
		public void PlainCollectionFind ()
		{
			this.itemCollection = this.PlainCollection();
			BaseReportItem r = itemCollection.Find("t2");
			Assert.AreEqual("t2",r.Name);
		}
		public void FillReportItemCollection () {
			var ric = new ReportItemCollection(){
				new BaseDataItem(){
					ColumnName = "Lastname"
						
				},
				new BaseDataItem(){
					ColumnName = "Firstname"
				}
			};
			var collectionSource = new CollectionSource	(list,new ReportSettings());
			collectionSource.Bind();
			collectionSource.Fill(ric);
			foreach (BaseDataItem element in ric) {
				Assert.That(element.DBValue,Is.Not.EqualTo(String.Empty));
			}
		}
		public void RemoveElementAndCheckForEvent ()
		{
			itemCollection = this.PlainCollection();
			int i = itemCollection.Count;
			BaseReportItem r = itemCollection[1];
			Assert.AreEqual("t2",r.Name);
			itemCollection.Remove (r);
			Assert.AreEqual(i-1,itemCollection.Count);
		}
		public void RemoveFirstElementAndCheckForEvent ()
		{
			itemCollection = this.PlainCollection();
			int i = itemCollection.Count;
			itemCollection.RemoveAt(1);
			Assert.AreEqual(i-1,itemCollection.Count) ;
		}
		public override void Fill(int position,ReportItemCollection collection)
		{
			var current = this.CurrentFromPosition(position);
			foreach (IDataItem item in collection)
            {
                FillInternal(current, item);
            }
		}
Beispiel #57
0
		public TableLayout(ReportModel reportModel,ReportItemCollection reportItemCollection):base(reportModel)
		{
			ReportItems = reportItemCollection;
		}
Beispiel #58
0
		// only checked columns are use in the report
		
		private ReportItemCollection CreateItemsCollection (DataGridViewColumn[] displayCols)
		{
			ReportItemCollection items = new ReportItemCollection();
			foreach (DataGridViewColumn cc in displayCols) {
				DataGridViewColumnHeaderCheckBoxCell hc= (DataGridViewColumnHeaderCheckBoxCell)cc.HeaderCell;
				if (hc.Checked) {
					AbstractColumn ac = this.abstractColumns.Find(cc.HeaderText);
					ICSharpCode.Reports.Core.BaseDataItem br = new ICSharpCode.Reports.Core.BaseDataItem();
					br.Name = ac.ColumnName;
					br.ColumnName = ac.ColumnName;
					br.DataType = ac.DataTypeName;
					br.DBValue = ac.ColumnName;
					items.Add(br);
				}
			}
			return items;
		}
Beispiel #59
0
		protected  virtual void Dispose(bool disposing){
			if (disposing) {
				if (this.reportItemCollection != null) {
					this.reportItemCollection.Clear();
					this.reportItemCollection = null;
				}
				if (this.availableFieldsCollection != null) {
					this.availableFieldsCollection.Clear();
					this.availableFieldsCollection = null;
				}
				if (this.queryParameters != null) {
					this.queryParameters.Clear();
					this.queryParameters = null;
					
				}
			}
		
			// Release unmanaged resources.
			// Set large fields to null.
			// Call Dispose on your base class.
		}
Beispiel #60
0
		protected override void Dispose(bool disposing)
		{
			try {
				if (disposing){
					if (this.items != null) {
						this.items.Clear();
						this.items = null;
					}
				}
			} finally {
				base.Dispose(disposing);
			}
		}