Show / Hide Table of Contents

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.

Inheritance
object
QuoteConnectionManager
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOfficeCRM
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

DeleteConnectionAsync(int, CancellationToken)

Deletes a connection - sets Deleted field to 1, does not delete the connection row from the database.

Declaration
public Task DeleteConnectionAsync(int quoteConnectionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteConnectionId

Primary key of the connection

CancellationToken cancellationToken
Returns
Type Description
Task

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

GetConfigurationFieldsAsync(int, string, CancellationToken)

Get configuration fields from a connection

Declaration
public Task<Dictionary<string, FieldMetadataInfo>> GetConfigurationFieldsAsync(int connectionId, string connectorName, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int connectionId

Id of the connection

string connectorName

Name of the connector. Used if the connectionId = 0

CancellationToken cancellationToken
Returns
Type Description
TaskDictionarystringFieldMetadataInfo

Dictionary of FieldMetadataInfo with a string key

Remarks

If the connectionId = 0, then the connectorName must be provided to get the configuration fields.

GetConnectionAsync(int, CancellationToken)

Get a connection, creating and initializing it if needed. Initialization happens on the first use only.

Declaration
public Task<QuoteConnection> GetConnectionAsync(int quoteConnectionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteConnectionId

The connection id from the database (primary key)

CancellationToken cancellationToken
Returns
Type Description
TaskQuoteConnection

QuoteConnection object that contains metadata about the connection, and the actual connection, wrapped inside a mediator. Return null if connector could not be found.

GetConnectionConfigFieldsAsync(int, CancellationToken)

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

Declaration
public Task<Dictionary<string, string>> GetConnectionConfigFieldsAsync(int quoteConnectionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteConnectionId
CancellationToken cancellationToken
Returns
Type Description
TaskDictionarystringstring

name=value pairs, or empty dictionary

GetConnectionStartupResponseAsync(int, CancellationToken)

Get the PluginResponseInfo about failed connection initialization.

Declaration
public Task<PluginResponseInfo> GetConnectionStartupResponseAsync(int connectionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int connectionId
CancellationToken cancellationToken
Returns
Type Description
TaskPluginResponseInfo

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)

GetCurrentAsync(CancellationToken)

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

Declaration
public static Task<QuoteConnectionManager> GetCurrentAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
TaskQuoteConnectionManager

GetProductAsync(int, string, CancellationToken)

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

Declaration
public Task<ProductInfo> GetProductAsync(int quoteConnectionId, string erpProductKey, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteConnectionId

Id of the connection.

string erpProductKey

Erp product key to get the product for.

CancellationToken cancellationToken
Returns
Type Description
TaskProductInfo

ProductInfo

GetProductImageAsync(int, string, int, CancellationToken)

Get a base64 representation of a product image from an erp key in a quote connection.

Declaration
public Task<string> GetProductImageAsync(int quoteConnectionId, string erpProductKey, int rank, CancellationToken cancellationToken = default)
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.

CancellationToken cancellationToken
Returns
Type Description
Taskstring

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

RestoreConnectionAsync(int, CancellationToken)

Restore a connection marked as deleted. Undelete connection.

Declaration
public Task RestoreConnectionAsync(int quoteConnectionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteConnectionId

Primary key of the connection

CancellationToken cancellationToken
Returns
Type Description
Task

A void return

SaveConnectionAsync(QuoteConnection, CancellationToken)

Save connection info to the database

Declaration
public Task<QuoteConnection> SaveConnectionAsync(QuoteConnection quoteConnection, CancellationToken cancellationToken = default)
Parameters
Type Name Description
QuoteConnection quoteConnection
CancellationToken cancellationToken
Returns
Type Description
TaskQuoteConnection

SaveConnectionConfigFieldsAsync(int, Dictionary<string, string>, CancellationToken)

Save connection config fields to the database, merging with old values as needed, and deleting any leftover rows

Declaration
public Task<Dictionary<string, string>> SaveConnectionConfigFieldsAsync(int connectionId, Dictionary<string, string> connectionConfigFields, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int connectionId
Dictionarystringstring connectionConfigFields
CancellationToken cancellationToken
Returns
Type Description
TaskDictionarystringstring

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

Dictionarystringstring 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