private bool setMetaData(MetaDataTable target, MetaDataTable source) { if (target == null) { return(true); } MetaDataRow newRow = (MetaDataRow)target.NewRow(); for (var i = 0; i < newRow.ItemArray.Length; i++) { if (!source.Columns.ItemByIndex(i).IsColumnUsedForGrouping) { newRow[i] = source.Rows.ItemByIndex(0)[i]; } } if (target.Rows.Count == 0) { target.Rows.Add(newRow); } else { target.Rows.ItemByIndex(0).ItemArray = newRow.ItemArray; } target.AcceptChanges(); return(false); }
/// <summary> /// Method for accepting the meta data. /// </summary> public void AcceptDataChanges() { if (_data.Rows.Count == 0) { var row = (MetaDataRow)_data.NewRow(); foreach (var editor in getEditors()) { var col = getEditorColumn(editor); if (col == null) { continue; } if (col.DataType == typeof(double)) { var editorValue = getEditorValue(editor); row[col] = editorValue ?? (object)DBNull.Value; } else { row[col] = editor.EditValue ?? DBNull.Value; } } _data.Rows.Add(row); } _data.AcceptChanges(); OnMetaDataChanged?.Invoke(this, new EventArgs()); }