Class ErpConnectionHandlerFacade
A facade for the WCF calls to the actual connector
Inheritance
ErpConnectionHandlerFacade
Assembly: SuperOffice.Services.Implementation.dll
Syntax
public class ErpConnectionHandlerFacade : ConnectionHandlerFacadeBase
Properties
ErpConnectorId
A facade for the WCF calls to the actual connector
Declaration
public int ErpConnectorId { get; }
Property Value
Methods
CreateActorAsync(ErpSyncActor, ErpActorType)
Creates a new actor and returns the actor from the connection as if looks after the create operation (e.g. with a new ErpKey and timestamp, etc)
Declaration
public override Task<ErpSyncActor> CreateActorAsync(ErpSyncActor act, ErpActorType actorType)
Parameters
Type |
Name |
Description |
ErpSyncActor |
act |
|
ErpActorType |
actorType |
|
Returns
Overrides
CreateConnectionAsync(int, Guid, Dictionary<string, string>)
Saves a new connection to a specified connector. NOTE: Does not save the connection row or the configuration data to the CRM database.
Declaration
public static Task<PluginResponseInfo> CreateConnectionAsync(int erpConnectorId, Guid connectionId, Dictionary<string, string> configData)
Parameters
Returns
Type |
Description |
Task<PluginResponseInfo> |
|
DeleteConnectionAsync(Guid)
Deletes a connection from the CRM database, and calls DeleteConnection on the connector
Declaration
public static Task<PluginResponseInfo> DeleteConnectionAsync(Guid connectionId)
Parameters
Type |
Name |
Description |
Guid |
connectionId |
|
Returns
Type |
Description |
Task<PluginResponseInfo> |
|
DeleteConnectionAsync(int)
Deletes a connection from the CRM database, and calls DeleteConnection on the connector
Declaration
public static Task<PluginResponseInfo> DeleteConnectionAsync(int erpConnectionId)
Parameters
Type |
Name |
Description |
int |
erpConnectionId |
|
Returns
Type |
Description |
Task<PluginResponseInfo> |
|
GetActorAsync(Guid, ErpActorType, string, string[])
Retrieves a specified actor from a connection, with a given set of fields
Declaration
public static Task<ErpSyncActor> GetActorAsync(Guid connectionId, ErpActorType actorType, string erpKey, string[] fieldKeys)
Parameters
Type |
Name |
Description |
Guid |
connectionId |
|
ErpActorType |
actorType |
|
string |
erpKey |
|
string[] |
fieldKeys |
|
Returns
GetActorAsync(int, ErpActorType, string, string[])
Retrieves a specified actor from a connection, with a given set of fields
Declaration
public static Task<ErpSyncActor> GetActorAsync(int erpConnectionId, ErpActorType actorType, string erpKey, string[] fieldKeys)
Parameters
Type |
Name |
Description |
int |
erpConnectionId |
|
ErpActorType |
actorType |
|
string |
erpKey |
|
string[] |
fieldKeys |
|
Returns
GetActorAsync(int, int, string[])
Retrieves a specified actor from a connection (based on the primary key from ErpInternalKey), with a given set of fields
Declaration
public static Task<ErpSyncActor> GetActorAsync(int erpConnectionId, int internalKeyId, string[] fieldKeys)
Parameters
Type |
Name |
Description |
int |
erpConnectionId |
|
int |
internalKeyId |
|
string[] |
fieldKeys |
|
Returns
GetActorsAsync(ErpActorType, string[])
Retrieves a specified set of actors.
Declaration
public override Task<ErpSyncActor[]> GetActorsAsync(ErpActorType actorType, string[] ErpKeys)
Parameters
Type |
Name |
Description |
ErpActorType |
actorType |
|
string[] |
ErpKeys |
|
Returns
Overrides
GetActorsAsync(ErpActorType, string[], string[])
Retrieves a specified set of actors from a connection with a specified set of fields
Declaration
public Task<ErpSyncActor[]> GetActorsAsync(ErpActorType actorType, string[] ErpKeys, string[] fieldKeys)
Parameters
Type |
Name |
Description |
ErpActorType |
actorType |
|
string[] |
ErpKeys |
|
string[] |
fieldKeys |
|
Returns
GetActorsMappedAsync(ErpActorType, string[])
Retrieves a specified set of actors. Will use the field mapping for the given actor type and connection.
Declaration
public Task<ErpSyncActor[]> GetActorsMappedAsync(ErpActorType actorType, string[] erpKeys)
Parameters
Type |
Name |
Description |
ErpActorType |
actorType |
|
string[] |
erpKeys |
|
Returns
GetConfigDataAsync()
A facade for the WCF calls to the actual connector
Declaration
protected override Task<FieldMetadataInfo[]> GetConfigDataAsync()
Returns
Type |
Description |
Task<FieldMetadataInfo[]> |
|
Overrides
GetConfigDataAsync(int, CancellationToken)
Retrieves a set of FieldMetadataInfo objects containing the fields needed to define a connection in a given connector.
Declaration
public static Task<FieldMetadataInfoArrayPluginResponse> GetConfigDataAsync(int connectorId, CancellationToken cancellationToken = default)
Parameters
Type |
Name |
Description |
int |
connectorId |
id which is mapped to a connection guid
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<FieldMetadataInfoArrayPluginResponse> |
Default value, field types, key names
|
GetConnectionIdAsync()
Get or set (set method is protected) the external connection ID for the connection handler. If set, it will use this to find its own internal ID (database key)
Declaration
public override Task<Guid> GetConnectionIdAsync()
Returns
Overrides
GetConnectionIdAsync(int, CancellationToken)
Map an ERP Connection to a GUID by looking in the database ErpConnection table.
Declaration
public static Task<Guid> GetConnectionIdAsync(int erpConnectionId, CancellationToken cancellationToken = default)
Parameters
Returns
Type |
Description |
Task<Guid> |
GUID that is used with the Sync web service.
|
GetErpConnectionIdAsync()
Get or set (set method is protected) the internal connection ID (database key) for the connection handler. If set, it will use this to find its own external ID
Declaration
public override Task<int> GetErpConnectionIdAsync()
Returns
Overrides
GetErpConnectionIdAsync(Guid, CancellationToken)
Map GUID to an ERP Connection by looking in the database ErpConnection table.
Declaration
public static Task<int> GetErpConnectionIdAsync(Guid connectionId, CancellationToken cancellationToken = default)
Parameters
Type |
Name |
Description |
Guid |
connectionId |
GUID that is used with the Sync web service
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<int> |
id for the corresponding connection. 0 if nothing is found
|
GetErpKey(int)
A facade for the WCF calls to the actual connector
Declaration
protected Task<string> GetErpKey(int internalKeyId)
Parameters
Type |
Name |
Description |
int |
internalKeyId |
|
Returns
GetExternalKeyRowAsync(int)
A facade for the WCF calls to the actual connector
Declaration
protected Task<ErpExternalKeyRow> GetExternalKeyRowAsync(int internalKeyId)
Parameters
Type |
Name |
Description |
int |
internalKeyId |
|
Returns
Type |
Description |
Task<ErpExternalKeyRow> |
|
GetExternalKeyRowAsync(string, ErpActorType)
A facade for the WCF calls to the actual connector
Declaration
protected Task<ErpExternalKeyRow> GetExternalKeyRowAsync(string erpKey, ErpActorType actorType)
Parameters
Type |
Name |
Description |
string |
erpKey |
|
ErpActorType |
actorType |
|
Returns
Type |
Description |
Task<ErpExternalKeyRow> |
|
GetFieldCacheAsync(CancellationToken)
A facade for the WCF calls to the actual connector
Declaration
public Task<ErpFieldCache> GetFieldCacheAsync(CancellationToken cancellationToken = default)
Parameters
Returns
GetFieldsByInternalKeyIdAsync(int)
Retrieves all fields that are mapped for a given actor (as represented by the actor's ErpInternalKeyId)
Declaration
public Task<ErpSyncActorFieldCollection> GetFieldsByInternalKeyIdAsync(int internalKeyId)
Parameters
Type |
Name |
Description |
int |
internalKeyId |
|
Returns
GetFieldsForActorTypeAsync(ErpActorType, CancellationToken)
Retrieves all fields that are mapped for a given actor type
Declaration
public Task<ErpSyncActorFieldCollection> GetFieldsForActorTypeAsync(ErpActorType actorType, CancellationToken cancellationToken = default)
Parameters
Returns
GetInternalKey(string, ErpActorType)
Retrieves the ErpInternalKeyId for a given ErpKey and actor type combination
Declaration
public Task<int> GetInternalKey(string localKey, ErpActorType actorType)
Parameters
Type |
Name |
Description |
string |
localKey |
|
ErpActorType |
actorType |
|
Returns
GetListAsync(int, string, CancellationToken)
Retrieves array of list item.
Declaration
public static Task<ListItemArrayPluginResponse> GetListAsync(int connectorId, string listName, CancellationToken cancellationToken = default)
Parameters
Returns
Type |
Description |
Task<ListItemArrayPluginResponse> |
|
GetListAsync(string)
Retrieves an entire list with a given name
Declaration
public override Task<Dictionary<string, string>> GetListAsync(string listName)
Parameters
Type |
Name |
Description |
string |
listName |
|
Returns
Overrides
GetListItemDisplayValueAsync(int, string, string)
Retrieves the textual value (display value) of a given list item in a given list for a given connection
Declaration
public static Task<string> GetListItemDisplayValueAsync(int erpConnectionId, string listName, string listItemKey)
Parameters
Type |
Name |
Description |
int |
erpConnectionId |
|
string |
listName |
|
string |
listItemKey |
|
Returns
GetListItemsAsync(int, string, string[], CancellationToken)
Retrieves a set of FieldMetadataInfo objects containing the fields needed to define a connection in a given connector.
Declaration
public static Task<ListItemArrayPluginResponse> GetListItemsAsync(int connectorId, string listName, string[] listItemKeys, CancellationToken cancellationToken = default)
Parameters
Returns
Type |
Description |
Task<ListItemArrayPluginResponse> |
|
GetListItemsAsync(string, string[])
Retrieves a specific set of list items from a given list
Declaration
public override Task<Dictionary<string, string>> GetListItemsAsync(string listName, string[] listItemKeys)
Parameters
Returns
Overrides
GetSearchableFieldsAsync(ErpActorType, CancellationToken)
A facade for the WCF calls to the actual connector
Declaration
public Task<List<FieldMetadataInfo>> GetSearchableFieldsAsync(ErpActorType actorType, CancellationToken cancellationToken = default)
Parameters
Returns
Type |
Description |
Task<List<FieldMetadataInfo>> |
|
GetSelectedErpFieldsAsync(bool, ErpActorType)
Retrieves all fields marked "Show In Gui" or "PromptUser" for a given actor type
Declaration
public Task<Dictionary<string, FieldMetadataInfo>> GetSelectedErpFieldsAsync(bool getPromptUserFields, ErpActorType erpActorType)
Parameters
Type |
Name |
Description |
bool |
getPromptUserFields |
Get fields marked as PromptUser instead of ShowInGui fields
|
ErpActorType |
erpActorType |
|
Returns
GetSupportedActorTypeFieldsAsync(ErpActorType)
Retrieves the supported fields for a given actor type
Declaration
public override Task<FieldMetadataInfo[]> GetSupportedActorTypeFieldsAsync(ErpActorType actorType)
Parameters
Type |
Name |
Description |
ErpActorType |
actorType |
|
Returns
Type |
Description |
Task<FieldMetadataInfo[]> |
|
Overrides
GetSupportedActorTypesAsync()
Retrieves all actor types this connection supports.
Declaration
public override Task<string[]> GetSupportedActorTypesAsync()
Returns
Overrides
GetSupportedShowInSearchFieldsAsync(ErpActorType, CancellationToken)
A facade for the WCF calls to the actual connector
Declaration
public Task<List<FieldMetadataInfo>> GetSupportedShowInSearchFieldsAsync(ErpActorType actorType, CancellationToken cancellationToken = default)
Parameters
Returns
Type |
Description |
Task<List<FieldMetadataInfo>> |
|
GetUpdatedActorsAsync()
Retrieves all actors updated on or after the most recent timestamp stored in the CRM database.
Declaration
public override Task<ErpSyncActor[]> GetUpdatedActorsAsync()
Returns
Overrides
OpenConnectionAsync(Guid, CancellationToken)
Retrieves or opens a connection object with the specified Connection ID
Declaration
public static Task<ErpConnectionHandlerFacade> OpenConnectionAsync(Guid connectionId, CancellationToken cancellationToken = default)
Parameters
Returns
OpenConnectionAsync(int, CancellationToken)
Retrieves or opens a connection object with the specified ERPConnectionID
Declaration
public static Task<ErpConnectionHandlerFacade> OpenConnectionAsync(int erpConnectionId, CancellationToken cancellationToken = default)
Parameters
Returns
SaveActorTimestampAsync(ErpSyncActor, CancellationToken)
If the timestamp of the given actor is larger than the currently stored timestamp from the database (ErpExternalKey row), the new timestamp is stored to the database.
Declaration
public override Task SaveActorTimestampAsync(ErpSyncActor act, CancellationToken cancellationToken = default)
Parameters
Returns
Overrides
SaveActorsAsync(ErpSyncActor[])
Saves a set of actors to the connection and returns those same actors with their updated values from the ERP system (new timestamp, possibly new field values, etc)
Declaration
public override Task<ErpSyncActor[]> SaveActorsAsync(ErpSyncActor[] actors)
Parameters
Returns
Overrides
SaveConnectionAsync()
Calls SaveConnection on the connector using the configuration data stored in the CRM database.
Declaration
public Task<PluginResponseInfo> SaveConnectionAsync()
Returns
Type |
Description |
Task<PluginResponseInfo> |
|
SaveConnectionAsync(Dictionary<string, string>)
Saves a set of configuration data to the active connection (either a new or an existing connection). NOTE: Does not save the configuration data to the CRM database.
Declaration
public override Task<PluginResponseInfo> SaveConnectionAsync(Dictionary<string, string> connectionInfo)
Parameters
Returns
Type |
Description |
Task<PluginResponseInfo> |
|
Overrides
SaveConnectionAsync(int, Guid, Dictionary<string, string>)
Saves a set of configuration data to a given connection (either a new or an existing connection). NOTE: Does not save the configuration data to the CRM database.
Declaration
public static Task<PluginResponseInfo> SaveConnectionAsync(int erpConnectorId, Guid connectionId, Dictionary<string, string> connectionInfo)
Parameters
Returns
Type |
Description |
Task<PluginResponseInfo> |
|
SaveConnectionTimestampAsync(ErpSyncActor, CancellationToken)
If the timestamp of the given actor is larger than the currently stored timestamp from the database (ErpConnection row), the new timestamp is stored to the database.
Declaration
public override Task SaveConnectionTimestampAsync(ErpSyncActor act, CancellationToken cancellationToken = default)
Parameters
Returns
Overrides
SearchActorByParentAsync(ErpActorType, string, ErpActorType, string)
Searches for actors with a specified parent actor using a given search string. Will use the field mapping for the given actor type and connection.
Declaration
public override Task<ErpSyncActor[]> SearchActorByParentAsync(ErpActorType actorType, string searchText, ErpActorType parentActorType, string parentActorErpKey)
Parameters
Type |
Name |
Description |
ErpActorType |
actorType |
|
string |
searchText |
|
ErpActorType |
parentActorType |
|
string |
parentActorErpKey |
|
Returns
Overrides
SearchActorByParentAsync(ErpActorType, string, ErpActorType, string, string[])
Searches for actors with a specified parent actor using a given search string. Will use the field mapping for the given actor type and connection.
Declaration
public Task<ErpSyncActor[]> SearchActorByParentAsync(ErpActorType actorType, string searchText, ErpActorType parentActorType, string parentActorErpKey, string[] returnFields)
Parameters
Type |
Name |
Description |
ErpActorType |
actorType |
|
string |
searchText |
|
ErpActorType |
parentActorType |
|
string |
parentActorErpKey |
|
string[] |
returnFields |
|
Returns
SearchActorsAsync(ErpActorType, ArchiveRestrictionInfo[], string[])
Extended search, with search restrictions and operators per field (using the ArchiveRestrictionInfo class).
Declaration
public Task<ErpSyncActor[]> SearchActorsAsync(ErpActorType actorType, ArchiveRestrictionInfo[] archiveRestrictions, string[] returnFields)
Parameters
Type |
Name |
Description |
ErpActorType |
actorType |
|
ArchiveRestrictionInfo[] |
archiveRestrictions |
|
string[] |
returnFields |
|
Returns
SearchActorsAsync(ErpActorType, string)
Searches for actors using a given search string. Will use the field mapping for the given actor type and connection to determine which fields to return
Declaration
public override Task<ErpSyncActor[]> SearchActorsAsync(ErpActorType actorType, string searchText)
Parameters
Type |
Name |
Description |
ErpActorType |
actorType |
|
string |
searchText |
|
Returns
Overrides
SearchActorsAsync(ErpActorType, string, string[])
Searches for actors using a given search string, and asks the connector to return a given set of fields
Declaration
public override Task<ErpSyncActor[]> SearchActorsAsync(ErpActorType actorType, string searchText, string[] returnFields)
Parameters
Type |
Name |
Description |
ErpActorType |
actorType |
|
string |
searchText |
|
string[] |
returnFields |
|
Returns
Overrides
SetConnectionIdAsync(Guid)
Get or set (set method is protected) the external connection ID for the connection handler. If set, it will use this to find its own internal ID (database key)
Declaration
protected override Task SetConnectionIdAsync(Guid value)
Parameters
Type |
Name |
Description |
Guid |
value |
|
Returns
Overrides
SetErpConnectionIdAsync(int)
Get or set (set method is protected) the internal connection ID (database key) for the connection handler. If set, it will use this to find its own external ID
Declaration
protected override Task SetErpConnectionIdAsync(int value)
Parameters
Type |
Name |
Description |
int |
value |
|
Returns
Overrides
SupportsAdvancedSearchAsync(ErpActorType)
A facade for the WCF calls to the actual connector
Declaration
public Task<bool> SupportsAdvancedSearchAsync(ErpActorType actorType)
Parameters
Type |
Name |
Description |
ErpActorType |
actorType |
|
Returns
TestConfigDataAsync(int, Dictionary<string, string>, CancellationToken)
Asks a given connector to check if a set of connection configuration data is valid.
Declaration
public static Task<PluginResponseInfo> TestConfigDataAsync(int connectorId, Dictionary<string, string> configData, CancellationToken cancellationToken = default)
Parameters
Returns
Type |
Description |
Task<PluginResponseInfo> |
Ok or error
|
TestConnectionAsync()
Asks the Connector to see if the connection is up and running, using the connector's own stored configuration data.
Declaration
public override Task<PluginResponseInfo> TestConnectionAsync()
Returns
Type |
Description |
Task<PluginResponseInfo> |
|
Overrides
TestConnectorURLAsync(string, CancellationToken)
Checks an URL to see if there's a valid connector on the other side
Declaration
public static Task<PluginResponseInfo> TestConnectorURLAsync(string url, CancellationToken cancellationToken = default)
Parameters
Returns
Type |
Description |
Task<PluginResponseInfo> |
|
UpdateConnectionFieldsAsync()
Asks the connector about all supported fields for all supported actor types, and updates the relevant CRM tables (adds missing fields and updates existing ones)
Declaration
public Task UpdateConnectionFieldsAsync()
Returns