Show / Hide Table of Contents

Interface ISaleAgent

Interface for the Sale Agent Sale data services

Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("Sale Agent", "Interface for the Sale Agent. Sale data services")]
public interface ISaleAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;

using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
   using (SaleAgent agent = new SaleAgent())
   {
      // call methods on agent here...
   }
}

Methods

AddSaleStakeholdersAsync(int, SaleStakeholder[], CancellationToken)

Interface for the Sale Agent Sale data services

Declaration
Task AddSaleStakeholdersAsync(int saleId, SaleStakeholder[] saleStakeholders, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleId
SaleStakeholder[] saleStakeholders
CancellationToken cancellationToken
Returns
Type Description
Task

BatchUpdateNextDueDateAsync(CancellationToken)

Re-calculate all the next due dates

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

CreateDefaultSaleEntityAsync(CancellationToken)

Loading default values into a new SaleEntity. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration
Task<SaleEntity> CreateDefaultSaleEntityAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<SaleEntity>

New SaleEntity with default values

CreateDefaultSaleStakeholderAsync(CancellationToken)

Loading default values into a new SaleStakeholder. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration
Task<SaleStakeholder> CreateDefaultSaleStakeholderAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<SaleStakeholder>

New SaleStakeholder with default values

CreateDefaultSaleSummaryAsync(CancellationToken)

Loading default values into a new SaleSummary. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration
Task<SaleSummary> CreateDefaultSaleSummaryAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<SaleSummary>

New SaleSummary with default values

DeleteSaleEntityAsync(int, CancellationToken)

Deletes the SaleEntity

Declaration
Task DeleteSaleEntityAsync(int saleEntityId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleEntityId

The identity of the SaleEntity

CancellationToken cancellationToken
Returns
Type Description
Task

DeleteSaleStakeholderAsync(int, CancellationToken)

Deletes the SaleStakeholder

Declaration
Task DeleteSaleStakeholderAsync(int saleStakeholderId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleStakeholderId

The identity of the SaleStakeholder

CancellationToken cancellationToken
Returns
Type Description
Task

DeleteSaleStakeholdersAsync(int[], CancellationToken)

Interface for the Sale Agent Sale data services

Declaration
Task DeleteSaleStakeholdersAsync(int[] saleStakeholderIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] saleStakeholderIds
CancellationToken cancellationToken
Returns
Type Description
Task

GetMyOpportunitiesAsync(int, CancellationToken)

Returning the opportunities (open sales) belonging to the user currently logged on

Declaration
Task<Sale[]> GetMyOpportunitiesAsync(int count, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int count

The number of sales that is returned. -1 returns all.

CancellationToken cancellationToken
Returns
Type Description
Task<Sale[]>

Array of open sales (opportunities).

GetNextDueDateAsync(int, CancellationToken)

Gets the next due date for a sale. The next due date is the next future appointment that is not completed.

Declaration
Task<DateTime> GetNextDueDateAsync(int saleId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleId

Sale id

CancellationToken cancellationToken
Returns
Type Description
Task<DateTime>

Next due date for the given sale.

GetNextSaleStageAsync(int, bool, CancellationToken)

Gets the next (not deleted) sale stage id if the current stage is deleted. If the current stage is not deleted, the CurrentStageId is returned

Declaration
Task<int> GetNextSaleStageAsync(int saleId, bool includeCurrentStage, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleId
bool includeCurrentStage
CancellationToken cancellationToken
Returns
Type Description
Task<int>

GetOpenSalesForContactAsync(int, CancellationToken)

Returns all open sales for the contact provided.

Declaration
Task<Sale[]> GetOpenSalesForContactAsync(int contactId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int contactId

The ID of the contact whose sales we want.

CancellationToken cancellationToken
Returns
Type Description
Task<Sale[]>

Aray of sales.

GetProbabilityFromStageAsync(int, CancellationToken)

Get the probability percentage for a given sale stage

Declaration
Task<int> GetProbabilityFromStageAsync(int stageId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int stageId

Probability list id

CancellationToken cancellationToken
Returns
Type Description
Task<int>

Probability percentage

GetRecentSalesAsync(int, int, CancellationToken)

Returns the latest sales (that are sold) limited by their amount. The result is sorted descending with the latest first. If the amount is -1, the amount restriction is omitted.

Declaration
Task<Sale[]> GetRecentSalesAsync(int amountLimit, int count, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int amountLimit

The amount limit in the local currency.

int count

The maximum number of items to return. If -1 all are returned.

CancellationToken cancellationToken
Returns
Type Description
Task<Sale[]>

Array of all recent sales.

GetSaleAsync(int, CancellationToken)

Gets a Sale object.

Declaration
Task<Sale> GetSaleAsync(int saleId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleId

The identifier of the Sale object

CancellationToken cancellationToken
Returns
Type Description
Task<Sale>

Sale

GetSaleEntityAsync(int, CancellationToken)

Gets a SaleEntity object.

Declaration
Task<SaleEntity> GetSaleEntityAsync(int saleEntityId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleEntityId

The identifier of the SaleEntity object

CancellationToken cancellationToken
Returns
Type Description
Task<SaleEntity>

SaleEntity

GetSaleListAsync(int[], CancellationToken)

Gets an array of Sale objects.

Declaration
Task<Sale[]> GetSaleListAsync(int[] saleIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] saleIds

The identifiers of the Sale object

CancellationToken cancellationToken
Returns
Type Description
Task<Sale[]>

Array of Sale objects

GetSaleStakeholderAsync(int, CancellationToken)

Gets a SaleStakeholder object.

Declaration
Task<SaleStakeholder> GetSaleStakeholderAsync(int saleStakeholderId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleStakeholderId

The identifier of the SaleStakeholder object

CancellationToken cancellationToken
Returns
Type Description
Task<SaleStakeholder>

SaleStakeholder

GetSaleStakeholderByIdAsync(int[], CancellationToken)

Interface for the Sale Agent Sale data services

Declaration
Task<SaleStakeholder[]> GetSaleStakeholderByIdAsync(int[] saleStakeholderIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] saleStakeholderIds
CancellationToken cancellationToken
Returns
Type Description
Task<SaleStakeholder[]>

GetSaleStakeholderListAsync(int[], CancellationToken)

Gets an array of SaleStakeholder objects.

Declaration
Task<SaleStakeholder[]> GetSaleStakeholderListAsync(int[] saleStakeholderIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] saleStakeholderIds

The identifiers of the SaleStakeholder object

CancellationToken cancellationToken
Returns
Type Description
Task<SaleStakeholder[]>

Array of SaleStakeholder objects

GetSaleStakeholdersAsync(int, CancellationToken)

Interface for the Sale Agent Sale data services

Declaration
Task<SaleStakeholder[]> GetSaleStakeholdersAsync(int saleId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleId
CancellationToken cancellationToken
Returns
Type Description
Task<SaleStakeholder[]>

GetSalesByDateAsync(DateTime, DateTime, int, SaleStatus, CancellationToken)

Returns all sales within a time period. The sales array can be limited by amount and status.

Declaration
Task<Sale[]> GetSalesByDateAsync(DateTime fromDate, DateTime toDate, int amountLimit, SaleStatus status, CancellationToken cancellationToken = default)
Parameters
Type Name Description
DateTime fromDate

The beginning of the time interval.

DateTime toDate

The end of the time interval.

int amountLimit

The amount limit in the local currency. -1 means no amount limit

SaleStatus status

The sale status (Lost, Open, Sold, Unknown). SaleStatus.Unknown means no status filtering.

CancellationToken cancellationToken
Returns
Type Description
Task<Sale[]>

Array of sales.

GetSalesFromContactAsync(int, bool, CancellationToken)

Returns all sales for the contact provided.

Declaration
Task<Sale[]> GetSalesFromContactAsync(int contactId, bool onlyOpenSales, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int contactId

The ID of the contact whose sales we want.

bool onlyOpenSales

If true, only get open sales.

CancellationToken cancellationToken
Returns
Type Description
Task<Sale[]>

List of sales matching query

GetSalesFromPersonAsync(int, bool, CancellationToken)

Returns all sales for the person provided.

Declaration
Task<Sale[]> GetSalesFromPersonAsync(int personId, bool onlyOpenSales, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int personId

The ID of the person whose sales we want.

bool onlyOpenSales

If true, only get open sales.

CancellationToken cancellationToken
Returns
Type Description
Task<Sale[]>

List of sales matching query

GetSummaryByAssociateAsync(int, DateTime, DateTime, CancellationToken)

Interface for the Sale Agent Sale data services

Declaration
Task<SaleSummary> GetSummaryByAssociateAsync(int associateId, DateTime fromDate, DateTime toDate, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int associateId
DateTime fromDate
DateTime toDate
CancellationToken cancellationToken
Returns
Type Description
Task<SaleSummary>

GetSummaryByContactAsync(int, DateTime, DateTime, CancellationToken)

Interface for the Sale Agent Sale data services

Declaration
Task<SaleSummary> GetSummaryByContactAsync(int contactId, DateTime fromDate, DateTime toDate, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int contactId
DateTime fromDate
DateTime toDate
CancellationToken cancellationToken
Returns
Type Description
Task<SaleSummary>

GetSummaryByGroupAsync(int, DateTime, DateTime, CancellationToken)

Interface for the Sale Agent Sale data services

Declaration
Task<SaleSummary> GetSummaryByGroupAsync(int groupId, DateTime fromDate, DateTime toDate, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int groupId
DateTime fromDate
DateTime toDate
CancellationToken cancellationToken
Returns
Type Description
Task<SaleSummary>

GetUpcomingSalesAsync(int, int, CancellationToken)

Returns all open sales, sorted descending with the latest first. If the weigthed amount is -1, the amount restriction is omitted.

Declaration
Task<Sale[]> GetUpcomingSalesAsync(int weightedAmountLimit, int count, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int weightedAmountLimit

The amount weighted by the probability that the sale is closed (amount * probability).

int count

The maximum number of items to return. If -1 all are returned.

CancellationToken cancellationToken
Returns
Type Description
Task<Sale[]>

Array of upcoming sales.

HasGuideActivitiesAsync(int, CancellationToken)

Interface for the Sale Agent Sale data services

Declaration
Task<bool> HasGuideActivitiesAsync(int saleId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleId
CancellationToken cancellationToken
Returns
Type Description
Task<bool>

HasGuideAsync(int, CancellationToken)

Does this sale have a sale guide associated with its sale type?

Declaration
Task<bool> HasGuideAsync(int saleId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleId

Sale id

CancellationToken cancellationToken
Returns
Type Description
Task<bool>

True if the sale has a guide

HasStakeholderSettingAsync(int, CancellationToken)

Interface for the Sale Agent Sale data services

Declaration
Task<bool> HasStakeholderSettingAsync(int saleId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleId
CancellationToken cancellationToken
Returns
Type Description
Task<bool>

IsNumberValidAsync(int, string, CancellationToken)

Checks if the number is unique or required. The setting is configured from admin under system options.

Declaration
Task<bool> IsNumberValidAsync(int contactId, string number, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int contactId

SaleId

string number

Number value to check for uniqueness/required

CancellationToken cancellationToken
Returns
Type Description
Task<bool>

True if the number is valid

OfferAutoNextStageOnApppointmentCompletedAsync(int, CancellationToken)

Interface for the Sale Agent Sale data services

Declaration
Task<bool> OfferAutoNextStageOnApppointmentCompletedAsync(int appointmentId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int appointmentId
CancellationToken cancellationToken
Returns
Type Description
Task<bool>

SaleHasQuoteAsync(int, CancellationToken)

Returns true is the sale has a quote

Declaration
Task<bool> SaleHasQuoteAsync(int saleId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int saleId

The id of the sale

CancellationToken cancellationToken
Returns
Type Description
Task<bool>

True if the sale has a quote

SaveSaleEntityAsync(SaleEntity, CancellationToken)

Updates the existing SaleEntity or creates a new SaleEntity if the id parameter is empty

Declaration
Task<SaleEntity> SaveSaleEntityAsync(SaleEntity saleEntity, CancellationToken cancellationToken = default)
Parameters
Type Name Description
SaleEntity saleEntity

The SaleEntity that is saved.

CancellationToken cancellationToken
Returns
Type Description
Task<SaleEntity>

New or updated SaleEntity

SaveSaleStakeholderAsync(SaleStakeholder, CancellationToken)

Updates the existing SaleStakeholder or creates a new SaleStakeholder if the id parameter is empty

Declaration
Task<SaleStakeholder> SaveSaleStakeholderAsync(SaleStakeholder saleStakeholder, CancellationToken cancellationToken = default)
Parameters
Type Name Description
SaleStakeholder saleStakeholder

The SaleStakeholder that is saved.

CancellationToken cancellationToken
Returns
Type Description
Task<SaleStakeholder>

New or updated SaleStakeholder

SetAsLostAsync(int[], CancellationToken)

Change the status of one or more sales to Lost. Note that this does not affect the Completed state of the sale.

Declaration
Task SetAsLostAsync(int[] saleIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] saleIds

Array of sale ids to be marked as lost. All normal write access rules apply.

CancellationToken cancellationToken
Returns
Type Description
Task

SetAsLostWithReasonAsync(int[], int, CancellationToken)

Change the status of one or more sales to Lost. Note that this does not affect the Completed state of the sale.

Declaration
Task SetAsLostWithReasonAsync(int[] saleIds, int reasonId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] saleIds

Array of sale ids to be marked as lost. All normal write access rules apply.

int reasonId

The ID of the lost reason.

CancellationToken cancellationToken
Returns
Type Description
Task

SetAsSoldAsync(int[], CancellationToken)

Change the status of one or more Sales to Sold. Note that this does not mark them as Completed.

Declaration
Task SetAsSoldAsync(int[] saleIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] saleIds

Array of sale ids to be marked as lost. All the normal write access rules apply.

CancellationToken cancellationToken
Returns
Type Description
Task

SetAsSoldWithReasonAsync(int[], int, CancellationToken)

Change the status of one or more Sales to Sold. Note that this does not mark them as Completed.

Declaration
Task SetAsSoldWithReasonAsync(int[] saleIds, int reasonId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] saleIds

Array of sale ids to be marked as lost. All the normal write access rules apply.

int reasonId

The ID of the sold reason.

CancellationToken cancellationToken
Returns
Type Description
Task

UpdateSaleStakeholdersAsync(SaleStakeholder[], CancellationToken)

Interface for the Sale Agent Sale data services

Declaration
Task<SaleStakeholder[]> UpdateSaleStakeholdersAsync(SaleStakeholder[] stakeholders, CancellationToken cancellationToken = default)
Parameters
Type Name Description
SaleStakeholder[] stakeholders
CancellationToken cancellationToken
Returns
Type Description
Task<SaleStakeholder[]>

ValidateSaleEntityAsync(SaleEntity, CancellationToken)

Check that entity is ready for saving, return error messages by field.

Declaration
Task<StringDictionary> ValidateSaleEntityAsync(SaleEntity saleEntity, CancellationToken cancellationToken = default)
Parameters
Type Name Description
SaleEntity saleEntity

Entity to be checked for errors.

CancellationToken cancellationToken
Returns
Type Description
Task<StringDictionary>

Error messages tagged by field.

© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top