public void PlainCollectionFind() { this.itemCollection = this.PlainCollection(); BaseReportItem r = itemCollection.Find("t2"); Assert.AreEqual("t2", r.Name); }
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; }
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; }
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); }
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); }
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 void PlainCollectionFind () { this.itemCollection = this.PlainCollection(); BaseReportItem r = itemCollection.Find("t2"); Assert.AreEqual("t2",r.Name); }
public void FindWithNameIsEmpty () { itemCollection = this.PlainCollection(); BaseReportItem r = itemCollection.Find(String.Empty); }
public void FindWithNameIsNull () { itemCollection = this.PlainCollection(); BaseReportItem r = itemCollection.Find(null); }
public void FindWithNameIsEmpty() { itemCollection = this.PlainCollection(); BaseReportItem r = itemCollection.Find(String.Empty); }
public void FindWithNameIsNull() { itemCollection = this.PlainCollection(); BaseReportItem r = itemCollection.Find(null); }
public override bool ReceiveDialogMessage(DialogMessage message) { if (customizer == null) { customizer = (Properties)base.CustomizationObject; reportStructure = (ReportStructure)customizer.Get("Generator"); } if (message == DialogMessage.Activated) { this.model = reportStructure.CreateAndFillReportModel(); this.resultDataSet = FillGrid(); if (this.resultDataSet != null) { this.grdQuery.DataSource = this.resultDataSet.Tables[0]; foreach (DataGridViewColumn dd in this.grdQuery.Columns) { DataGridViewColumnHeaderCheckBoxCell cb = new DataGridViewColumnHeaderCheckBoxCell(); cb.CheckBoxAlignment = HorizontalAlignment.Right; cb.Checked = true; dd.HeaderCell = cb; dd.SortMode = DataGridViewColumnSortMode.NotSortable; } this.grdQuery.AllowUserToOrderColumns = true; } base.EnableNext = true; base.EnableFinish = true; } else if (message == DialogMessage.Finish) { 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]; } } // only checked columns are used in the report ReportItemCollection sourceItems = WizardHelper.DataItemsFromDataSet(this.resultDataSet); AvailableFieldsCollection abstractColumns = WizardHelper.AbstractColumnsFromDataSet(this.resultDataSet); ReportItemCollection 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); } } reportStructure.ReportItemCollection.AddRange(destItems); if ((this.sqlParamsCollection != null) && (this.sqlParamsCollection.Count > 0)) { reportStructure.SqlQueryParameters.AddRange(sqlParamsCollection); } if (abstractColumns != null) { reportStructure.AvailableFieldsCollection.AddRange(abstractColumns); } } base.EnableNext = true; base.EnableFinish = true; } return(true); }