Click or drag to resize
DataHelper Class
Methods to work with the Data.
Inheritance Hierarchy

Namespace: CMS.Helpers
Assembly: CMS.Helpers (in CMS.Helpers.dll) Version: 8.2.23
Syntax
C#
public class DataHelper : CoreMethods

The DataHelper type exposes the following members.

Constructors
  NameDescription
Public methodDataHelper
Top
Methods
  NameDescription
Public methodStatic memberCompareByteArrays
Compares two byte arrays.
Public methodStatic memberConvertColumnToDateTime
Converts the specified column to Date time type.
Public methodStatic memberConvertToDataTableT
Method to convert LINQ result to DataTable
Public methodStatic memberConvertValue(Object, Type)
Converts the value to a specific type.
Public methodStatic memberConvertValue(Object, Type, Object)
Converts the value to a specific type. Returns true if conversion was possible, otherwise false.
Public methodStatic memberConvertValueToDefaultCulture
Converts value to its equivalent string representation using default culture format. Can be used to convert Double, Decimal, DateTime or TimeSpan values.
Public methodStatic memberCopyColumnValues
Copies column values from source column to target column.
Public methodStatic memberCreateUniqueTableColumn
Creates column with unique name int he given table.
Public methodStatic memberDataSetPivot
Converts data set to it's pilot.
Public methodStatic memberDataSourceIsEmpty(DataSet)
Returns true if the given data source is empty.
Public methodStatic memberDataSourceIsEmpty(Object)
Returns true if the given data source is empty.
Public methodStatic memberDeleteRows(DataSet, String)
Deletes the table rows matching the given where condition.
Public methodStatic memberDeleteRows(DataTable, String)
Deletes the table rows matching the given where condition.
Public methodStatic memberEnsureCodenames
Ensures Codename values in specified column.
Public methodStatic memberEnsureColumn
Ensures specified column.
Public methodStatic memberEnsureGUIDs
Ensures GUID values in specified column.
Public methodStatic memberEnsureIdentifiers
Ensures identifier values in specified column.
Public methodStatic memberEnsureRandomValues
Ensures random values in specified int column.
Public methodStatic memberEnsureStringValues
Ensures Codename values in specified column.
Public methodStatic memberExtendParameters
Extends the parameters array for new items.
Public methodStatic memberFileSizeFormat
Formats file size in human readable format.
Public methodStatic memberForEachRow
Executes the given action for each row in the given DataSet
Public methodStatic memberFromBase64String
Converts the string from Base64 string to the byte array.
Public methodStatic memberGetBoolValue(ISimpleDataContainer, String)
Gets the bool variable from given data container.
Public methodStatic memberGetBoolValue(DataRow, String, Boolean)
Gets the bool variable from given DataRow.
Public methodStatic memberGetBoolValue(ISimpleDataContainer, String, Boolean)
Gets the bool variable from given data container.
Public methodStatic memberGetColumns
Gets the columns of the given table as the string array.
Public methodStatic memberGetDataContainer
Gets the data container able to read the given data object
Public methodStatic memberGetDataContainerItem
Returns data from datarow, datarowview or ISimpleDataContainer objects for specified column.
Public methodStatic memberGetDataRowValue
Returns the value from the DataRow field, or DBNull.Value if the field does not exist in the datarow.
Public methodStatic memberGetDataRowViewValue
Returns the value from the DataRowView field, or null if the field does not exist in the datarow.
Public methodStatic memberGetDataSetFromXml
Gets DataSet from the given XML string.
Public methodStatic memberGetDataTable
Returns the DataTable from the given data source.
Public methodStatic memberGetDataView
Returns the DataView from the given data source.
Public methodStatic memberGetDateTimeValue(ISimpleDataContainer, String)
Gets the DateTime variable from given data container.
Public methodStatic memberGetDateTimeValue(DataRow, String, DateTime)
Gets the DateTime variable from given DataRow.
Public methodStatic memberGetDBNull
Converts the standard null value to DBNull.value, keeps the object value if not null.
Public methodStatic memberGetGuidValue(ISimpleDataContainer, String)
Gets the guid variable from given data container.
Public methodStatic memberGetGuidValue(DataRow, String, Guid)
Gets the guid variable from given DataRow.
Public methodStatic memberGetIntegerValues(DataTable, String)
Gets the array of integer values from the given data table.
Public methodStatic memberGetIntegerValues(DataView, String)
Gets the array of integer values from the given data table.
Public methodStatic memberGetIntValue(ISimpleDataContainer, String)
Gets the integer variable from given Data container.
Public methodStatic memberGetIntValue(DataRow, String, Int32)
Gets the integer variable from given DataRow.
Public methodStatic memberGetItemsCount
Gets the items count in the specified data source.
Public methodStatic memberGetMaximumValueT(DataTable, String)
Gets the maximum value from the given column.
Public methodStatic memberGetMaximumValueT(DataView, String)
Gets the maximum value from the given column.
Public methodStatic memberGetMinimumValueT
Gets the minimum value from the given column.
Public methodStatic memberGetNewItemsInList(String, String)
Gets the list of new items in the given list as list separated by semicolon.
Public methodStatic memberGetNewItemsInList(String, String, Char)
Gets the list of new items in the given list as list separated by separator.
Public methodStatic memberGetNotEmpty
Returns second parameter if the first is null or "".
Public methodStatic memberGetNotZero(Object, Int32)
Returns the object converted to integer or default value when the result of conversion equals zero.
Public methodStatic memberGetNotZero(Object, Object)
Returns the object converted to integer or default value when the result of conversion equals zero.
Public methodStatic memberGetNull
Converts the DBNull.value to standard null, keeps the object value if not null.
Public methodStatic memberGetObjectSize
Gets the size of the given object.
Public methodStatic memberGetObjectString(Object, Int32)
Gets the object as a string (for structured objects the object type and its size).
Public methodStatic memberGetObjectString(Object, Int32, Int32)
Gets the object as a string (for structured objects the object type and its size).
Public methodStatic memberGetParentPath
Returns the parent path for the specified path (any kind of path with "/" as a separator)
Public methodStatic memberGetPartialValue
Gets value from string that has values separated by separator.
Public methodStatic memberGetRowSize
Returns the row data size (size of the contained data).
Public methodStatic memberGetScalarValue
Gets the first value from the given DataSet.
Public methodStatic memberGetSingleColumnDataSet
Returns a DataSet containing single table with single column.
Public methodStatic memberGetSizeString(Int64)
Returns the string for the specified file size.
Public methodStatic memberGetSizeString(Int64, FileSizeUnitsEnum)
Returns the string for the specified file size.
Public methodStatic memberGetStringValue(ISimpleDataContainer, String)
Gets the string variable from given data container.
Public methodStatic memberGetStringValue(DataRow, String, String)
Gets the string variable from given DataRow.
Public methodStatic memberGetStringValues
Gets the array of string values from the given data table.
Public methodStatic memberGetTableSize
Returns the table data size (size of the contained data).
Public methodStatic memberGetTopNForPage
Gets the TOPN value to be able to get the specific page out of the paged results with old paging (through TOPN only).
Public methodStatic memberGetUniqueRows
Gets the list of unique rows based on given column value.
Public methodStatic memberGetUniqueValues
Gets the list of unique values based on given column value.
Public methodStatic memberGetValuesT
Gets the array of the values from the given data table.
Public methodStatic memberGetViewSize
Returns the view data size (size of the contained data).
Public methodStatic memberChangeBooleanValues(DataTable, String, Boolean, String)
Changes the boolean value in the given table.
Public methodStatic memberChangeBooleanValues(DataTable, String, Boolean, Boolean, String)
Changes the boolean value in the given table.
Public methodStatic memberChangeStringValues(DataTable, String, String, String)
Changes the string value in the given table.
Public methodStatic memberChangeStringValues(DataTable, String, String, String, String)
Changes the string value in the given table.
Public methodStatic memberChangeValuesToNull
Changes the value in the given table to NULL.
Public methodStatic memberIsEmpty
Returns true, if the given value is empty (null, DBNull, or "").
Public methodStatic memberIsValid
Tests if value is valid to given data type
Public methodStatic memberIsValidID
Returns true if the given value is a valid ID
Public methodStatic memberIsZero
Returns true, if the given value is zero (null, DBNull, or 0).
Public methodStatic memberLockDataSet
Makes the given DataSet read-only
Public methodStatic memberLowerCaseTableNames
Converts the table names of given DataSet to lowercase representation.
Public methodStatic memberMarkDuplicitRows
Marks the duplicit rows in the data table.
Public methodStatic memberMergeT, K, V
Merges two objects implementing the IDictionary interface of type T with key of type K and value of type V.
Public methodStatic memberMergeHashtables
Merges two hashtables.
Public methodStatic memberReadDataSetFromXml(DataSet, XmlReader, DataHelperActionCallback, Object)
Reads the DataSet from given XML reader (expects "NewDataSet" as a root node).
Public methodStatic memberReadDataSetFromXml(DataSet, XmlReader, DataHelperActionCallback, Object, String, ListString)
Reads the DataSet from given XML reader.
Public methodStatic memberReadDataSetFromXml(DataSet, XmlReader, DataHelperActionCallback, Object, String, ListString, String)
Reads the DataSet from given XML reader.
Public methodStatic memberReduceDataSetData
Reduces the data set data. Works in two modes: 1 - remove records (when calculateAverage is FALSE) 2 - calculate average values for the intervals (when calculateAverage is TRUE)
Public methodStatic memberRenameTable
Renames the table in the given DataSet.
Public methodStatic memberRestrictRows(DataSet, Int32)
Restricts the number of rows to the top N items.
Public methodStatic memberRestrictRows(DataSet, Int32, Int32, Int32)
Restricts the given DataSet to only given rows starting with the offset, and leaving only maximum defined number of rows.
Public methodStatic memberSelectRowsByString
Selects the table rows by string values.
Public methodStatic memberSetColumnValues
Sets column values to specified value.
Public methodStatic memberSetDataRowValue
Sets value to data row. If value is null, DBNull will be used.
Public methodStatic memberSetPartialValue
Sets new value to string that is separates by separator.
Public methodStatic memberSetTableName
Sets the table name in the specified DataSet.
Public methodStatic memberShiftValuesUp
Shifts the values in the column of Data table one row up.
Public methodStatic memberSortDataTable
Sorts the Data table using given OrderBy expression.
Public methodStatic memberTransferTable
Transfers tables from source DataSet to the destination DataSet and sets the source table name to specified value.
Public methodStatic memberTransferTableRows
Transfers table rows between two tables.
Public methodStatic memberTransferTables
Transfers tables from source DataSet to the destination DataSet.
Public methodStatic memberTranslateBinaryColumn
Translates the binary column within data table from its string representation to byte[].
Public methodStatic memberTrimDataSetPage
Trims first data table from source to fit into page.
Public methodStatic memberTrimLastIdFromList(String)
Trims last ID from ID list (delimited by semicolon). Returns trimmed list
Public methodStatic memberTrimLastIdFromList(String, Int32)
Trims last ID from ID list. Returns trimmed list.
Public methodStatic memberTryGetDataRowValue
Returns the value from the DataRow field.
Public methodStatic memberTryGetDataRowViewValue
Returns the value from the DataRowView field.
Public methodStatic memberUnion
Creates the union of two Datasets, the values are compared for uniqueness by the given ID column name.
Public methodStatic memberWriteDataSetToXml
Writes the DataSet from given XML reader.
Top
Extension Methods
  NameDescription
Public Extension MethodAsValue
Converts object to a query value which can be used as a query parameter
(Defined by QueryExtensions.)
Public Extension MethodGetAPIString
Gets the string by the specified resource key
(Defined by CoreExtensions.)
Public Extension MethodGetString
Gets the string by the specified resource key
(Defined by CoreExtensions.)
Public Extension MethodToBoolean
Returns the boolean representation of an object or default value if not.
(Defined by CoreExtensions.)
Public Extension MethodToDateTime
Returns the DateTime representation of an object or default value if not.
(Defined by CoreExtensions.)
Public Extension MethodToDouble
Returns the double representation of an object or default value if not.
(Defined by CoreExtensions.)
Public Extension MethodToGuid
Returns the Guid representation of an object or default value if not.
(Defined by CoreExtensions.)
Public Extension MethodToInteger
Returns the integer representation of an object or default value if not.
(Defined by CoreExtensions.)
Public Extension MethodToString
Returns the string representation of an object or default value if not.
(Defined by CoreExtensions.)
Top
Fields
  NameDescription
Public fieldStatic memberDATETIME_NOT_SELECTED
No datetime selected constant.
Public fieldStatic memberFAKE_ID
Fake ID to use when the ID column requires a value, and needs to be faked
Top
See Also