Interface IViewStateAgent
Interface for the ViewState Agent User interface view state, history, currentXXX values
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("ViewState Agent", "Interface for the ViewState Agent. User interface view state, history, currentXXX values")]
public interface IViewStateAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
Methods
DeleteHistoryAsync(string, int, CancellationToken)
Deletes the history element
Declaration
Task DeleteHistoryAsync(string historyName, int id, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | historyName | Name of the history list, e.g. contact, project |
int | id | Id of the history element, e.g. Contact id |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
GetCurrentAsync(string, CancellationToken)
Get the current (most recent) value of the history list. This is the item with rank = 1. If no item exists a default value is returned. This is usually the first item in the table representing the history list.
Declaration
Task<History> GetCurrentAsync(string historyName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | historyName | Name of the history list, e.g. contact, project |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<History> | The current (most recent) history item |
GetHistoriesAsync(CancellationToken)
Returns all history items that belong to the currently logged in user
Declaration
Task<History[]> GetHistoriesAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<History[]> | Array of History items |
GetHistoriesByNameAsync(string, CancellationToken)
Returns the named history list that belong to the currently logged in user
Declaration
Task<History[]> GetHistoriesByNameAsync(string historyName, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | historyName | Name of the history list |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<History[]> | Array of History items |
GetHistoriesByNamesAndIdsAsync(HistoryRequest[], CancellationToken)
Returns history data for the named entities and the given ids - which may not directly correspond to the current history records in the database.<para/>Use this method if you know exactly which items you need, regardless of whether they are in the current history or not.<para/>The history in the database is not changed or even looked at by this method.
Declaration
Task<History[]> GetHistoriesByNamesAndIdsAsync(HistoryRequest[] requests, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
HistoryRequest[] | requests | Array of request objects that define what entities we are requesting history information for |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<History[]> | On history item for each history name/id pair specified, in exactly the same order as specified.<para/>If a specified item cannot be found in the database, its Id will be 0 and its name will be blank in the return array. |
GetHistoriesByNamesAsync(string[], CancellationToken)
Returns the named history lists that belong to the currently logged in user
Declaration
Task<History[]> GetHistoriesByNamesAsync(string[] historyNames, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string[] | historyNames | String array of list names |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<History[]> | Array of History items |
GetHistoryAsync(int, CancellationToken)
Gets a History object.
Declaration
Task<History> GetHistoryAsync(int historyId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | historyId | The identifier of the History object |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<History> | History |
GetHistoryLengthPrefValueAsync(CancellationToken)
Get the logged on user's preferred history list length. Will return the system preference if no user preferences are available.
Declaration
Task<int> GetHistoryLengthPrefValueAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<int> | The history list lenght |
GetLiveUiConfigAsync(CancellationToken)
Gets live UI configuration
Declaration
Task<LiveUiConfig> GetLiveUiConfigAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<LiveUiConfig> | Live UI configuration containing the parameters needed for live UI functionality |
GetNextCurrentAsync(string, int, CancellationToken)
Returns the next current item. If no item exists a default value is returned. This is usually the first item in the table representing the history list.
Declaration
Task<History> GetNextCurrentAsync(string historyName, int id, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | historyName | Name of the history list, e.g. contact, project |
int | id | Id of the history element, e.g. Contact id |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<History> | The current value. |
GetPreviousCurrentAsync(string, int, CancellationToken)
Returns the previous current item. If no item exists a default value is returned. This is usually the first item in the table representing the history list.
Declaration
Task<History> GetPreviousCurrentAsync(string historyName, int id, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | historyName | Name of the history list, e.g. contact, project |
int | id | Id of the history element, e.g. Contact id |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<History> | The current value. |
PublishAndRetrieveUiEventsAsync(int, UiEvent[], MetricPair[], CancellationToken)
Publish zero or more events, and return any new events since the given event id. The initial implementation is in-memory only; applies solely to the front-end web server; and anything older than 20 minutes is discarded
Declaration
Task<UiEvent[]> PublishAndRetrieveUiEventsAsync(int latestKnownEventId, UiEvent[] publishEvents, MetricPair[] metrics, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | latestKnownEventId | The last event ID that this client knows about. The return value will be any events occurring /after/ that point, numbered by the server. Clients need to keep track themselves of this number between calls |
UiEvent[] | publishEvents | Array of events to publish. This can be empty if the client only wants to retrieve information |
MetricPair[] | metrics | Optional statistical and performance metrics collected by the frontend. Can be null or empty. Metrics are sum-accumulated and reported once a minute; please do not report the same logical event twice |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<UiEvent[]> | Array of events since the given event ID; within the time span kept by the event mechanism. Event/primarykey combinations are not guaranteed to be unique, and events in the PublishEvents parameter are echoed back to the client |
SaveCurrentAsync(History, CancellationToken)
Saving the current history item. This history item is saved with Rank = 1, and all the remaining elements rank values are shifted one down. The list is maintained with the max lenght of the History list length preference.
Declaration
Task<History> SaveCurrentAsync(History current, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
History | current | The new current history element. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<History> | The current (most recent) history item |
SaveCurrentsAsync(History[], CancellationToken)
Saves the history elements as the current value for their respective lists. If more than one item is submitted for the same list, they are added sequently, meaning that the last one is the most current.
Declaration
Task<History[]> SaveCurrentsAsync(History[] currents, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
History[] | currents | Array of new history items to save. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<History[]> | Array of the saved History items |
SaveHistoriesAsync(string, History[], CancellationToken)
Replaces the existing history-list for the currently logged in user. All elements must belong to the same history list. If not they are ignored.
Declaration
Task<History[]> SaveHistoriesAsync(string historyName, History[] history, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | historyName | |
History[] | history | Array of new history items to save. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<History[]> | Array of the saved History items |
SetHistoryLengthPrefValueAsync(int, CancellationToken)
Set the logged on user's preferred history list length.
Declaration
Task SetHistoryLengthPrefValueAsync(int length, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | length | The new history list lenght |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |