protected void CheckSettingsAndFirstRow(DataTable dt, SettingsResultSetComparisonByName settings) { if (dt.Rows.Count == 0) { return; } var dr = dt.Rows[0]; for (int i = 0; i < dr.Table.Columns.Count; i++) { var columnName = dr.Table.Columns[i].ColumnName; CheckSettingsFirstRowCell( settings.GetColumnRole(columnName) , settings.GetColumnType(columnName) , dr.Table.Columns[columnName] , dr.IsNull(columnName) ? DBNull.Value : dr[columnName] , new string[] { "The column named '{0}' is expecting a numeric value but the first row of your result set contains a value '{1}' not recognized as a valid numeric value or a valid interval." , " Aren't you trying to use a comma (',' ) as a decimal separator? NBi requires that the decimal separator must be a '.'." , "The column named '{0}' is expecting a date & time value but the first row of your result set contains a value '{1}' not recognized as a valid date & time value." } ); } }
protected void WriteSettingsToDataTableProperties(DataTable dt, SettingsResultSetComparisonByName settings) { foreach (DataColumn column in dt.Columns) { WriteSettingsToDataTableProperties( column , settings.GetColumnRole(column.ColumnName) , settings.GetColumnType(column.ColumnName) , settings.GetTolerance(column.ColumnName) , settings.GetRounding(column.ColumnName) ); } }
protected void RemoveIgnoredRows(DataTable dt, SettingsResultSetComparisonByName settings) { var i = 0; while (i < dt.Columns.Count) { if (settings.GetColumnRole(dt.Columns[i].ColumnName) == ColumnRole.Ignore) { dt.Columns.RemoveAt(i); } else { i++; } } }