Class QuoteConnectionManager
Takes care of the connections and serves them to interested parties. All connections are wrapped in a QuoteConnectorMediator, so clients do not have to add their own mediators on top of what the QuoteConnectionManager returns.
Inherited Members
Namespace: SuperOffice.CRM
Assembly: SoDataBase.dll
Syntax
public class QuoteConnectionManager
Properties
ConnectionStartupErrors
Get a list of PluginResponseInfo with information about any failed connection initializations.
Declaration
public PluginResponseInfo[] ConnectionStartupErrors { get; }
Property Value
Type | Description |
---|---|
PluginResponseInfo[] |
HasConnectionStartupErrors
Indicates if any errors occured during initialization of the connections
Declaration
public bool HasConnectionStartupErrors { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
CreateConnection(string)
Create a new connection object based on the Connector's declared name.
Declaration
public QuoteConnection CreateConnection(string connectorName)
Parameters
Type | Name | Description |
---|---|---|
string | connectorName | Plugin name as declared on the class using an attribute |
Returns
Type | Description |
---|---|
QuoteConnection | Wrapper around the connector object |
DeleteConnection(int)
Deletes a connection - sets Deleted field to 1, does not delete the connection row from the database.
Declaration
public void DeleteConnection(int quoteConnectionId)
Parameters
Type | Name | Description |
---|---|---|
int | quoteConnectionId | Primary key of the connection |
Flush()
Reset the connection manager. This will trigger a reload of the connections next time they are accessed.
Declaration
public static void Flush()
GetAllAvailableQuoteConnections()
Get all available connections in the system. This means all connections where initialization was successful.
Declaration
public QuoteConnection[] GetAllAvailableQuoteConnections()
Returns
Type | Description |
---|---|
QuoteConnection[] | Array of QuoteConnection where initialization was successful. |
GetAllInstalledQuoteConnections()
Get an array of QuoteConnection objects for each installed connection.
Declaration
public QuoteConnection[] GetAllInstalledQuoteConnections()
Returns
Type | Description |
---|---|
QuoteConnection[] | Array of QuoteConnection |
GetConfigurationFields(int, string)
Get configuration fields from a connection
Declaration
public Dictionary<string, FieldMetadataInfo> GetConfigurationFields(int connectionId, string connectorName)
Parameters
Type | Name | Description |
---|---|---|
int | connectionId | Id of the connection |
string | connectorName | Name of the connector. Used if the connectionId = 0 |
Returns
Type | Description |
---|---|
Dictionary<string, FieldMetadataInfo> | Dictionary of FieldMetadataInfo with a string key |
Remarks
If the connectionId = 0, then the connectorName must be provided to get the configuration fields.
GetConnection(int)
Get a connection, creating and initializing it if needed. Initialization happens on the first use only.
Declaration
public QuoteConnection GetConnection(int quoteConnectionId)
Parameters
Type | Name | Description |
---|---|---|
int | quoteConnectionId | The connection id from the database (primary key) |
Returns
Type | Description |
---|---|
QuoteConnection | QuoteConnection object that contains metadata about the connection, and the actual connection, wrapped inside a mediator. Return null if connector could not be found. |
GetConnectionConfigFields(int)
Return the configuration values stored in the db for a given connection.
Declaration
public Dictionary<string, string> GetConnectionConfigFields(int quoteConnectionId)
Parameters
Type | Name | Description |
---|---|---|
int | quoteConnectionId |
Returns
Type | Description |
---|---|
Dictionary<string, string> | name=value pairs, or empty dictionary |
GetConnectionStartupResponse(int)
Get the PluginResponseInfo about failed connection initialization.
Declaration
public PluginResponseInfo GetConnectionStartupResponse(int connectionId)
Parameters
Type | Name | Description |
---|---|---|
int | connectionId |
Returns
Type | Description |
---|---|
PluginResponseInfo |
GetConnectionsForAssociate(int)
Returns all connections accessible for the specified user. Will initialize all the accessible connections as a sideffect.
Declaration
public QuoteConnection[] GetConnectionsForAssociate(int associateId)
Parameters
Type | Name | Description |
---|---|---|
int | associateId | Primary key of the user |
Returns
Type | Description |
---|---|
QuoteConnection[] | Array of initialized QuoteConnection. Note that some of the returned connections may not be available for use (failed initialization for example) |
GetCurrent()
Get a per-user instance if possible, otherwise get a global instance
Declaration
public static QuoteConnectionManager GetCurrent()
Returns
Type | Description |
---|---|
QuoteConnectionManager |
GetProduct(int, string)
Get a product from a connection based on erp product key.
Declaration
public ProductInfo GetProduct(int quoteConnectionId, string erpProductKey)
Parameters
Type | Name | Description |
---|---|---|
int | quoteConnectionId | Id of the connection. |
string | erpProductKey | Erp product key to get the product for. |
Returns
Type | Description |
---|---|
ProductInfo |
GetProductImage(int, string, int)
Get a base64 representation of a product image from an erp key in a quote connection.
Declaration
public string GetProductImage(int quoteConnectionId, string erpProductKey, int rank)
Parameters
Type | Name | Description |
---|---|---|
int | quoteConnectionId | Id of the connection. |
string | erpProductKey | Erp product key to get the image for. |
int | rank | Which of the images to get. |
Returns
Type | Description |
---|---|
string | Base64 string representing the image. |
HasConnections()
Return true if there are any connections available
Declaration
public PluginResponseInfo HasConnections()
Returns
Type | Description |
---|---|
PluginResponseInfo | true of 3 |
RestoreConnection(int)
Restore a connection marked as deleted. Undelete connection.
Declaration
public void RestoreConnection(int quoteConnectionId)
Parameters
Type | Name | Description |
---|---|---|
int | quoteConnectionId | Primary key of the connection |
SaveConnection(QuoteConnection)
Save connection info to the database
Declaration
public QuoteConnection SaveConnection(QuoteConnection quoteConnection)
Parameters
Type | Name | Description |
---|---|---|
QuoteConnection | quoteConnection |
Returns
Type | Description |
---|---|
QuoteConnection |
SaveConnectionConfigFields(int, Dictionary<string, string>)
Save connection config fields to the database, merging with old values as needed, and deleting any leftover rows
Declaration
public Dictionary<string, string> SaveConnectionConfigFields(int connectionId, Dictionary<string, string> connectionConfigFields)
Parameters
Type | Name | Description |
---|---|---|
int | connectionId | |
Dictionary<string, string> | connectionConfigFields |
Returns
Type | Description |
---|---|
Dictionary<string, string> |
TestConnection(string, Dictionary<string, string>)
Test a connection
Declaration
public PluginResponseInfo TestConnection(string connectorName, Dictionary<string, string> connectionData)
Parameters
Type | Name | Description |
---|---|---|
string | connectorName | Name of the connector |
Dictionary<string, string> | connectionData | Dictionary with configuration data |
Returns
Type | Description |
---|---|
PluginResponseInfo | PluginResponseInfo with the result of the test. |