本文整理汇总了C#中ReportItemCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ReportItemCollection.Add方法的具体用法?C# ReportItemCollection.Add怎么用?C# ReportItemCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReportItemCollection
的用法示例。
在下文中一共展示了ReportItemCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExtractSelectedItems
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;
}
示例2: FillCollection
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());
}
示例3: ReportItemCollection
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;
}
示例4: AddItemsToContainer
protected ReportItemCollection AddItemsToContainer (ReportItemCollection items)
{
int locationX = GlobalValues.ControlMargins.Left;
var minCtrlWidth = CalculateControlWidth(ParentItem,items);
var col = new ReportItemCollection();
foreach (var ir in items) {
ir.Location = new Point(locationX,GlobalValues.ControlMargins.Top);
col.Add(ir);
locationX += minCtrlWidth;
}
return col;
}
示例5: HeaderColumnsFromReportItems
private static ReportItemCollection HeaderColumnsFromReportItems(ReportItemCollection reportItemCollection)
{
if (reportItemCollection == null) {
throw new ArgumentNullException ("reportItemCollection");
}
ReportItemCollection itemCol = new ReportItemCollection();
ICSharpCode.Reports.Core.BaseTextItem rItem;
int i = 1;
foreach (IDataRenderer dataRenderer in reportItemCollection) {
rItem = WizardHelper.CreateTextItem(dataRenderer.ColumnName);
rItem.Name = rItem.Text + i.ToString(System.Globalization.CultureInfo.InvariantCulture);
itemCol.Add(rItem);
i ++;
}
return itemCol;
}
示例6: WriteResult
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;
}
示例7: GetReportItems
/// <summary>
///
/// </summary>
/// <returns></returns>
public virtual ReportItemCollection GetReportItems()
{
ReportItemCollection reportItems = new ReportItemCollection();
AttributePropertyInfoPairCollection attPropertyInfos = this.GetDeviceDataItemAttributes();
foreach (AttributePropertyInfoPair item in attPropertyInfos)
{
DataItemAttribute att = item.Attribute;
PropertyInfo pi = item.PropertyInfo;
object value = pi.GetValue(this, null);
ReportItem reportItem = new ReportItem(att.Name, value, att.Unit, att.Format);
reportItems.Add(reportItem);
}
return reportItems;
}
示例8: SortChildrenDescending
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());
}
}
}
示例9: CreateItemsCollection
// 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;
}
示例10: SaveItem
private void SaveItem(ReportItemCollection items, string name)
{
Control container = this.report.MultiView;
if (this.report.ItemIndexTable.Contains(name) && !this.report.ItemIndexTable[name].Equals(Guid.Empty))
{
Guid id = (Guid)this.report.ItemIndexTable[name];
SaveItem(name, id);
}
items.Clear();
ListBox listboxItem = (ListBox)container.FindControl(string.Format("{0}{1}", LISTBOX_ITEM, name));
foreach (ListItem li in listboxItem.Items)
{
Guid id = new Guid(li.Value);
byte[] value = (byte[])report.ItemTable[id];
ReportItem reportItem = (ReportItem)XmlConverter.ConvertTo(value);
items.Add(reportItem);
}
}
示例11: SubPropertyName_Is_Wrong
public void SubPropertyName_Is_Wrong ()
{
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 ()
{
Name ="GroupItem",
ColumnName ="DummyClass.Wrong",
DataType = "System.Int32"
}
);
dn.Reset();
dn.MoveNext();
while (dn.MoveNext()) {
dn.Fill(searchCol);
var a = (BaseDataItem)searchCol[0];
Assert.That(a.DBValue.StartsWith("Error"));
}
}
示例12: Collection_Contains_Subclass
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);
}
}
示例13: NullValue_In_Property_Should_Return_EmptyString
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());
}
示例14: DateTimeCan_FillChild
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());
}
}
}
示例15: ReceiveDialogMessage
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;
}