Show / Hide Table of Contents

Class QuoteManager

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Inheritance
object
QuoteManager
Implements
IQuoteManager
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: SuperOffice.CRM.Sale
Assembly: SoDataBase.BusinessLogic.dll
Syntax
public sealed class QuoteManager : IQuoteManager

Properties

ContactId

The contact id the sale is connected to

Declaration
public int ContactId { get; }
Property Value
Type Description
int

ContactInfo

Get information for the Contact the sale is connected to.

Declaration
public IContactInfo ContactInfo { get; }
Property Value
Type Description
IContactInfo

HasQuote

HasQuote is true if the current sale has a connected quote

Declaration
public bool HasQuote { get; }
Property Value
Type Description
bool

PersonId

The person id the sale is connected to

Declaration
public int PersonId { get; }
Property Value
Type Description
int

ProjectId

The project id the sale is connected to

Declaration
public int ProjectId { get; }
Property Value
Type Description
int

QuoteData

Gets the QuoteData

Declaration
public IQuoteData QuoteData { get; }
Property Value
Type Description
IQuoteData

QuoteId

The QuoteId of the QuoteManager. If there is not a quote on this sale, 0 is returned.

Declaration
public int QuoteId { get; }
Property Value
Type Description
int

QuoteRow

Gets the QuoteRow

Declaration
public QuoteRow QuoteRow { get; }
Property Value
Type Description
QuoteRow

SaleId

Get the saleId the QuoteManager

Declaration
public int SaleId { get; }
Property Value
Type Description
int

SaleRow

Gets the Sale row

Declaration
public SaleRow SaleRow { get; }
Property Value
Type Description
SaleRow

Methods

ApproveQuoteVersionAsync(int, string, int, string, CancellationToken)

Approves a quote version

Declaration
public Task<ApproveRejectResponseInfo> ApproveQuoteVersionAsync(int quoteVersionId, string approvedByText, int approvedByAssociateId, string approvalText, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId

QuoteVersionId to approve.

string approvedByText

'Approved by' prefix text in user's language.

int approvedByAssociateId

AssociateId of the associate who approved the quote version.

string approvalText

Approval text.

CancellationToken cancellationToken
Returns
Type Description
Task<ApproveRejectResponseInfo>

Response of the the operation

CanProvideCapabilityAsync(string, CancellationToken)

Find of the QuoteConnector for this Quote can provide a capability

Declaration
public Task<bool> CanProvideCapabilityAsync(string capability, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string capability
CancellationToken cancellationToken
Returns
Type Description
Task<bool>

true if connector has capability

CancelQuoteApprovalRequestAsync(int, CancellationToken)

Cancels a pending quote approval request

Declaration
public Task<PluginResponseInfo> CancelQuoteApprovalRequestAsync(int quoteVersionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId

QuoteVersionId that has a pending approval.

CancellationToken cancellationToken
Returns
Type Description
Task<PluginResponseInfo>

Response of the the operation

CopyQuoteAlternativeAsync(int, int, string, CancellationToken)

Copy a Quote Alternative and giving it a new name.

Declaration
public Task<QuoteAlternativeInfo> CopyQuoteAlternativeAsync(int quoteVersionId, int copyFromQuouteAlternativeId, string quoteAlternativeName, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId
int copyFromQuouteAlternativeId
string quoteAlternativeName
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteAlternativeInfo>

CreateAsync(int, CancellationToken)

Use QuoteManager.FromSaleId to instantiate instead of using this directly. Creates a new QuoteManager based on saledId, which will load a fresh set of QuoteData from the database, instead of using the cached values.

Declaration
public static Task<QuoteManager> CreateAsync(int saleId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleId

The id of the sale for handling quotes.

CancellationToken cancellationToken
Returns
Type Description
Task<QuoteManager>
Remarks

A SoIllegalOperationException will be thrown if the sale does not exist.

CreateNewQuoteAsync(int, string, CancellationToken)

Create a new quote, quoteversion and a default quote alternative

Declaration
public Task<IQuoteData> CreateNewQuoteAsync(int connectionId, string firstAlternativeName, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int connectionId

Which connection to create the quote on

string firstAlternativeName

Name to be given to the default alternative

CancellationToken cancellationToken
Returns
Type Description
Task<IQuoteData>

Saved quote containing a version and a single alternative, after defaults have been applied by connector

Remarks

A SoIllegalOperationException will be thrown if the sale already has a quote.

CreateNewQuoteVersionAsync(int, CancellationToken)

Create a new quote version in this quote based on another quote in this quote.

Declaration
public Task<QuoteVersionInfo> CreateNewQuoteVersionAsync(int fromQuoteVersionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int fromQuoteVersionId

The original version (which will be marked as state = "Archived")

CancellationToken cancellationToken
Returns
Type Description
Task<QuoteVersionInfo>

New Quote version, attached to the same quote and sale.

Remarks

Side effect: The Quote's Active Version id is updated to point to the newly created version. All old quote versions are marked 'Archived'.

CreateQuoteAlternativeAsync(int, string, string, CancellationToken)

Create a new quote alternative on a version.

Declaration
public Task<QuoteAlternativeInfo> CreateQuoteAlternativeAsync(int quoteVersionId, string quoteAlternativeName, string quoteAlternativeDescription, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId

QuoteVersionId of the revision to create the alternative on.

string quoteAlternativeName

The name to set on the new alternative.

string quoteAlternativeDescription

The description to set on the new alternative.

CancellationToken cancellationToken
Returns
Type Description
Task<QuoteAlternativeInfo>

CreateQuoteFromSaleAsync(int, CancellationToken)

Create a quote by copying an active quote version from another sale.

Declaration
public Task<IQuoteData> CreateQuoteFromSaleAsync(int copyFromSaleId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int copyFromSaleId

Id of the sale to copy the active quote from.

CancellationToken cancellationToken
Returns
Type Description
Task<IQuoteData>

CreateQuoteLineAsync(int, ProductInfo, CancellationToken)

Create a quoteline from a productinfo object.

Declaration
public Task<QuoteLineInfo> CreateQuoteLineAsync(int quoteAlternativeId, ProductInfo productInfo, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteAlternativeId
ProductInfo productInfo
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteLineInfo>

CreateQuoteLineAsync(int, string, CancellationToken)

Create one or more quoteline(s) from a productKey by calling the erp connector.

Declaration
public Task<QuoteLineInfo> CreateQuoteLineAsync(int quoteAlternativeId, string productKey, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteAlternativeId

alternative to add to

string productKey

product id

CancellationToken cancellationToken
Returns
Type Description
Task<QuoteLineInfo>

First non-null quoteline

CreateQuoteVersionAsync(CancellationToken)

Create a blank new Quoteversion for the current Quote. This quote version has no address or details set. It has a single blank alternative.

Declaration
public Task<QuoteVersionRow> CreateQuoteVersionAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteVersionRow>

The saved new quote version

DeleteQuoteAlternativeAsync(int, CancellationToken)

Delete a quote alternative

Declaration
public Task DeleteQuoteAlternativeAsync(int quoteAlternativeId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteAlternativeId

Id of the quote alternative to delete.

CancellationToken cancellationToken
Returns
Type Description
Task

A void return

DeleteQuoteAsync(int, CancellationToken)

Delete a quote with versions, alternatives and lines. DeleteQuote can be performed even with an invalid quote connection.

Declaration
public Task DeleteQuoteAsync(int quoteId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteId
CancellationToken cancellationToken
Returns
Type Description
Task

DeleteQuoteLineAsync(int, CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task DeleteQuoteLineAsync(int quoteLineId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteLineId
CancellationToken cancellationToken
Returns
Type Description
Task

DeleteQuoteLinesAsync(int[], CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task DeleteQuoteLinesAsync(int[] quoteLineIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] quoteLineIds
CancellationToken cancellationToken
Returns
Type Description
Task

FindProductAsync(string, int, string, CancellationToken)

Returns the set of products that matches the user input criteria. Basically searches freetext through all the products text fields

Declaration
public Task<ProductInfo[]> FindProductAsync(string userInput, int quoteAlternativeId, string priceListKey, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string userInput
int quoteAlternativeId
string priceListKey
CancellationToken cancellationToken
Returns
Type Description
Task<ProductInfo[]>

GetActivePriceListsAsync(CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task<PriceListInfo[]> GetActivePriceListsAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<PriceListInfo[]>

GetActiveQuoteVersionAsync(CancellationToken)

Copy active quote from another sale.

Declaration
public Task<QuoteVersionInfo> GetActiveQuoteVersionAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteVersionInfo>

GetActiveQuoteVersionRowAsync(CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task<QuoteVersionRow> GetActiveQuoteVersionRowAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteVersionRow>

GetAllPriceListsAsync(CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task<PriceListInfo[]> GetAllPriceListsAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<PriceListInfo[]>

GetBillingAddressAsync(int, CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task<AddressRow> GetBillingAddressAsync(int quoteVersionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId
CancellationToken cancellationToken
Returns
Type Description
Task<AddressRow>

GetConnectionsAsync(int, CancellationToken)

Get all connections available for the associate

Declaration
public Task<List<QuoteConnection>> GetConnectionsAsync(int associateId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int associateId
CancellationToken cancellationToken
Returns
Type Description
Task<List<QuoteConnection>>

GetIsoCurrencyCodeAsync(CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task<string> GetIsoCurrencyCodeAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<string>

GetOrderStateAsync(int, CancellationToken)

If there is a problem with a quoteline, the error description shall be placed in the status and reason fields of the quoteline, if there is a problem with the alternative, the error description shall be placed in the status and reason fields of the alternative. A summary of all the problems (if any) should be placed in the response object. Requires that the Create-Order capability is true.

Declaration
public Task<PluginResponseInfoWithChanges> GetOrderStateAsync(int quoteVersionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId

the QuoteVersionId of the ordered version.

CancellationToken cancellationToken
Returns
Type Description
Task<PluginResponseInfoWithChanges>

QuoteVersionId if a new quote version has been created. Otherwise 0 will be returned

GetQuote(int)

Get a quote

Declaration
public QuoteInfo GetQuote(int quoteId)
Parameters
Type Name Description
int quoteId
Returns
Type Description
QuoteInfo

GetQuoteAlternativeAsync(int, CancellationToken)

Get a specified quote alternative.

Declaration
public Task<QuoteAlternativeInfo> GetQuoteAlternativeAsync(int quoteAlternativeId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteAlternativeId

Id of the quote alternative to get.

CancellationToken cancellationToken
Returns
Type Description
Task<QuoteAlternativeInfo>

QuoteAlternativeInfo

GetQuoteAlternativeContextInfoAsync(QuoteAlternativeInfo, CancellationToken)

Build and return the quote alternative context object.

Declaration
public Task<QuoteAlternativeContextInfo> GetQuoteAlternativeContextInfoAsync(QuoteAlternativeInfo alternative, CancellationToken cancellationToken = default)
Parameters
Type Name Description
QuoteAlternativeInfo alternative
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteAlternativeContextInfo>

GetQuoteAlternativeContextInfoAsync(int, CancellationToken)

Build and return the quote alternative context object from the database.

Declaration
public Task<QuoteAlternativeContextInfo> GetQuoteAlternativeContextInfoAsync(int alternativeId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int alternativeId
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteAlternativeContextInfo>

GetQuoteAlternativeRowAsync(int, CancellationToken)

Get a QuoteAlternativeRow

Declaration
public Task<QuoteAlternativeRow> GetQuoteAlternativeRowAsync(int quoteAlternativeId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteAlternativeId
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteAlternativeRow>

GetQuoteAlternativeRowsAsync(QuoteVersionRow, CancellationToken)

Get all QuoteAlternativeRows from a quoteversion row

Declaration
public Task<List<QuoteAlternativeRow>> GetQuoteAlternativeRowsAsync(QuoteVersionRow quoteVersionRow, CancellationToken cancellationToken = default)
Parameters
Type Name Description
QuoteVersionRow quoteVersionRow
CancellationToken cancellationToken
Returns
Type Description
Task<List<QuoteAlternativeRow>>

GetQuoteAlternativeRowsAsync(int, CancellationToken)

Get all QuoteAlternativeRows from a quoteversionId

Declaration
public Task<List<QuoteAlternativeRow>> GetQuoteAlternativeRowsAsync(int quoteVersionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId
CancellationToken cancellationToken
Returns
Type Description
Task<List<QuoteAlternativeRow>>

GetQuoteAlternativesAsync(int, CancellationToken)

Get all quote alternatived for a quote version.

Declaration
public Task<List<QuoteAlternativeInfo>> GetQuoteAlternativesAsync(int quoteVersionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId

The id of the quote version to get the alternatives for.

CancellationToken cancellationToken
Returns
Type Description
Task<List<QuoteAlternativeInfo>>

A list of QuoteAlternativeInfo

GetQuoteConnectorNameAsync(CancellationToken)

The name of the connector, taken from its QuoteConnectorAttribute name, as declared in the code. This name forms the suffix of any custom archive and mdo list providers that this connector might implement as overrides of the simpler, structured interfaces.

Declaration
public Task<string> GetQuoteConnectorNameAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<string>

GetQuoteLineAsync(int, CancellationToken)

Get a quoteline

Declaration
public Task<QuoteLineInfo> GetQuoteLineAsync(int quoteLineId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteLineId
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteLineInfo>

GetQuoteLineRowAsync(int, CancellationToken)

Get a quote line row from primary id

Declaration
public Task<QuoteLineRow> GetQuoteLineRowAsync(int quoteLineId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteLineId
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteLineRow>

GetQuoteLineRowsAsync(int, CancellationToken)

Get a quote line row from quotealternative primary id

Declaration
public Task<QuoteLineRows> GetQuoteLineRowsAsync(int quoteAlternativeId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteAlternativeId
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteLineRows>

GetQuoteLinesAsync(int, CancellationToken)

Get a quoteline

Declaration
public Task<QuoteLineInfo[]> GetQuoteLinesAsync(int quoteAlternativeId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteAlternativeId
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteLineInfo[]>

GetQuoteListAsync(string, CancellationToken)

Get a Quote list, if the connector has the capability (interface, any list, specific list) See QuoteListsByNameProvider for a description of quoteListType.

Declaration
public Task<ListItemInfo[]> GetQuoteListAsync(string quoteListType, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string quoteListType

See QuoteListsByNameProvider for a description of creating quoteListType string.

CancellationToken cancellationToken
Returns
Type Description
Task<ListItemInfo[]>

null if no list provided, or list of items.

GetQuoteVersionAsync(int, CancellationToken)

Get a specified quote version.

Declaration
public Task<QuoteVersionInfo> GetQuoteVersionAsync(int quoteVersionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteVersionInfo>

QuoteVersionInfo

GetQuoteVersionContextInfoAsync(int, CancellationToken)

Build a QuoteVersionContextInfo object

Declaration
public Task<QuoteVersionContextInfo> GetQuoteVersionContextInfoAsync(int versionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int versionId
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteVersionContextInfo>

GetQuoteVersionRowAsync(int, CancellationToken)

Get a QuoteVersionRow

Declaration
public Task<QuoteVersionRow> GetQuoteVersionRowAsync(int quoteVersionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteVersionRow>

GetQuoteVersionStatusAsync(int, int, QuoteVersionRow, CancellationToken)

Iterate through the version, alternatives and quotelines to build up a version status.

Declaration
public static Task<QuoteVersionStatusInfo> GetQuoteVersionStatusAsync(int quoteVersionId, int activeQuoteAlternativeId, QuoteVersionRow unsavedVersionRow, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId
int activeQuoteAlternativeId
QuoteVersionRow unsavedVersionRow

VersionRow can be an unsaved row, but contains status/ reason

CancellationToken cancellationToken
Returns
Type Description
Task<QuoteVersionStatusInfo>

GetQuoteVersionStatusAsync(int, int, CancellationToken)

Iterate through the version, alternatives and quotelines to build up a version status.

Declaration
public static Task<QuoteVersionStatusInfo> GetQuoteVersionStatusAsync(int quoteVersionId, int activeQuoteAlternativeId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId
int activeQuoteAlternativeId
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteVersionStatusInfo>

GetQuoteVersionsAsync(CancellationToken)

Get all quote versions for a sale.

Declaration
public Task<List<QuoteVersionInfo>> GetQuoteVersionsAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<List<QuoteVersionInfo>>

List of QuoteVersionInfo

GetShippingAddressAsync(int, CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task<AddressRow> GetShippingAddressAsync(int quoteVersionId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId
CancellationToken cancellationToken
Returns
Type Description
Task<AddressRow>

GetStateImageAndText(QuoteVersionInfo, DateTime, out string, out string, out string)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public static void GetStateImageAndText(QuoteVersionInfo quoteVersion, DateTime expiration, out string imageHint, out string displayText, out string tooltipText)
Parameters
Type Name Description
QuoteVersionInfo quoteVersion
DateTime expiration
string imageHint
string displayText
string tooltipText

GetVersionAttachmentRowsAsync(CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task<Dictionary<QuoteVersionRow, QuoteVersionAttachmentRows>> GetVersionAttachmentRowsAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<Dictionary<QuoteVersionRow, QuoteVersionAttachmentRows>>

HasValidConnectionAsync(CancellationToken)

Check if the QuoteManager has a valid quote connection. QuoteManager can be instanciated with an invalid connection id to do certain tasks.

Declaration
public Task<bool> HasValidConnectionAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<bool>

InitializeAsync(int, CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task InitializeAsync(int saleId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleId
CancellationToken cancellationToken
Returns
Type Description
Task

MoveQuoteLineAsync(int, bool, CancellationToken)

Rerank quoteline, move it up or down

Declaration
public Task MoveQuoteLineAsync(int quoteLineId, bool direction, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteLineId
bool direction
CancellationToken cancellationToken
Returns
Type Description
Task

OnAfterSaveQuoteAsync(QuoteAlternativeContextInfo, CancellationToken)

Calls the OnAfterSaveQuote on a connector with quoteAlternativeContextInfo.

Declaration
public Task OnAfterSaveQuoteAsync(QuoteAlternativeContextInfo quoteAlternativeContextInfo, CancellationToken cancellationToken = default)
Parameters
Type Name Description
QuoteAlternativeContextInfo quoteAlternativeContextInfo
CancellationToken cancellationToken
Returns
Type Description
Task

OnAfterSaveQuoteAsync(int, CancellationToken)

Calls the OnAfterSaveQuote on a connector with the current context based on quoteAlternativeId.

Declaration
public Task OnAfterSaveQuoteAsync(int quoteAlternativeId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteAlternativeId
CancellationToken cancellationToken
Returns
Type Description
Task

OnBeforeDeleteQuoteAsync(CancellationToken)

Calls the connector to notify it that the sale this quote is connected to is about to be deleted.

Declaration
public Task OnBeforeDeleteQuoteAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task

PlaceOrderAsync(int, bool, string, string, string, CancellationToken)

Call the connector to create an order if the connector can place order. Updates the sale and version with state=Sold if the connector call succeeded, or if it can't place orders.

Declaration
public Task<PluginResponseInfoWithChanges> PlaceOrderAsync(int quoteAlternativeId, bool markSaleAsSold, string poNumber, string orderComment, string culture, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteAlternativeId

The chosen alternative to send to the Order system

bool markSaleAsSold

Should sale status change to sold?

string poNumber

Order number from dialog

string orderComment

Text from dialog

string culture

Language the order confirmation documents should be generated in

CancellationToken cancellationToken
Returns
Type Description
Task<PluginResponseInfoWithChanges>

Changes to quote, and URL to show. If plugin returns IsOk = false, then sale/quote are not updated.

RecalculateQuoteAlternativeAsync(QuoteAlternativeInfo, QuoteVersionButtonAction, CancellationToken)

Recalculate the quote alternative, possibly changing the quote version state. Calls the QuoteConnector.RecalculateQuoteAlternative to do the actual work. Saves the quote alternative to the database after changes have been calculated.

Declaration
public Task<QuoteAlternativeRecalculatedInfo> RecalculateQuoteAlternativeAsync(QuoteAlternativeInfo quoteAlternative, QuoteVersionButtonAction action, CancellationToken cancellationToken = default)
Parameters
Type Name Description
QuoteAlternativeInfo quoteAlternative

Quote Alternative info. In memory structure

QuoteVersionButtonAction action
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteAlternativeRecalculatedInfo>

Updated QuoteAlternative with new calculated values.

Remarks

RecalculateQuoteAlternative will not change version or the quote itself. Returns null if the quote connector is not a product provider.

RecalculateQuoteAlternativeAsync(QuoteAlternativeInfo, CancellationToken)

Recalculate the quote alternative, possibly changing the quote version state. Calls the QuoteConnector.RecalculateQuoteAlternative to do the actual work. Saves the quote alternative to the database after changes have been calculated.

Declaration
public Task<QuoteAlternativeRecalculatedInfo> RecalculateQuoteAlternativeAsync(QuoteAlternativeInfo quoteAlternative, CancellationToken cancellationToken = default)
Parameters
Type Name Description
QuoteAlternativeInfo quoteAlternative

Quote Alternative info. In memory structure

CancellationToken cancellationToken
Returns
Type Description
Task<QuoteAlternativeRecalculatedInfo>

Updated QuoteAlternative with new calculated values.

Remarks

RecalculateQuoteAlternative will not change version or the quote itself. Returns null if the quote connector is not a product provider.

RecalculateQuoteAlternativeAsync(int, QuoteVersionButtonAction, CancellationToken)

Recalculate the quote alternative. Calls the QuoteConnector.RecalculateQuoteAlternative to do the actual work. Saves the quote alternative to the database after changes have been calculated.

Declaration
public Task<QuoteAlternativeRecalculatedInfo> RecalculateQuoteAlternativeAsync(int quoteAlternativeId, QuoteVersionButtonAction action, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteAlternativeId

Quote alternative id to read from the database.

QuoteVersionButtonAction action
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteAlternativeRecalculatedInfo>

Updated QuoteAlternative with new calculated values.

Remarks

Returns null if the quote connector is not a product provider.

RecalculateQuoteAlternativeAsync(int, CancellationToken)

Recalculate the quote alternative. Calls the QuoteConnector.RecalculateQuoteAlternative to do the actual work. Saves the quote alternative to the database after changes have been calculated.

Declaration
public Task<QuoteAlternativeRecalculatedInfo> RecalculateQuoteAlternativeAsync(int quoteAlternativeId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteAlternativeId

Quote alternative id to read from the database.

CancellationToken cancellationToken
Returns
Type Description
Task<QuoteAlternativeRecalculatedInfo>

Updated QuoteAlternative with new calculated values.

Remarks

Returns null if the quote connector is not a product provider.

RecalculateQuoteLineAsync(QuoteLineInfo, string[], CancellationToken)

Recalculate a quoteline. Calls the connector's OnQuoteLineChangedAsync(QuoteAlternativeContextInfo, QuoteLineInfo, string[], CancellationToken).

Declaration
public Task<QuoteLineInfo> RecalculateQuoteLineAsync(QuoteLineInfo quoteLineInfo, string[] changedFields, CancellationToken cancellationToken = default)
Parameters
Type Name Description
QuoteLineInfo quoteLineInfo
string[] changedFields

Array of QuoteLine fields that has been changed.

CancellationToken cancellationToken
Returns
Type Description
Task<QuoteLineInfo>

Modified QuoteLine

RejectQuoteVersionAsync(int, string, int, string, CancellationToken)

Rejects a quote version

Declaration
public Task<ApproveRejectResponseInfo> RejectQuoteVersionAsync(int quoteVersionId, string rejectedByText, int rejectedByAssociateId, string rejectionText, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId

QuoteVersionId to approve.

string rejectedByText

'Rejected By' in current language.

int rejectedByAssociateId

AssociateId of the associate who rejected the quote version.

string rejectionText

Rejection text.

CancellationToken cancellationToken
Returns
Type Description
Task<ApproveRejectResponseInfo>

Response of the the operation

RenameQuoteAlternativeAsync(int, string, CancellationToken)

Gives the alternative a new name and saves it.

Declaration
public Task RenameQuoteAlternativeAsync(int quoteAlternativeId, string newName, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteAlternativeId
string newName
CancellationToken cancellationToken
Returns
Type Description
Task

RequestQuoteApprovalAsync(int, int, string, CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task<PluginResponseInfo> RequestQuoteApprovalAsync(int quoteVersionId, int associateId, string comment, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId
int associateId
string comment
CancellationToken cancellationToken
Returns
Type Description
Task<PluginResponseInfo>

SaveQuoteAlternativeAsync(QuoteAlternativeInfo, CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task<QuoteAlternativeInfo> SaveQuoteAlternativeAsync(QuoteAlternativeInfo quoteAlternative, CancellationToken cancellationToken = default)
Parameters
Type Name Description
QuoteAlternativeInfo quoteAlternative
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteAlternativeInfo>

SaveQuoteAsync(QuoteInfo, CancellationToken)

Save quote, and call the connector's OnAfterSave method. Side Effect: Update the Sale with the active version's Likely alternative's TotalPrice and EarningAmount/Percent.

Declaration
public Task<QuoteInfo> SaveQuoteAsync(QuoteInfo q, CancellationToken cancellationToken = default)
Parameters
Type Name Description
QuoteInfo q
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteInfo>

The saved quote

SaveQuoteLineAsync(QuoteLineInfo, CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task<QuoteLineInfo> SaveQuoteLineAsync(QuoteLineInfo quoteLine, CancellationToken cancellationToken = default)
Parameters
Type Name Description
QuoteLineInfo quoteLine
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteLineInfo>

SaveQuoteLinesAsync(QuoteLineInfo[], CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task<QuoteLineInfo[]> SaveQuoteLinesAsync(QuoteLineInfo[] quoteLines, CancellationToken cancellationToken = default)
Parameters
Type Name Description
QuoteLineInfo[] quoteLines
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteLineInfo[]>

SaveQuoteVersionAsync(QuoteVersionInfo, CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task<QuoteVersionInfo> SaveQuoteVersionAsync(QuoteVersionInfo quoteVersionInfo, CancellationToken cancellationToken = default)
Parameters
Type Name Description
QuoteVersionInfo quoteVersionInfo
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteVersionInfo>

SendQuoteVersionAsync(int, DateTime, DateTime, string, string, CancellationToken)

Send a quote version with all its alternatives and quotelines. Creates follow-up if quote connector OnAfter

Declaration
public Task<PluginResponseInfoWithChanges> SendQuoteVersionAsync(int quoteVersionId, DateTime expiryDate, DateTime followupDate, string followupText, string culture, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId

QuoteVersionId of the quoteversion to send

DateTime expiryDate

Date the quote expires

DateTime followupDate

Date for the followup task, to remind the sales rep about the quote

string followupText
string culture
CancellationToken cancellationToken
Returns
Type Description
Task<PluginResponseInfoWithChanges>

Modified quote version/alternative/line objects. Url to open if call was successful.

SetAddressAsync(int, AddressRow, int, CancellationToken)

Handle all business logic for quotes on a sale.
A QuoteManager is created for a given sale/quote and manages the versions+alternatives for the sale/quote. A QuoteManager is not a singleton. Uses the QuoteConnectionManager to manage and initialize Quote Connections.

Declaration
public Task SetAddressAsync(int quoteVersionId, AddressRow addressRow, int countryId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId
AddressRow addressRow
int countryId
CancellationToken cancellationToken
Returns
Type Description
Task

UpdateQuoteVersionPricesAsync(int, HashSet<string>, CancellationToken)

Update prices for all quotelines under the alternatives of the version. Call Connector.RecalculateAlternative on all alternatives after prices are updated. Call Connector.ValidateQuoteVersion to apply workflow rules after the prices are updated. Saves the updated quote, quote alternatives and lines to the database.

Declaration
public Task<QuoteVersionValidatedInfo> UpdateQuoteVersionPricesAsync(int quoteVersionId, HashSet<string> writeableFields, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId

Quote version primary key

HashSet<string> writeableFields
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteVersionValidatedInfo>

Updated and saved Quote Version with updated prices and re-calculated/validated quote lines

Remarks

Returns error instead of calling RecalcAlternatives / ValidateQuoteVersion if UpdateQuoteVersionPrices returns error.

ValidateQuoteVersionAsync(int, QuoteVersionButtonAction, CancellationToken)

ValidateQuoteVersion

Declaration
public Task<QuoteVersionValidatedInfo> ValidateQuoteVersionAsync(int quoteVersionId, QuoteVersionButtonAction action, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int quoteVersionId
QuoteVersionButtonAction action
CancellationToken cancellationToken
Returns
Type Description
Task<QuoteVersionValidatedInfo>

Updated and saved quote version

Implements

IQuoteManager

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