Class ViewStateAgent
Facade for the ViewState Agent User interface view state, history, currentXXX values
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
public class ViewStateAgent : AgentBase<IViewStateAgent>, IDisposable, 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...
}
}
Constructors
ViewStateAgent()
Facade for the ViewState Agent User interface view state, history, currentXXX values
Declaration
public ViewStateAgent()
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
DeleteHistory(String, Int32)
Deletes the history element
Declaration
public void DeleteHistory(string historyName, int id)
Parameters
Type | Name | Description |
---|---|---|
String | historyName | Name of the history list, e.g. contact, project |
Int32 | id | Id of the history element, e.g. Contact id |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
GetCurrent(String)
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
public History GetCurrent(string historyName)
Parameters
Type | Name | Description |
---|---|---|
String | historyName | Name of the history list, e.g. contact, project |
Returns
Type | Description |
---|---|
History | The current (most recent) history item |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
GetHistories()
Returns all history items that belong to the currently logged in user
Declaration
public History[] GetHistories()
Returns
Type | Description |
---|---|
History[] | Array of History items |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
GetHistoriesByName(String)
Returns the named history list that belong to the currently logged in user
Declaration
public History[] GetHistoriesByName(string historyName)
Parameters
Type | Name | Description |
---|---|---|
String | historyName | Name of the history list |
Returns
Type | Description |
---|---|
History[] | Array of History items |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
GetHistoriesByNames(String[])
Returns the named history lists that belong to the currently logged in user
Declaration
public History[] GetHistoriesByNames(string[] historyNames)
Parameters
Type | Name | Description |
---|---|---|
String[] | historyNames | String array of list names |
Returns
Type | Description |
---|---|
History[] | Array of History items |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
GetHistoriesByNamesAndIds(HistoryRequest[])
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
public History[] GetHistoriesByNamesAndIds(HistoryRequest[] requests)
Parameters
Type | Name | Description |
---|---|---|
HistoryRequest[] | requests | Array of request objects that define what entities we are requesting history information for |
Returns
Type | Description |
---|---|
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. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
GetHistory(Int32)
Gets a History object.
Declaration
public History GetHistory(int historyId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | historyId | The identifier of the History object |
Returns
Type | Description |
---|---|
History | History |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
GetHistoryLengthPrefValue()
Get the logged on user's preferred history list length. Will return the system preference if no user preferences are available.
Declaration
public int GetHistoryLengthPrefValue()
Returns
Type | Description |
---|---|
Int32 | The history list lenght |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
GetLiveUiConfig()
Gets live UI configuration
Declaration
public LiveUiConfig GetLiveUiConfig()
Returns
Type | Description |
---|---|
LiveUiConfig | Live UI configuration containing the parameters needed for live UI functionality |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
GetNextCurrent(String, Int32)
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
public History GetNextCurrent(string historyName, int id)
Parameters
Type | Name | Description |
---|---|---|
String | historyName | Name of the history list, e.g. contact, project |
Int32 | id | Id of the history element, e.g. Contact id |
Returns
Type | Description |
---|---|
History | The current value. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
GetPreviousCurrent(String, Int32)
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
public History GetPreviousCurrent(string historyName, int id)
Parameters
Type | Name | Description |
---|---|---|
String | historyName | Name of the history list, e.g. contact, project |
Int32 | id | Id of the history element, e.g. Contact id |
Returns
Type | Description |
---|---|
History | The current value. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
PublishAndRetrieveUiEvents(Int32, UiEvent[], MetricPair[])
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
public UiEvent[] PublishAndRetrieveUiEvents(int latestKnownEventId, UiEvent[] publishEvents, MetricPair[] metrics)
Parameters
Type | Name | Description |
---|---|---|
Int32 | 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 |
Returns
Type | Description |
---|---|
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 |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
SaveCurrent(History)
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
public History SaveCurrent(History current)
Parameters
Type | Name | Description |
---|---|---|
History | current | The new current history element. |
Returns
Type | Description |
---|---|
History | The current (most recent) history item |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
SaveCurrents(History[])
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
public History[] SaveCurrents(History[] currents)
Parameters
Type | Name | Description |
---|---|---|
History[] | currents | Array of new history items to save. |
Returns
Type | Description |
---|---|
History[] | Array of the saved History items |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
SaveHistories(String, History[])
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
public History[] SaveHistories(string historyName, History[] history)
Parameters
Type | Name | Description |
---|---|---|
String | historyName | |
History[] | history | Array of new history items to save. |
Returns
Type | Description |
---|---|
History[] | Array of the saved History items |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}
SetHistoryLengthPrefValue(Int32)
Set the logged on user's preferred history list length.
Declaration
public void SetHistoryLengthPrefValue(int length)
Parameters
Type | Name | Description |
---|---|---|
Int32 | length | The new history list lenght |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ViewStateAgent agent = new ViewStateAgent())
{
// call methods on agent here...
}
}