Search Results for

    Show / Hide Table of Contents

    Class HistoryService

    Inheritance
    System.Object
    HistoryService
    Implements
    IHistoryService
    Namespace: DirectScale.Disco.Extension.Services
    Assembly: DirectScale.Disco.Extension.Abstractions.dll
    Syntax
    public class HistoryService : Object, IHistoryService

    Constructors

    HistoryService(IApiService)

    Declaration
    public HistoryService(IApiService apiService)
    Parameters
    Type Name Description
    IApiService apiService

    Methods

    GetCommissionDetail(Int32, Int32, String)

    Gets the summary of all bonuses paid to associateId in periodId for a specific bonus paymentGroup.

    Declaration
    public Task<CommissionHistoryDetail[]> GetCommissionDetail(int associateId, int periodId, string paymentGroup)
    Parameters
    Type Name Description
    System.Int32 associateId

    This is the id of the associate, which is the associate's record number in CRM_Distributors.

    System.Int32 periodId

    This is the id of the period, which is the period's record number in CRM_CommissionPeriods.

    System.String paymentGroup

    This is specific bonus group to get details about, which is defined in the comp plan template. Pass in an empty string to return all bonuses.

    Returns
    Type Description
    System.Threading.Tasks.Task<CommissionHistoryDetail[]>

    An array of CommissionHistoryDetail which includes the full information about the associate's bonus and how it was earned. An empty array if none are found.

    See Also
    CommissionHistoryDetail
    GetCommissionHistory(System.Int32, System.Int32)

    GetCommissionHistory(Int32, Int32)

    Gets the summary of all bonuses paid to associateId in periodId.

    Declaration
    public Task<CommissionHistorySummary[]> GetCommissionHistory(int associateId, int periodId)
    Parameters
    Type Name Description
    System.Int32 associateId

    This is the id of the associate, which is the associate's record number in CRM_Distributors.

    System.Int32 periodId

    This is the id of the period, which is the period's record number in CRM_CommissionPeriods.

    Returns
    Type Description
    System.Threading.Tasks.Task<CommissionHistorySummary[]>

    An array of CommissionHistorySummary which includes the bonuses and amount paid were paid to the associate for that period. An empty array if none are found.

    See Also
    CommissionHistorySummary
    GetCommissionDetail(System.Int32, System.Int32, System.String)

    GetHighRankDate(Int32)

    Reads the highest rank ever obtained by associateId

    Declaration
    public Task<RankDate> GetHighRankDate(int associateId)
    Parameters
    Type Name Description
    System.Int32 associateId

    This is the id of the associate, which is the associate's record number in CRM_Distributors.

    Returns
    Type Description
    System.Threading.Tasks.Task<RankDate>

    The highest rank an associate has achieved in a previous period, and when they got it. Null if no data is found

    See Also
    RankDate
    GetLastRankDate(System.Int32)

    GetLastRankDate(Int32)

    Reads the most recent rank obtained by associateId

    Declaration
    public Task<RankDate> GetLastRankDate(int associateId)
    Parameters
    Type Name Description
    System.Int32 associateId

    This is the id of the associate, which is the associate's record number in CRM_Distributors.

    Returns
    Type Description
    System.Threading.Tasks.Task<RankDate>

    The rank the associate achieved in the latest closed period, and when they got it. Null if no data is found

    See Also
    RankDate
    GetHighRankDate(System.Int32)

    GetRuleResults(Int32, Int32)

    Gets all the Key Performance Indicators (KPIs) for associateId in periodId.

    Declaration
    public Task<CommissionRuleResult[]> GetRuleResults(int associateId, int periodId)
    Parameters
    Type Name Description
    System.Int32 associateId

    This is the id of the associate, which is the associate's record number in CRM_Distributors.

    System.Int32 periodId

    This is the id of the period, which is the period's record number in CRM_CommissionPeriods.

    Returns
    Type Description
    System.Threading.Tasks.Task<CommissionRuleResult[]>

    An array of all of the KPIs for that associate in that period. An empty array if none are found.

    IsLocked(DateTime)

    Checks to see if date falls within any period that has already been locked.

    Declaration
    public Task<bool> IsLocked(DateTime date)
    Parameters
    Type Name Description
    System.DateTime date

    This is the date to check, often this will be the order date of an order.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    A bool indicating if the period is locked (true) or still open (false)

    Examples
    Order order = _orderService.GetOrderByOrderNumber(42);
    if (_historyService.IsLocked(order.OrderDate))
    {
        throw new Exception("Order is locked and cannot be modified!");
    {
    else
    {
        _orderService.UpdateOrder(
            new UpdateOrderInfo() {TotalCV = order.TotalCV + 100}
        );
    }
    See Also
    SetLockDate(DateTime)

    SetLockDate(DateTime)

    Moves the lock date forward to date to prevent changes before a commission payout.

    Declaration
    public Task SetLockDate(DateTime date)
    Parameters
    Type Name Description
    System.DateTime date

    The new lock date, must be later than the current lock date.

    Returns
    Type Description
    System.Threading.Tasks.Task
    Remarks

    Before a commission run can be paid out the period must be locked. Once it is locked no orders can be modified. Orders can be refuned, but they will no longer be able to remove volume, instead they will trigger a clawback if needed.

    Warning: The lock date will lock all orders up to that date, and applies globally to all templates. Even ones with periods that are still open. Example: if an order placed on 07/13 has to be locked for a weekly profile to be paid, that order cannot be edited, even though the July monthly template hasn't run yet.

    Implements

    IHistoryService
    In This Article
    Back to top Copyright © 2022 DirectScale
    Generated by DocFX