[Quantproject-developers] QuantProject/b1_ADT ExtendedDataTable.cs,1.8,1.9
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-06-10 18:52:15
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23020/b1_ADT Modified Files: ExtendedDataTable.cs Log Message: Modified CopyAndSort static method in ExtendedDataTable class Index: ExtendedDataTable.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ExtendedDataTable.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ExtendedDataTable.cs 1 Dec 2004 22:46:59 -0000 1.8 --- ExtendedDataTable.cs 10 Jun 2005 18:52:00 -0000 1.9 *************** *** 38,50 **** /// <summary> ! /// Copy the given DataTable into another DataTable, sorting by the specified field, in a DESC mode /// </summary> public static DataTable CopyAndSort(DataTable tableToCopyAndSort, string sortingFieldName, bool sortByASC) { DataTable copyOfTableToCopyAndSort = tableToCopyAndSort.Clone(); string sortDirection = " DESC"; if(sortByASC) ! sortDirection = " ASC"; ! DataRow[] orderedRows = tableToCopyAndSort.Select("", sortingFieldName + sortDirection); for(int i = 0;i<orderedRows.Length;i++) { --- 38,63 ---- /// <summary> ! /// Copy the given DataTable into another DataTable, sorting by the specified field, in the given mode /// </summary> public static DataTable CopyAndSort(DataTable tableToCopyAndSort, string sortingFieldName, bool sortByASC) { + return ExtendedDataTable.CopyAndSort(tableToCopyAndSort, + "", sortingFieldName, sortByASC); + } + + /// <summary> + /// Copy the given DataTable into another DataTable, + /// filtering by the given expression, sorting by the specified field, in the given mode + /// </summary> + public static DataTable CopyAndSort(DataTable tableToCopyAndSort, + string filterExpression, + string sortingFieldName, bool sortByASC) + { DataTable copyOfTableToCopyAndSort = tableToCopyAndSort.Clone(); string sortDirection = " DESC"; if(sortByASC) ! sortDirection = " ASC"; ! ! DataRow[] orderedRows = tableToCopyAndSort.Select(filterExpression, sortingFieldName + sortDirection); for(int i = 0;i<orderedRows.Length;i++) { *************** *** 53,57 **** return copyOfTableToCopyAndSort; } ! public static void DeleteRows(DataTable table, long fromIndex) { --- 66,70 ---- return copyOfTableToCopyAndSort; } ! public static void DeleteRows(DataTable table, long fromIndex) { |