Show / Hide Table of Contents

Class UdefValueHelper

Inheritance
Object
UdefValueHelper
EntityUdefHelper
UdefImportHelper
Namespace: SuperOffice.CRM.Data.Util
Assembly: SoDataBase.dll
Syntax
public class UdefValueHelper : Object

Constructors

UdefValueHelper()

Declaration
public UdefValueHelper()

Methods

ConvertCheckboxToDbType(UDefFieldRow, Object)

Convert a bool, string bool, int or numeric string to the database storage type for Udef type Checkbox

Declaration
protected static object ConvertCheckboxToDbType(UDefFieldRow definition, object value)
Parameters
Type Name Description
UDefFieldRow definition

Definition of udef field

Object value

Value

Returns
Type Description
Object

Storage value

Exceptions
Type Condition
SoIllegalOperationException

Thrown if the incoming data type cannot be converted to the underlying storage type

ConvertDateToDbType(UDefFieldRow, Object)

Convert a DateTime, int or Invariant-culture date string to the database storage format for Udef type Date (1970-2038)

Declaration
protected static object ConvertDateToDbType(UDefFieldRow definition, object value)
Parameters
Type Name Description
UDefFieldRow definition

Definition of udef field

Object value

Value

Returns
Type Description
Object

Storage value

Exceptions
Type Condition
SoIllegalOperationException

Thrown if the incoming data type cannot be converted to the underlying storage type

ConvertDbToSpecificType(UDefFieldRow, Object)

Convert the storage (database) type to the .NET corresponding type. Thus, an int representing a date becomes a DateTime; a string representing an unlimiteddate also becomes a DateTime, etc.

Declaration
public static object ConvertDbToSpecificType(UDefFieldRow definition, object value)
Parameters
Type Name Description
UDefFieldRow definition

Definition of udef value to be converted

Object value

Value (storage, database type)

Returns
Type Description
Object

.NET type corresponding to the udef field type

ConvertDbTypeToString(UDefFieldRow, Object)

Utility function for converting a udef STORAGE value with its definition into a string.

Declaration
public static string ConvertDbTypeToString(UDefFieldRow definition, object value)
Parameters
Type Name Description
UDefFieldRow definition

Definition of the column to convert

Object value

Value to convert, must be the relevant storage (database) type for this udef type

Returns
Type Description
String

Udef value as string; all formats are according to the InvariantInfo culture.

Remarks

String values created in this way will be correctly parsed by the methods that set udef values, for instance by doing

con.Udef["MyFieldProgid"] = someStringValue;

The from string conversion works for all udef data types.

ConvertDecimalToDbType(UDefFieldRow, Object)

Convert a double or string to the database storage type for Udef type Decimal

Declaration
protected static object ConvertDecimalToDbType(UDefFieldRow definition, object value)
Parameters
Type Name Description
UDefFieldRow definition

Definition of udef field

Object value

Value

Returns
Type Description
Object

Storage value

Exceptions
Type Condition
SoIllegalOperationException

Thrown if the incoming data type cannot be converted to the underlying storage type

ConvertListToDbType(UDefFieldRow, Object)

Convert an integer or numeric string list id to the database storage type for Udef type List

Declaration
protected static object ConvertListToDbType(UDefFieldRow definition, object value)
Parameters
Type Name Description
UDefFieldRow definition

Definition of udef field

Object value

Value

Returns
Type Description
Object

Storage value

Exceptions
Type Condition
SoIllegalOperationException

Thrown if the incoming data type cannot be converted to the underlying storage type

ConvertNumberToDbType(UDefFieldRow, Object)

Convert an int or numeric (integer) string to the database storage type for Udef type Number

Declaration
protected static object ConvertNumberToDbType(UDefFieldRow definition, object value)
Parameters
Type Name Description
UDefFieldRow definition

Definition of udef field

Object value

Value

Returns
Type Description
Object

Storage value

Exceptions
Type Condition
SoIllegalOperationException

Thrown if the incoming data type cannot be converted to the underlying storage type

ConvertSpecificToDbType(UDefFieldRow, Object)

Convert .NET type to the storage (database) type. Thus, a DateTime representing a date becomes an int (seconds since 1970), an unlimiteddate DateTime becomes an YYYYMMDD string, etc. This method also accepts inputs of type string for all values; date and number formats must correspond to InvariantInfo culture formats.

Declaration
protected static object ConvertSpecificToDbType(UDefFieldRow definition, object value)
Parameters
Type Name Description
UDefFieldRow definition

Definition of udef value to be converted

Object value

Value (specific .NET type or string)

Returns
Type Description
Object

Storage (database) type corresponding to the udef field definition

Exceptions
Type Condition
SoIllegalOperationException

Thrown if the incoming data type cannot be converted to the underlying storage type

ConvertSpecificTypeToString(UDefFieldRow, Object)

Utility function for converting a udef value with its definition into a string.

Declaration
public static string ConvertSpecificTypeToString(UDefFieldRow definition, object value)
Parameters
Type Name Description
UDefFieldRow definition

Definition of the column to convert

Object value

Value to convert, must be the relevant storage (database) type for this udef type

Returns
Type Description
String

Udef value as string; all formats are according to the formats used by CultureDataFormatter.

Remarks

String values created in this way will be correctly parsed by the methods that set udef values, for instance by doing

con.Udef["MyFieldProgid"] = someStringValue;

The from string conversion works for all udef data types.

ConvertUnlimitedDateToDbType(UDefFieldRow, Object)

Convert a DateTime or Invariant-culture date string to the database storage type for Udef type UnlimitedDate

Declaration
protected static object ConvertUnlimitedDateToDbType(UDefFieldRow definition, object value)
Parameters
Type Name Description
UDefFieldRow definition

Definition of udef field

Object value

Value

Returns
Type Description
Object

Storage value

Exceptions
Type Condition
SoIllegalOperationException

Thrown if the incoming data type cannot be converted to the underlying storage type

DateTime2TimeTLocal(DateTime)

Convert the local-time DateTime to a local-time C time_t value.

Declaration
public static int DateTime2TimeTLocal(DateTime dateTime)
Parameters
Type Name Description
DateTime dateTime

Local-time DateTime to convert from

Returns
Type Description
Int32

Seconds since local-time January 1st, 1970

ErrorIdentification(UDefFieldRow)

Provide an identification string for exception messages

Declaration
protected static string ErrorIdentification(UDefFieldRow definition)
Parameters
Type Name Description
UDefFieldRow definition

Definition of udef field

Returns
Type Description
String

Friendly string

TimeTLocal2DateTime(Int32)

Convert the time from a local-time C time_t value to local-time DateTime.

Declaration
public static DateTime TimeTLocal2DateTime(int time)
Parameters
Type Name Description
Int32 time

Seconds since local-time January 1st, 1970

Returns
Type Description
DateTime

Local-time DateTime converted to.

Extension Methods

EnumUtil.MapEnums<From, To>(From)
ObjectExtensions.AssignByReflection<T>(T, T)
ObjectExtensions.GraphCopy<T>(T)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top