Show / Hide Table of Contents

Class InterestHelper

Base class for contact and person interest helpers. The helpers provide functionality that combines MDO list and 'what is actually selected', i.e., they combine entity subcollections with mdo lists.

Inheritance
object
MDOProviderBase
InterestHelper
ContactInterestHelper
PersonInterestHelper
Implements
ISoListProvider
ISoList
IEnumerable<ISoListItem>
IEnumerable
Inherited Members
MDOProviderBase._historyIds
MDOProviderBase._searchValue
MDOProviderBase._forceFlatList
MDOProviderBase._rootCollection
MDOProviderBase._historyCollection
MDOProviderBase._headingCollection
MDOProviderBase._declaredListName
MDOProviderBase._tableRows
MDOProviderBase._nodeType
MDOProviderBase._listName
MDOProviderBase._tableName
MDOProviderBase._tableListInfo
MDOProviderBase._listInfo
MDOProviderBase.ConstructAsync(string, string, int[], bool, string, bool, CancellationToken)
MDOProviderBase.FillListAsync(CancellationToken)
MDOProviderBase.GetHistoryCollectionAsync(CancellationToken)
MDOProviderBase.ReadSimpleListAsync(CancellationToken)
MDOProviderBase.GetSimpleListQueryAsync(CancellationToken)
MDOProviderBase.AddSimpleListOrderByAsync(ListTableRows.CustomSearch, CancellationToken)
MDOProviderBase.GetItemsAndHeadingsQueryAsync(bool, CancellationToken, params int[])
MDOProviderBase.AddGroupLinkJoin(int[], ListTableRows.CustomSearch)
MDOProviderBase.GetItemType(ListTableRow)
MDOProviderBase.GetHeadingType(ListTableRow)
MDOProviderBase.GetItemIconHint(ListTableRow)
MDOProviderBase.GetHeadingIconHint(ListTableRow)
MDOProviderBase.GetItemId(ListTableRow)
MDOProviderBase.GetItemName(ListTableRow)
MDOProviderBase.AcceptHistoryRow(ListTableRow)
MDOProviderBase.GetHistoryIconHint(ListTableRow)
MDOProviderBase.GetItemTooltip(ListTableRow)
MDOProviderBase.GetItemRank(ListTableRow)
MDOProviderBase.GetItemDeleted(ListTableRow)
MDOProviderBase.GetItemColor(ListTableRow)
MDOProviderBase.GetItemStyleHint(ListTableRow)
MDOProviderBase.GetItemExtraInfo(ListTableRow)
MDOProviderBase.GetGroupingAllowedForListAsync(CancellationToken)
MDOProviderBase.OnAddRootElementToCollection(SoListItem)
MDOProviderBase.OnAddSubItemToCollection(SoListItem, List<ISoListItem>)
MDOProviderBase.OnAddHeadingElementToCollection(SoListHeading)
MDOProviderBase.OnAddHistoryElementToCollection(SoListItem)
MDOProviderBase.GetListLowerLimitAsync(CancellationToken)
MDOProviderBase.GetPreferredSortOrderAsync(CancellationToken)
MDOProviderBase.ResortFlattenedListAsync(CancellationToken)
MDOProviderBase.GetHistoryItemsAsync(CancellationToken)
MDOProviderBase.ClearHistoryItems()
MDOProviderBase.GetRootItemsAsync(CancellationToken)
MDOProviderBase.GetHeadingItemsAsync(CancellationToken)
MDOProviderBase.HistoryInfo
MDOProviderBase.IncludeDeletedItems
MDOProviderBase.InhibitResortOnFlattening
MDOProviderBase.IsFinalListFlat
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.CRM.Entities
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public abstract class InterestHelper : MDOProviderBase, ISoListProvider, ISoList, IEnumerable<ISoListItem>, IEnumerable
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

Constructors

InterestHelper(TableRowsBase, string, int)

Default constructor.

Declaration
protected InterestHelper(TableRowsBase selectedInterests, string tableName, int parentEntityId)
Parameters
Type Name Description
TableRowsBase selectedInterests

List of the currently selected interests. This can either be a class of type ContIntRows or PersIntRows

string tableName

Name of the table holding the definition of the interests

int parentEntityId
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

Fields

_parentEntityId

Base class for contact and person interest helpers. The helpers provide functionality that combines MDO list and 'what is actually selected', i.e., they combine entity subcollections with mdo lists.

Declaration
protected int _parentEntityId
Field Value
Type Description
int
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

_selectedHeadingCollection

Base class for contact and person interest helpers. The helpers provide functionality that combines MDO list and 'what is actually selected', i.e., they combine entity subcollections with mdo lists.

Declaration
protected List<ISoListHeading> _selectedHeadingCollection
Field Value
Type Description
List<ISoListHeading>
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

_selectedInterestIds

Base class for contact and person interest helpers. The helpers provide functionality that combines MDO list and 'what is actually selected', i.e., they combine entity subcollections with mdo lists.

Declaration
protected Dictionary<int, TableRowBase> _selectedInterestIds
Field Value
Type Description
Dictionary<int, TableRowBase>
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

_selectedInterests

Base class for contact and person interest helpers. The helpers provide functionality that combines MDO list and 'what is actually selected', i.e., they combine entity subcollections with mdo lists.

Declaration
protected TableRowsBase _selectedInterests
Field Value
Type Description
TableRowsBase
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

_selectedRootCollection

Base class for contact and person interest helpers. The helpers provide functionality that combines MDO list and 'what is actually selected', i.e., they combine entity subcollections with mdo lists.

Declaration
protected List<ISoListItem> _selectedRootCollection
Field Value
Type Description
List<ISoListItem>
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

Properties

SelectedHeadingItems

Get the list of heading items that are currently selected, i.e., have link rows to the parent entity.

Declaration
public List<ISoListHeading> SelectedHeadingItems { get; }
Property Value
Type Description
List<ISoListHeading>
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

SelectedRootItems

Get the list of root items that are currently selected, i.e., have link rows to the parent entity.

Declaration
public List<ISoListItem> SelectedRootItems { get; }
Property Value
Type Description
List<ISoListItem>
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

Methods

BuildMdoCollectionsAsync(CancellationToken)

Convert rows object to ISoList collections. Fetching of the MDO list runs in the base class, here we instantiate InterestMDOListItem objects instead of the more generic ones, so that we can add the extra information (selected & date).

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

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

CreateInterest(int)

Create a new link row for the given interest, using the protected _parentEntityId as the entity id. ALSO: Add to the _selectedInterests collection, since TableRowsBase does not have a public Add operator.

Declaration
protected abstract TableRowBase CreateInterest(int interestId)
Parameters
Type Name Description
int interestId

Interest id to link to

Returns
Type Description
TableRowBase

New row, which has already been added to the entity's link table collections

Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

GetInterestDate(TableRowBase)

Get the interest date from the link row (which must be castable to the correct type)

Declaration
protected abstract DateTime GetInterestDate(TableRowBase row)
Parameters
Type Name Description
TableRowBase row

Row, castable to the type needed by the subclass

Returns
Type Description
DateTime

Last changed date extracted from the row

Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

GetInterestId(TableRowBase)

Get the interest id from the link row (which must be castable to the correct type)

Declaration
protected abstract int GetInterestId(TableRowBase row)
Parameters
Type Name Description
TableRowBase row

Row, castable to the type needed by the subclass

Returns
Type Description
int

Interest ID the row links to

Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

GetItemsAndHeadingsQueryAsync(CancellationToken)

Create a query for for reading the items and headings of the interest list, including any currently selected items (regardless of filtering; this is implemented in the base class). Searching is not supported.

Declaration
protected override Task<ListTableRows.CustomSearch> GetItemsAndHeadingsQueryAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<ListTableRows.CustomSearch>

Query for reading the items and headdings of a list.

Overrides
MDOProviderBase.GetItemsAndHeadingsQueryAsync(CancellationToken)
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

IsItemSelected(int)

Base class for contact and person interest helpers. The helpers provide functionality that combines MDO list and 'what is actually selected', i.e., they combine entity subcollections with mdo lists.

Declaration
public bool IsItemSelected(int interestId)
Parameters
Type Name Description
int interestId
Returns
Type Description
bool
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

ReadItemsAndHeadingsAsync(CancellationToken)

Read all mdo items with heading information

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

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

RefreshAsync(CancellationToken)

Base class for contact and person interest helpers. The helpers provide functionality that combines MDO list and 'what is actually selected', i.e., they combine entity subcollections with mdo lists.

Declaration
public Task RefreshAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

SetItemSelectionAsync(ISelectableListItem, CancellationToken)

Extract the 'Selected' property from the elements, and synchronize the entity's link table with the present status. Deletions are performed immediately, additions need to be saved through entity.Save() (so always do an entity.Save() anyway!)

Declaration
public Task SetItemSelectionAsync(ISelectableListItem item, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ISelectableListItem item

Single MDO list item

CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

SetItemSelectionAsync(ISoList, CancellationToken)

Extract the 'Selected' property from all elements, and synchronize the entity's link table with the present status. Deletions are performed immediately, additions need to be saved through entity.Save() (so always do an entity.Save() anyway!)

Declaration
public Task SetItemSelectionAsync(ISoList list, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ISoList list

Complete MDO list, with root, heading and history items. History items are IGNORED!

CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

SetItemSelectionAsync(List<ISelectableListItem>, CancellationToken)

Extract the 'Selected' property from all elements, and synchronize the entity's link table with the present status. Deletions are performed immediately, additions need to be saved through entity.Save() (so always do an entity.Save() anyway!)

Declaration
public Task SetItemSelectionAsync(List<ISelectableListItem> items, CancellationToken cancellationToken = default)
Parameters
Type Name Description
List<ISelectableListItem> items

List of MDO list items

CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

SetItemSelectionAsync(List<ISoListItem>, CancellationToken)

Extract the 'Selected' property from all elements, and synchronize the entity's link table with the present status. Deletions are performed immediately, additions need to be saved through entity.Save() (so always do an entity.Save() anyway!)

Declaration
public Task SetItemSelectionAsync(List<ISoListItem> selectableItems, CancellationToken cancellationToken = default)
Parameters
Type Name Description
List<ISoListItem> selectableItems

List of MDO list items. Items not of (a subtype of) ISelectableListItem are quietly ignored and do no harm.

CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

SetItemSelectionAsync(int, bool, CancellationToken)

Synchronize the entity's link table with the present status for the given interest. Deletions are performed immediately, additions need to be saved through entity.Save() (so always do an entity.Save() anyway!)

Declaration
public Task SetItemSelectionAsync(int interestId, bool isSelected, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int interestId

ID of interest to add or remove

bool isSelected

New status

CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

Events

OnActiveInterestsChanged

Subscribe or unsubscribe to the event raised whenever the number of active interests are changed.

Declaration
public event ActiveInterestsChanged OnActiveInterestsChanged
Event Type
Type Description
ActiveInterestsChanged
Remarks

The MDO list is available in two flavours - as the standard list, with Root and Heading items; and as a subset, containing only those rows that have corresponding link rows to the parent entity.

In both cases, the actual items in the lists are of type ISelectableListItem, an interface that inherits from ISoListItem but adds two more properties: A settable bool Selected, and a read-only DateTime LastChanged (which is automatically maintained).

The various SetItemSelection collections will accept a whole ISoList or various sub-objects of it, extract the Selected flags and update the entity data accordingly. Note that items that lose their Selected status cause immediate deletions, while new Selected items are not stored to the database until entity.Save() is called. Interests not in the incoming lists will not be touched.

Note that you cannot add new interest items through this class, only link existing interest items to a particular contact or person. Add new interests is an ordinary list-editing task, to be done through SoAdmin.

Implements

ISoListProvider
ISoList
IEnumerable<T>
IEnumerable

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