Show / Hide Table of Contents

Class QuoteConnectionManager

Takes care of the connections and serves them to interested parties. All connections are wrapped in a SuperOffice.CRM.Sale.QuoteConnectorMediator, so clients do not have to add their own mediators on top of what the QuoteConnectionManager returns.

Inheritance
Object
QuoteConnectionManager
Namespace: SuperOffice.CRM
Assembly: SoDataBase.dll
Syntax
public class QuoteConnectionManager : Object

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
Boolean

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(Int32)

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
Int32 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(Int32, String)

Get configuration fields from a connection

Declaration
public Dictionary<string, FieldMetadataInfo> GetConfigurationFields(int connectionId, string connectorName)
Parameters
Type Name Description
Int32 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(Int32)

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
Int32 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(Int32)

Return the configuration values stored in the db for a given connection.

Declaration
public Dictionary<string, string> GetConnectionConfigFields(int quoteConnectionId)
Parameters
Type Name Description
Int32 quoteConnectionId
Returns
Type Description
Dictionary<String, String>

name=value pairs, or empty dictionary

GetConnectionsForAssociate(Int32)

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
Int32 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)

GetConnectionStartupResponse(Int32)

Get the PluginResponseInfo about failed connection initialization.

Declaration
public PluginResponseInfo GetConnectionStartupResponse(int connectionId)
Parameters
Type Name Description
Int32 connectionId
Returns
Type Description
PluginResponseInfo

GetCurrent()

Get a per-user instance if possible, otherwise get a global instance

Declaration
public static QuoteConnectionManager GetCurrent()
Returns
Type Description
QuoteConnectionManager

GetProduct(Int32, String)

Get a product from a connection based on erp product key.

Declaration
public ProductInfo GetProduct(int quoteConnectionId, string erpProductKey)
Parameters
Type Name Description
Int32 quoteConnectionId

Id of the connection.

String erpProductKey

Erp product key to get the product for.

Returns
Type Description
ProductInfo

ProductInfo

GetProductImage(Int32, String, Int32)

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
Int32 quoteConnectionId

Id of the connection.

String erpProductKey

Erp product key to get the image for.

Int32 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(Int32)

Restore a connection marked as deleted. Undelete connection.

Declaration
public void RestoreConnection(int quoteConnectionId)
Parameters
Type Name Description
Int32 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(Int32, 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
Int32 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.

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top