OpenPetra
Free Administration Software for Non-Profits
Ict.Common.TSaveConvert Class Reference

some static methods for the save conversion of dates to objects and objects to dates More...

Inheritance diagram for Ict.Common.TSaveConvert:

Static Public Member Functions

static DateTime ObjectToDate (object ADateObject)
 Converts a date value that is stored in a TObject to a DateTime value that is guaranteed to be valid. More...
 
static DateTime ObjectToDate (object ADateObject, TNullHandlingEnum ANullHandling)
 Converts a date value that is stored in a object to a DateTime value that is guaranteed to be valid. More...
 
static DateTime DateColumnToDate (DataColumn ADataColumn, DataRow ADataRow)
 Converts a DataColumn that holds a DateTime into a DateTime that is guaranteed to be valid. More...
 
static DateTime DateColumnToDate (DataColumn ADataColumn, DataRow ADataRow, TNullHandlingEnum ANullHandling)
 Converts a DataColumn that holds a DateTime into a DateTime that is guaranteed to be valid. More...
 
static String StringColumnToString (DataColumn ADataColumn, DataRow ADataRow)
 Converts a DataColumn that holds a String into a String that is guaranteed to be valid. More...
 

Detailed Description

some static methods for the save conversion of dates to objects and objects to dates

Member Function Documentation

◆ DateColumnToDate() [1/2]

static DateTime Ict.Common.TSaveConvert.DateColumnToDate ( DataColumn  ADataColumn,
DataRow  ADataRow 
)
inlinestatic

Converts a DataColumn that holds a DateTime into a DateTime that is guaranteed to be valid.

In case the date value in the DataColumn is DBNull, the lowest possible date is returned.

@comment Very useful for DataColumns in Typed DataTables that are of DateTime type. Using this function, no Exception is thrown when trying to get the value of a DataColumn of Type DateTime that is DBNull.

Parameters
ADataColumnDataColumn of Type DateTime
ADataRowDataRow in which the value is found
Returns
A valid DateTime

◆ DateColumnToDate() [2/2]

static DateTime Ict.Common.TSaveConvert.DateColumnToDate ( DataColumn  ADataColumn,
DataRow  ADataRow,
TNullHandlingEnum  ANullHandling 
)
inlinestatic

Converts a DataColumn that holds a DateTime into a DateTime that is guaranteed to be valid.

In case the date value in the DataColumn is DBNull, the lowest possible date is returned.

@comment Very useful for DataColumns in Typed DataTables that are of DateTime type. Using this function, no Exception is thrown when trying to get the value of a DataColumn of Type DateTime that is DBNull.

Parameters
ADataColumnDataColumn of Type DateTime
ADataRowDataRow in which the value is found
ANullHandlingSwitch to return either the lowest (nhReturnLowestDate) or the highest (nhReturnHighestDate) possible date in case the date value in the TObject is empty
Returns
A valid DateTime

◆ ObjectToDate() [1/2]

static DateTime Ict.Common.TSaveConvert.ObjectToDate ( object  ADateObject)
inlinestatic

Converts a date value that is stored in a TObject to a DateTime value that is guaranteed to be valid.

In case the date value in the TObject is empty, the lowest possible date is returned.

@comment Very useful for untyped data in DataSets that is known to be of DateTime type.

Parameters
ADateObjectTObject containing a date value
Returns
A valid DateTime

◆ ObjectToDate() [2/2]

static DateTime Ict.Common.TSaveConvert.ObjectToDate ( object  ADateObject,
TNullHandlingEnum  ANullHandling 
)
inlinestatic

Converts a date value that is stored in a object to a DateTime value that is guaranteed to be valid.

In case the date value in the object is empty, either the lowest or the highest possible date is returned.

@comment Very useful for untyped data in DataSets that is known to be of DateTime type.

Parameters
ADateObjectTObject containing a date value
ANullHandlingSwitch to return either the lowest (nhReturnLowestDate) or the highest (nhReturnHighestDate) possible date in case the date value in the TObject is empty
Returns
A valid DateTime

◆ StringColumnToString()

static String Ict.Common.TSaveConvert.StringColumnToString ( DataColumn  ADataColumn,
DataRow  ADataRow 
)
inlinestatic

Converts a DataColumn that holds a String into a String that is guaranteed to be valid.

In case the String value in the DataColumn is DBNull, an empty String ('') is returned.

@comment Very useful for DataColumns in Typed DataTables that are of String type. Using this function, no Exception is thrown when trying to get the value of a DataColumn of Type String that is DBNull.

Parameters
ADataColumnDataColumn of Type DateTime
ADataRowDataRow in which the value is found
Returns
A valid String

The documentation for this class was generated from the following file: