private DataColumn[] FilterColumns(DataTable sourceTable, string[] hiddenColumnNames, DataColumnCollection destinationColumns) { DataColumn[] columnArray = null; int num = 0; foreach (DataColumn column3 in sourceTable.Columns) { if (this.IncludeThisColumn(column3, hiddenColumnNames)) { num++; } } if (num == 0) { throw ADP.NoColumns(); } int index = 0; columnArray = new DataColumn[num]; foreach (DataColumn column in sourceTable.Columns) { if (this.IncludeThisColumn(column, hiddenColumnNames)) { DataColumn column2 = new DataColumn(column.ColumnName, column.DataType); destinationColumns.Add(column2); columnArray[index] = column; index++; } } return columnArray; }
private DataColumn[] FilterColumns(DataTable sourceTable, string[] hiddenColumnNames, DataColumnCollection destinationColumns) { DataColumn newDestinationColumn; int currentColumn; DataColumn[] filteredSourceColumns = null; int columnCount = 0; foreach (DataColumn sourceColumn in sourceTable.Columns){ if (IncludeThisColumn(sourceColumn,hiddenColumnNames) == true) { columnCount++; } } if (columnCount == 0) { throw ADP.NoColumns(); } currentColumn= 0; filteredSourceColumns = new DataColumn[columnCount]; foreach(DataColumn sourceColumn in sourceTable.Columns){ if (IncludeThisColumn(sourceColumn,hiddenColumnNames) == true) { newDestinationColumn = new DataColumn(sourceColumn.ColumnName,sourceColumn.DataType); destinationColumns.Add(newDestinationColumn); filteredSourceColumns[currentColumn] = sourceColumn; currentColumn++; } } return filteredSourceColumns; }
public void InsertAfter(DataColumnCollection columns, DataColumn currentColumn, DataColumn newColumn) { if (columns.Contains(currentColumn.ColumnName)) { columns.Add(newColumn); //add the new column after the current one columns[newColumn.ColumnName].SetOrdinal(currentColumn.Ordinal + 1); } else { } }
/// <summary> /// Adds a new <c>DataColumn</c> to the given collection. /// </summary> /// <remarks> /// The new <c>DataColumn</c> is contructed from the remaining /// arguments. /// </remarks> /// <param name="columns"> /// The collection to which to add the new column. /// </param> /// <param name="defaultValue"> /// The new column's default value /// </param> /// <param name="name"> /// The name of the new column. If a column with the same name /// pre-exists in the collection, this operation does nothing. /// </param> /// <param name="type"> /// The System.Type of the new column's values. /// </param> internal static void AddColumn( DataColumnCollection columns, object defaultValue, string name, Type type) { if (columns.Contains(name)) { return; } DataColumn column = new DataColumn(name, type); if (defaultValue != null) { column.DefaultValue = defaultValue; } columns.Add(column); }
private void AddCustomFieldColumns(DataColumnCollection columns) { var fields = Bitrix.BXCustomEntityManager.GetFields(BXIBlockElement.GetCustomFieldsKey(iblockId)); foreach (var field in fields) columns.Add("#" + field.Name, typeof(BXCustomProperty)); }
/// <summary> /// Constructs a new <c>DataColumn</c> with the given /// <c>name</c>, <c>type</c> and <c>defaultValue</c>, /// adding it to the given collection. /// </summary> /// <param name="columns"> /// The collection to which to add the new column. /// </param> /// <param name="defaultValue"> /// The new column's default value /// </param> /// <param name="name"> /// The name of the new column. If a column with the /// same name pre-exists in the collection, this operation /// is a no-op. /// </param> /// <param name="type"> /// The System.Type of the new column's values. /// </param> public static void AddColumn(DataColumnCollection columns, object defaultValue, string name, Type type) { DataColumn column = new DataColumn(name, type); if (defaultValue != null) { column.DefaultValue = defaultValue; } columns.Add(column); }
private uint Pop(CUQueue UQueue, ref DataColumnCollection Cols) { bool bNull = false; uint nSize = UQueue.GetSize(); UQueue.Load(out bNull); if (bNull) Cols = null; else { int n; int nLen; DataColumn dc = null; Cols.Clear(); UQueue.Load(out nLen); for (n = 0; n < nLen; n++) { Pop(UQueue, ref dc); Cols.Add(dc); dc = null; } } return (nSize - UQueue.GetSize()); }