Show / Hide Table of Contents

Class UDefFieldCacheBase

Inheritance
Object
CacheBaseV2
UDefFieldCacheBase
UDefFieldAdminCache
UDefFieldCache
Implements
IFlushableV2
IDisposable
Inherited Members
CacheBaseV2.IsCacheInvalidated(String, Int32, PrivateSave)
CacheBaseV2.Dispose()
CacheBaseV2.Flush()
CacheBaseV2.BeginDisableAutoUpdate()
CacheBaseV2.GetCurrent<T>()
CacheBaseV2.Load()
CacheBaseV2.Disposed
Namespace: SuperOffice.CRM.Rows
Assembly: SoDataBase.dll
Syntax
public abstract class UDefFieldCacheBase : CacheBaseV2, IFlushableV2, IDisposable

Constructors

UDefFieldCacheBase()

Declaration
protected UDefFieldCacheBase()

Properties

TableNames

Declaration
protected override IEnumerable<string> TableNames { get; }
Property Value
Type Description
IEnumerable<String>
Overrides
CacheBaseV2.TableNames
Remarks

Although we read from table "UserPreference" we shouldn't add it to TableNames for this cache because there's too much traffic on that table. Invoking flush on table change would be expensive, so flushing manually is the way to go. "Udeflayout" is a pseudo-table that updates whenever published layout changes.

Methods

CheckRevision()

Declaration
protected virtual void CheckRevision()

GetAllPageOneFieldsFromType(UDefType)

Get ALL page one fields from an udef type

Declaration
public ILookup<int, UDefFieldCacheBase.PageOneFieldInfo> GetAllPageOneFieldsFromType(UDefType type)
Parameters
Type Name Description
UDefType type

Udef type

Returns
Type Description
ILookup<Int32, UDefFieldCacheBase.PageOneFieldInfo>

Lists of UDefFieldCacheBase.PageOneFieldInfo elements containing user-defined field definitions and line number (1-based)

GetDefaultValue(UDefFieldRow)

Get a field's default value as a typed (parsed) object: an int, a date, or whatever. There are no parsing exceptions thrown by this method. Multi-language parsing is performed for all kinds of values prior to other parsing, as in the windows client.

Declaration
public static object GetDefaultValue(UDefFieldRow definition)
Parameters
Type Name Description
UDefFieldRow definition

Udef field definition

Returns
Type Description
Object

An object of the correct type for the database type of the udef field (so a dropdown list field will get an int, which is the list item id). If the stored default is not parseable as the target type, an 'empty' object of the correct type is returned (0 for ints, etc.)

GetFirstFromLabel(UDefType, String)

Get a field definition based on the field label. This method is not safe as field labels are easily changed through the Admin client, and therefore not guaranteed to be constant. Labels are also not enforced unique.

Declaration
public UDefFieldRow GetFirstFromLabel(UDefType type, string label)
Parameters
Type Name Description
UDefType type

Type of udef field to search

String label

Label to look for

Returns
Type Description
UDefFieldRow

Row definition, or null if no match

Remarks

To improve reliability, this method will strip colon, semicolon, blank, newline, carriage return, tab and minus characters from the front and back of labels, as well as convert to lower case for comparison. The 'label' in-parameter is also treated this way. A sequential search is then made, and the first field found to match is returned.

GetFirstFromLabelWithCulture(UDefType, String, String)

Get a field definition based on the field label, parsed according to a specified culture. This method is not safe as field labels are easily changed through the Admin client, and therefore not guaranteed to be constant. Labels are also not enforced unique.

Declaration
public UDefFieldRow GetFirstFromLabelWithCulture(UDefType type, string label, string culture)
Parameters
Type Name Description
UDefType type

Type of udef field to search

String label

Label to look for

String culture

Culture to apply to labels during parsing

Returns
Type Description
UDefFieldRow

Row definition, or null if no match

Remarks

Initially, all labels are parsed according to the given culture (labels that do not follow multi-language layout are not touched). Then, this method will strip colon, semicolon, blank, newline, carriage return, tab and minus characters from the front and back of labels, as well as convert to lower case for comparison. The 'label' in-parameter is also treated this way (but not multi-language parsed). A sequential search is then made, and the first field found to match is returned.

GetFromField(SoField)

Get a UDefFieldRow from the field the user-defined value is stored in.

Declaration
public UDefFieldRow GetFromField(SoField field)
Parameters
Type Name Description
SoField field

Information about the field

Returns
Type Description
UDefFieldRow

Row holding the definition of the field. 'null' (vb 'Nothing') is returned if there are no rows defined for this field. This would mean that this field does not hold a value for a user-defined field.

GetFromField(FieldInfo)

Get a UDefFieldRow from the field the user-defined value is stored in.

Declaration
public UDefFieldRow GetFromField(FieldInfo fieldInfo)
Parameters
Type Name Description
FieldInfo fieldInfo

Information about the field

Returns
Type Description
UDefFieldRow

Row holding the definition of the field. 'null' (vb 'Nothing') is returned if there are no rows defined for this field. This would mean that this field does not hold a value for a user-defined field.

GetFromField(Int32)

Get a UDefFieldRow from the field the user-defined value is stored in.

Declaration
public UDefFieldRow GetFromField(int fieldNumber)
Parameters
Type Name Description
Int32 fieldNumber

Information about the field

Returns
Type Description
UDefFieldRow

Row holding the definition of the field. 'null' (vb 'Nothing') is returned if there are no rows defined for this field. This would mean that this field does not hold a value for a user-defined field.

GetFromFieldLabel(String, UDefType)

Get a UDefFieldRow based on its label.

Declaration
public UDefFieldRow GetFromFieldLabel(string fieldlabel, UDefType type)
Parameters
Type Name Description
String fieldlabel

Label is

UDefType type
Returns
Type Description
UDefFieldRow

Row with the matching progid. 'null' (vb 'Nothing') is returned if there are no rows matching.

Remarks

The label match is fuzzy and not-exact, unlike a prog-id. Leading and trailing spaces are removed, as is trailing punctuation (":" and "."). Multi-language strings (i.e. US:"foo";NO:"bar") are parsed according to the current ui-culture before being matched.

GetFromId(Int32)

Get a UDefFieldRow from its primary key.

Declaration
public UDefFieldRow GetFromId(int id)
Parameters
Type Name Description
Int32 id

Primary key of the row.

Returns
Type Description
UDefFieldRow

Row with the primary key. 'null' (vb 'Nothing') is returned if there are no rows with this primary key.

GetFromProgId(String, UDefType)

Get a UDefFieldRow from its progid

Declaration
public UDefFieldRow GetFromProgId(string progId, UDefType type)
Parameters
Type Name Description
String progId

ProgId is composed of an identifier and udefidentity; '[identifier]:[udefIdentity]' Note that a colon is generally used as the separator, and not a dot; this is because the web client (and other applications) tend to use the dot as an indirection operator, like C# does.

UDefType type
Returns
Type Description
UDefFieldRow

Row with the matching progid. 'null' (vb 'Nothing') is returned if there are no rows matching.

GetFromType(UDefType)

Get a UDefFieldRow collection of definitions for a given udef type

Declaration
public UDefFieldRows GetFromType(UDefType type)
Parameters
Type Name Description
UDefType type

Udef type

Returns
Type Description
UDefFieldRows

Field definitions; the collection might be empty if there are no fields defined

GetFromUdefIdentity(Int32, UDefType)

Get a UDefFieldRow from its udefIdentity.

Declaration
public UDefFieldRow GetFromUdefIdentity(int udefIdentity, UDefType type)
Parameters
Type Name Description
Int32 udefIdentity
UDefType type
Returns
Type Description
UDefFieldRow

Row with the matching udefIdentity and type. 'null' (vb 'Nothing') is returned if there are no rows matching.

GetFromUDListDefinitionId(Int32)

Declaration
public UDefFieldRows GetFromUDListDefinitionId(int udListDefinitionId)
Parameters
Type Name Description
Int32 udListDefinitionId
Returns
Type Description
UDefFieldRows

GetLineNo(Int32)

Line number could need some recalculation.

Declaration
protected virtual int GetLineNo(int lineNo)
Parameters
Type Name Description
Int32 lineNo
Returns
Type Description
Int32

GetListName(UDefFieldRow)

Get the name of the MDO list associate with the given udef field. An empty string is returned if the field is not a list field.

Declaration
public static string GetListName(UDefFieldRow definition)
Parameters
Type Name Description
UDefFieldRow definition

User-defined field to get list name for

Returns
Type Description
String
Remarks

The list associated with a udef field is generally given by the ListTableId property of the definition. However, there is some special treatment:

GetPageOneFieldsFromType(UDefType)

Get a list of page one fields for given Udef type and current user group. The list may be empty if no fields have been defined. null will be returned if the Udef type is not supported for page one (Appointment, Document).

Declaration
public IEnumerable<UDefFieldCacheBase.PageOneFieldInfo> GetPageOneFieldsFromType(UDefType type)
Parameters
Type Name Description
UDefType type

Udef type

Returns
Type Description
IEnumerable<UDefFieldCacheBase.PageOneFieldInfo>

List of UDefFieldCacheBase.PageOneFieldInfo elements containing user-defined field definitions and line number (1-based)

GetPageOneFieldsFromType(UDefType, Int32)

Get a list of page one fields for given Udef type and user group. The list may be empty if no fields have been defined. null will be returned if the Udef type is not supported for page one (Appointment, Document).

Declaration
public IEnumerable<UDefFieldCacheBase.PageOneFieldInfo> GetPageOneFieldsFromType(UDefType type, int userGroupId)
Parameters
Type Name Description
UDefType type

Udef type

Int32 userGroupId

User group to get for

Returns
Type Description
IEnumerable<UDefFieldCacheBase.PageOneFieldInfo>

List of UDefFieldCacheBase.PageOneFieldInfo elements containing user-defined field definitions and line number (1-based)

GetVersions()

Get the current udef version array. Override to get either the Admin version or some specific set of versions

Declaration
protected virtual Dictionary<UDefType, int> GetVersions()
Returns
Type Description
Dictionary<UDefType, Int32>

IsPageOneMDO(UDefType)

Declaration
protected virtual bool IsPageOneMDO(UDefType udefType)
Parameters
Type Name Description
UDefType udefType
Returns
Type Description
Boolean

LoadOnDemand()

Declaration
protected void LoadOnDemand()

OnLoad()

Declaration
protected override void OnLoad()
Overrides
CacheBaseV2.OnLoad()

Implements

IFlushableV2
System.IDisposable

Extension Methods

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