Class RolesListProvider
RoleListProvider creates a MDO list of roles in the database. Default list are the employee roles. Use ExtraInfo to get other RoleTypes. ExtraInfo : "0" Default, to get employee roles ExtraInfo : "1" to get external users roles ExtraInfo : "2" to get anonymous roles. ExtraInfo : "3" to get system user roles.
Inherited Members
Namespace: SuperOffice.CRM.Lists
Assembly: SoDataBase.BusinessLogic.dll
Syntax
[MDOProviderPlugin("Roles")]
[MDOAdditionalInfoSeparator(";")]
[MDOAdditionalInfo("Role type (0=employees, 1=ext users, 2=anon, 3=system)", "0")]
public class RolesListProvider : AnyTableListProviderBase, ISoListProvider, ISoList
Constructors
RolesListProvider()
Default constructor
Declaration
public RolesListProvider()
Fields
ProviderName
The name of the provider.
Declaration
public const string ProviderName = "Roles"
Field Value
| Type | Description |
|---|---|
| string |
Properties
TableInfo
The table info of the query. This is used by subclasses (e.g. this class) when restricting history data.
Declaration
protected override TableInfo TableInfo { get; }
Property Value
| Type | Description |
|---|---|
| TableInfo |
Overrides
Methods
ExecuteReaderAsync(SoCommand, CancellationToken)
Overridden here to fetch all (500) roles. Mainly or only used in Admin, so need all rows, not only the amount specified in global preference MaxListSize
Declaration
protected override Task<SoDataReader> ExecuteReaderAsync(SoCommand cmd, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| SoCommand | cmd | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<SoDataReader> |
Overrides
GetMainQueryAsync(CancellationToken)
Get the query to retrieve roles in the database.
Declaration
protected override Task<Select> GetMainQueryAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Select> |
Overrides
InitAsync(CancellationToken)
Initiate the provider after the Construct method is called.
Declaration
protected override Task InitAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
Overrides
OnPreGetRootItemsAsync(List<ISoListItem>)
Event raised by GetRootItems after values are fetched from the database. Adding option for empty role at the beginning of list
Declaration
protected override Task OnPreGetRootItemsAsync(List<ISoListItem> items)
Parameters
| Type | Name | Description |
|---|---|---|
| List<ISoListItem> | items | List of items returned from GetRootItems. |
Returns
| Type | Description |
|---|---|
| Task |
Overrides
OnRead(SoDataReader, short)
Raised every time a new row has been read from the database.
The implementation should read tthe results from the reader
and populate an object implementing ISoListItem.
Declaration
protected override ISoListItem OnRead(SoDataReader reader, short lastRank)
Parameters
| Type | Name | Description |
|---|---|---|
| SoDataReader | reader | Reader to reaf from. |
| short | lastRank | Value of the last rank populated. |
Returns
| Type | Description |
|---|---|
| ISoListItem | Data read from the reader. |
Overrides
SetSearchRestrictionAsync(Select, string)
If the input searchValue enables searching on the RoleTableInfo Name field.
Declaration
protected override Task SetSearchRestrictionAsync(Select sql, string searchValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Select | sql | The initial query |
| string | searchValue | This search value specifies the containing string of the field |
Returns
| Type | Description |
|---|---|
| Task |