Show / Hide Table of Contents

Class PreferenceLineItemProvider

MDO Provider for preferences that have a list of possible values in the database

Inheritance
object
LiteralsOnlyBase
PreferenceLineItemProvider
Implements
ISoListProvider
ISoList
Inherited Members
LiteralsOnlyBase.AddRawRootEnum<TEnum>(TEnum, string, bool)
LiteralsOnlyBase.ConstructAsync(string, string, int[], bool, string, bool, CancellationToken)
LiteralsOnlyBase.GetHistoryItemsAsync(CancellationToken)
LiteralsOnlyBase.ClearHistoryItems()
LiteralsOnlyBase.GetRootItemsAsync(CancellationToken)
LiteralsOnlyBase.GetHeadingItemsAsync(CancellationToken)
LiteralsOnlyBase.ListName
LiteralsOnlyBase.ExtraInfo
LiteralsOnlyBase.SearchValue
LiteralsOnlyBase.ForceFlatList
LiteralsOnlyBase.RawRootItems
LiteralsOnlyBase.RawHeadingItems
LiteralsOnlyBase.RawHistoryItems
LiteralsOnlyBase.HistoryIds
LiteralsOnlyBase.OnlyReadHistory
LiteralsOnlyBase.HistoryInfo
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.CRM.Lists
Assembly: SoDataBase.BusinessLogic.dll
Syntax
[MDOProviderPlugin("PreferenceLineItem")]
[MDOAdditionalInfoSeparator("|")]
[MDOAdditionalInfo("Preference section | preference key", "Functions|DisableContactDogEar")]
public class PreferenceLineItemProvider : LiteralsOnlyBase, ISoListProvider, ISoList
Remarks

Some preferences have a set of possible values that does not correspond to any existing list. In such cases, rows in the prefdescline table are used to create a list. This provider will take an additionalInfo of the form section|key and return the list of possible values. If the key or section does not exist or do not have such a list of possible values, an empty list is returned.

Consider using the CreateAdditionalInfo(string, string) method to avoid coding formatting dependencies. Use the UserPreferenceStrings class to avoid (mis)coding preference section and key names as strings.

The actual preference value to set, corresponding to each choice, is in the extraInfo of each list item.

Constructors

PreferenceLineItemProvider()

MDO Provider for preferences that have a list of possible values in the database

Declaration
public PreferenceLineItemProvider()
Remarks

Some preferences have a set of possible values that does not correspond to any existing list. In such cases, rows in the prefdescline table are used to create a list. This provider will take an additionalInfo of the form section|key and return the list of possible values. If the key or section does not exist or do not have such a list of possible values, an empty list is returned.

Consider using the CreateAdditionalInfo(string, string) method to avoid coding formatting dependencies. Use the UserPreferenceStrings class to avoid (mis)coding preference section and key names as strings.

The actual preference value to set, corresponding to each choice, is in the extraInfo of each list item.

Fields

ProviderName

MDO Provider for preferences that have a list of possible values in the database

Declaration
public const string ProviderName = "PreferenceLineItem"
Field Value
Type Description
string
Remarks

Some preferences have a set of possible values that does not correspond to any existing list. In such cases, rows in the prefdescline table are used to create a list. This provider will take an additionalInfo of the form section|key and return the list of possible values. If the key or section does not exist or do not have such a list of possible values, an empty list is returned.

Consider using the CreateAdditionalInfo(string, string) method to avoid coding formatting dependencies. Use the UserPreferenceStrings class to avoid (mis)coding preference section and key names as strings.

The actual preference value to set, corresponding to each choice, is in the extraInfo of each list item.

SectionKeyDelimiter

Delimiter to use between section name and key name in the additionalInfo parameter. Consider using the CreateAdditionalInfo(string, string) method to avoid coding dependencies.

Declaration
public const string SectionKeyDelimiter = "|"
Field Value
Type Description
string
Remarks

Some preferences have a set of possible values that does not correspond to any existing list. In such cases, rows in the prefdescline table are used to create a list. This provider will take an additionalInfo of the form section|key and return the list of possible values. If the key or section does not exist or do not have such a list of possible values, an empty list is returned.

Consider using the CreateAdditionalInfo(string, string) method to avoid coding formatting dependencies. Use the UserPreferenceStrings class to avoid (mis)coding preference section and key names as strings.

The actual preference value to set, corresponding to each choice, is in the extraInfo of each list item.

Methods

AddItemsAsync(CancellationToken)

Subclass contract: use the RawRootItems and RawHeadingItems properties to add items to your literals-only list. The base class will then perform any search or flattening required.

Declaration
protected override Task AddItemsAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task
Overrides
LiteralsOnlyBase.AddItemsAsync(CancellationToken)
Remarks

Lists that only contain literals can be either flat or grouped. If you create a grouped list and the caller specifies a forceFlatList attribute, the base class will do the flattening for you.

Examples

This example shows a typical implementation of a literal list, in this case the date interval list from the Filter dialog:

[MDOProviderPlugin( "FilterFutureDate" )]
public class FilterFutureDateList : LiteralsOnlyBase
{
	protected override void AddItems()
	{
		RawRootItems.Add( new SoListItem( 1, "[SR_DATE_RANGE_3MONTHS]", string.Empty, string.Empty ) );
		RawRootItems.Add( new SoListItem( 2, "[SR_DATE_RANGE_4MONTHS]", string.Empty, string.Empty ) );
		RawRootItems.Add( new SoListItem( 3, "[SR_DATE_RANGE_6MONTHS]", string.Empty, string.Empty ) );
		RawRootItems.Add( new SoListItem( 4, "[SR_DATE_RANGE_1YEAR]", string.Empty, string.Empty ) );
		RawRootItems.Add( new SoListItem( 5, "[SR_DATE_RANGE_2YEAR]", string.Empty, string.Empty ) );
	}
}

Note that using a search in this case yields unexpected results. The search is performed on the raw items, which contains resource tags - and that is not what you actually want to search against. So resources + search do not go together.

CreateAdditionalInfo(string, string)

Create a correctly formatted AdditionalInfo parameter based on a section and key

Declaration
public static string CreateAdditionalInfo(string section, string key)
Parameters
Type Name Description
string section

Desired preference section

string key

Desired preference key

Returns
Type Description
string

String suitable as the additionalInfo parameter

Remarks

Some preferences have a set of possible values that does not correspond to any existing list. In such cases, rows in the prefdescline table are used to create a list. This provider will take an additionalInfo of the form section|key and return the list of possible values. If the key or section does not exist or do not have such a list of possible values, an empty list is returned.

Consider using the CreateAdditionalInfo(string, string) method to avoid coding formatting dependencies. Use the UserPreferenceStrings class to avoid (mis)coding preference section and key names as strings.

The actual preference value to set, corresponding to each choice, is in the extraInfo of each list item.

Implements

ISoListProvider
ISoList

Extension Methods

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