OpenPetra
Free Administration Software for Non-Profits
|
Contains Utility functions for ADO.NET Data operations. More...
Classes | |
struct | TColumnDifference |
small structure for comparing 2 DataRows by columns, used by CompareAllColumnValues More... | |
Static Public Member Functions | |
static int | GetDataViewIndexByDataTableIndex (DataView ADataView, DataTable ADataTable, int ARowNumberInTable) |
Gets the 0-based index in the specified DataView by specifying an index in a Datatable More... | |
static string | DateToSQLString (DateTime ? ADateTime) |
Gets the SQL friendly text for a date formatted as "yyyy-MM-dd" More... | |
static int | GetDataTableIndexByDataRowView (DataTable ADataTable, DataRowView ADataRowView) |
Gets the 0-based index of a row in a DataTable by specifying a DataRowView More... | |
static void | RemoveColumnsNotInTableTemplate (DataTable ATable, DataTable ATableTemplate) |
Remove the columns from the table that are not part of the template table More... | |
static Object[] | DestinationSaveItemArray (DataRow ADestinationRow, DataRow ACopyRow) |
get an array of the values ordered by the columns in the destination table More... | |
static void | ChangeDataTableToTypedDataTable (ref DataTable ADataTable, System.Type ATypedDataTableType, string ATableName) |
convert a normal datatable to a typed datatable using reflection More... | |
static void | CalculateHashAndSize (DataTable AHashDT, out String AHash, out Int32 ASize) |
Calculates a Hash value for a DataTable and calculates the size of the DataTable, too. More... | |
static void | CalculateHashAndSize (DataView AHashDV, out String AHash, out Int32 ASize) |
Calculate a Hash for a DataView and the calculates the size of the DataView, too. More... | |
static Boolean | HaveDataRowsIdenticalValues (DataRow ADataRow1, DataRow ADataRow2) |
compare the values of two rows More... | |
static Boolean | HaveDataRowsIdenticalValues (object[] ADataRow1, object[] ADataRow2) |
compare the values of two data rows expressed as object arrays More... | |
static bool | IsReallyChanged (DataRow ADataRow) |
compare the changed columns of a row. for some reasons, on the client the values are read from the controls, and despite the row has not changed, the row is marked modified More... | |
static Boolean | DataRowColumnsHaveChanged (DataRow ADataRow) |
Check if non-system bound data columns have actually changed in the given row. Only system fields begin 's_' More... | |
static void | CopyModificationIDsOver (DataRow ADestinationDR, DataRow ACopyDR) |
copy the modification ids from one datarow to another More... | |
static void | CopyModificationIDsOver (DataTable ADestinationDT, DataTable ACopyDT) |
copy the modification ids from one datatable to another More... | |
static void | CopyAllColumnValues (DataRow ASourceRow, DataRow ADestinationRow) |
Copy all values from one row to the other. Only copies columns with matching column names. More... | |
static void | CopyDataSet (DataSet ANewDS, DataSet AOrigDS) |
static void | CopyAllColumnValuesWithoutPK (DataRow ASourceRow, DataRow ADestinationRow) |
Copy all values from one row to the other; omit Primary Key Columns Only copies columns with matching column names More... | |
static void | CompareAllColumnValues (DataRow ASourceRow, DataRow ADestinationRow, out List< TColumnDifference >ADifferences) |
compare the values of two rows; must have the same columns More... | |
static void | CopyTo (DataTable ASrc, DataTable ADest) |
static Int32 | AcceptChangesForUnmodifiedRows (DataTable AInspectDT, Int32 AMaxColumn, Boolean AExcludeLocation0) |
make sure that unmodified rows are marked as accepted More... | |
static Int32 | AcceptChangesForUnmodifiedRows (DataTable AInspectDT, Int32 AMaxColumn) |
make sure that unmodified rows are marked as accepted More... | |
static Int32 | AcceptChangesForUnmodifiedRows (DataTable AInspectDT) |
make sure that unmodified rows are marked as accepted More... | |
static void | RemoveRowsNotPresentInDT (DataTable ASourceDT, DataTable ADestinationDT, bool ADontAttemptToProcessDTsWithoutPKs=false) |
Removes any DataRow from the Destination DataTable that isn't found in the Source DataTable. More... | |
static object[] | GetPKValuesFromDataRow (DataRow ADataRow) |
Returns the values of the DataColumns that make up the Primary Key of the DataTable that the passed in DataRow is part of. More... | |
static bool | ChangeDataColumnDataType (DataTable ATable, string AColumnName, Type ANewType) |
Changes a DataColumns' DataType to the desired DataType. This works even when the DataTable already holds data! More... | |
Contains Utility functions for ADO.NET Data operations.
|
inlinestatic |
make sure that unmodified rows are marked as accepted
AInspectDT |
|
inlinestatic |
make sure that unmodified rows are marked as accepted
AInspectDT | |
AMaxColumn |
|
inlinestatic |
make sure that unmodified rows are marked as accepted
AInspectDT | |
AMaxColumn | |
AExcludeLocation0 |
|
inlinestatic |
Calculates a Hash value for a DataTable and calculates the size of the DataTable, too.
Do not use for creation of a password hash - this Method uses the SHA1 algorithm for speed reasons but this is not deemed safe enough for password hashing! --> Use PasswordHelper.GetPasswordHash() for this instead!!!
AHashDT | The DataTable to be analysed. |
AHash | Returns the Hash value of the DataTable. |
ASize | Returns the size of the DataTable. |
|
inlinestatic |
Calculate a Hash for a DataView and the calculates the size of the DataView, too.
Do not use for creation of a password hash - this Method uses the SHA1 algorithm for speed reasons but this is not deemed safe enough for password hashing! --> Use PasswordHelper.GetPasswordHash() for this instead!!!
AHashDV | The DataView to be analysed. |
AHash | Returns the Hash value of the DataView. |
ASize | Returns the size of the DataView. |
|
inlinestatic |
Changes a DataColumns' DataType to the desired DataType. This works even when the DataTable already holds data!
The Method traverses the full DataRows Collection of the DataTable to copy data to the new DataType. This is likely not very efficient on huge DataTables!
The Method utilises System.Convert.ChangeType(object, Type) for the conversion of the type. Only conversions that System.Convert.ChangeType(object, Type) supports will work. If System.Convert.ChangeType(object, Type) throws an Exception then the ChangeDataColumnDataType Method will return false.
ATable | DataTable that holds the DataColumn whose DataType should be changed. |
AColumnName | Name of the DataColumn whose DataType should be changed. |
ANewType | Desired type that the DataColumn whose DataType should be changed should be changed to. |
|
inlinestatic |
convert a normal datatable to a typed datatable using reflection
ADataTable | the table to be converted |
ATypedDataTableType | the type of the typed datatable |
ATableName | the name for the table |
|
inlinestatic |
compare the values of two rows; must have the same columns
ASourceRow | |
ADestinationRow | |
ADifferences |
|
inlinestatic |
Copy all values from one row to the other. Only copies columns with matching column names.
ASourceRow | |
ADestinationRow |
|
inlinestatic |
Copy all values from one row to the other; omit Primary Key Columns Only copies columns with matching column names
ASourceRow | |
ADestinationRow |
|
inlinestatic |
Copy all values from the new dataset into the original dataset this is used for the data that comes from the JS client
|
inlinestatic |
copy the modification ids from one datarow to another
ADestinationDR | datarow to be modified |
ACopyDR | original values |
|
inlinestatic |
copy the modification ids from one datatable to another
ADestinationDT | datatable to be modified |
ACopyDT | original values |
|
inlinestatic |
delete the destination table, copy all rows from the source table; we assume both tables have the same columns, same type. this is needed for datasets, when the table is readonly and cannot be assigned directly
|
inlinestatic |
Check if non-system bound data columns have actually changed in the given row. Only system fields begin 's_'
ADataRow |
|
inlinestatic |
Gets the SQL friendly text for a date formatted as "yyyy-MM-dd"
ADateTime | The DataView to search |
|
inlinestatic |
get an array of the values ordered by the columns in the destination table
ADestinationRow | defines the desired order |
ACopyRow | the values to be ordered |
|
inlinestatic |
Gets the 0-based index of a row in a DataTable by specifying a DataRowView
ADataTable | The DataTable to search |
ADataRowView | The DataRowView that is the DataRow to find |
|
inlinestatic |
Gets the 0-based index in the specified DataView by specifying an index in a Datatable
ADataView | The DataView to search |
ADataTable | The DataTable containing the known record |
ARowNumberInTable | The 0-based row in the DataTable |
|
inlinestatic |
Returns the values of the DataColumns that make up the Primary Key of the DataTable that the passed in DataRow is part of.
ADataRow | DataRow from which to return the values of the DataColumns that make up the Primary Key of the DataTable that this DataRow is part of. |
|
inlinestatic |
compare the values of two rows
ADataRow1 | first row |
ADataRow2 | second row |
|
inlinestatic |
compare the values of two data rows expressed as object arrays
ADataRow1 | first row |
ADataRow2 | second row |
|
inlinestatic |
compare the changed columns of a row. for some reasons, on the client the values are read from the controls, and despite the row has not changed, the row is marked modified
|
inlinestatic |
Remove the columns from the table that are not part of the template table
ATable | table to be modified |
ATableTemplate | template with requested columns |
|
inlinestatic |
Removes any DataRow from the Destination DataTable that isn't found in the Source DataTable.
Both DataTables must have the same Primary Key for this Method to work!
A possible use for this Method is the removing of DataRows from a DataTable that is held on the Client side when the DataTable is re-loaded from the DB and the reloaded DataTable may contains less rows. Performing a DataSet.Merge operation (DataTable reloaded from the DB merged into client-side DataSet) does not remove DataRows that don't exist in the DataTable that got reloaded from the DB, but calling this Method after the DataSet.Merge does that.
ASourceDT | Source DataTable. |
ADestinationDT | Destination DataTable. |
ADontAttemptToProcessDTsWithoutPKs | Set this to true to not attemt to process DataTables that don't have Primary Keys. If this Argument is set to true, no Exception is thrown and the Method simply doesn't do any work, as it would need Primary Keys for performing its work (default=false). |