Search Results for

    Show / Hide Table of Contents

    Class TransferProcessor

    Inheritance
    object
    BaseTransactionProcessor
    TransferProcessor
    Implements
    ITransferProcessor
    ILockable
    ITaskProcessor
    ICanBeRevertedTransactionProcessor
    IBaseDataSetProcessorWithDBSave
    IBaseDataSetProcessor
    IProcessor
    IDisposable
    Inherited Members
    BaseTransactionProcessor.RollbackChanges()
    BaseTransactionProcessor.ProcessOnDBSave()
    BaseTransactionProcessor.GetAllItemsInTransactionProcessor(bool)
    BaseTransactionProcessor.TaskInit(IEntityUpdater, IReadOnlyCache, UserInfo, BusyProgressReporter)
    BaseTransactionProcessor.StatusValidate(IHeaderTransactionalEntity, IEntityUpdater, IReadOnlyCache, UserInfo, IEntityDescriptorFactory, bool, bool)
    BaseTransactionProcessor.ProcessTransaction()
    BaseTransactionProcessor.ExecuteFormula<T>(string, IBaseEntity)
    BaseTransactionProcessor.UpdateFinacialDate(ITransactionalEntity)
    BaseTransactionProcessor.UpdateCommonProperties()
    BaseTransactionProcessor.UpdateCommonProperties(IHeaderTransactionalEntity, ITransactionalEntity)
    BaseTransactionProcessor.KeepTransactionDateConsistent()
    BaseTransactionProcessor.UpdateAllStatuses(IHeaderTransactionalEntity)
    BaseTransactionProcessor.Dispose(bool)
    BaseTransactionProcessor.DisposeUnManagedState()
    BaseTransactionProcessor.Dispose()
    BaseTransactionProcessor.Services
    BaseTransactionProcessor.FinancialDateCalculator
    BaseTransactionProcessor.SubProcessors
    BaseTransactionProcessor.CancelledItems
    BaseTransactionProcessor.CorrectedItems
    BaseTransactionProcessor.RootCorrectedEntity
    BaseTransactionProcessor.RootCancelledEntity
    BaseTransactionProcessor.CanCancel
    BaseTransactionProcessor.CommitToFinalizeRequiresTask
    BaseTransactionProcessor.AnyChangeRequiresTaskRecalc
    BaseTransactionProcessor.Reporter
    BaseTransactionProcessor.Updater
    BaseTransactionProcessor.Cache
    BaseTransactionProcessor.User
    BaseTransactionProcessor.IgnoreEvents
    BaseTransactionProcessor.Order
    BaseTransactionProcessor.SaveProcessed
    BaseTransactionProcessor.CanLock
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: LemonEdge.API.Core.FinancialServices.Processors.Transactional
    Assembly: LemonEdge.API.Core.FinancialServices.dll
    Syntax
    [ServerTask("Recalculate Transfer", "3f605df5-b5fb-4a0c-929e-c787a76ebfb9", typeof(TransferProcessParameter), DefaultForHasSaveProcessingTask = typeof(ITransfer))]
    public class TransferProcessor : BaseTransactionProcessor, ITransferProcessor, ILockable, ITaskProcessor, ICanBeRevertedTransactionProcessor, IBaseDataSetProcessorWithDBSave, IBaseDataSetProcessor, IProcessor, IDisposable

    Constructors

    TransferProcessor(IEntityUpdater, IReadOnlyCache, UserInfo, IServiceContext)

    Declaration
    public TransferProcessor(IEntityUpdater updater, IReadOnlyCache cache, UserInfo user, IServiceContext services)
    Parameters
    Type Name Description
    IEntityUpdater updater
    IReadOnlyCache cache
    UserInfo user
    IServiceContext services

    TransferProcessor(IServiceContext)

    Declaration
    public TransferProcessor(IServiceContext context)
    Parameters
    Type Name Description
    IServiceContext context

    Properties

    EntityOverrides

    The Transfer Entity Overrides loaded from the Transfer entity for this operation

    Declaration
    public IEnumerable<ITransferEntityOverride> EntityOverrides { get; }
    Property Value
    Type Description
    IEnumerable<ITransferEntityOverride>

    Extenders

    A list of all extenders that are responsible for processing parts of the transfer and transfering different system records

    Declaration
    public IEnumerable<TransferProcessorExtender> Extenders { get; }
    Property Value
    Type Description
    IEnumerable<TransferProcessorExtender>

    IncludeCommitted

    When recalculating indicates if committed transactions should be transferred

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

    Loaded

    Flag to indicate if the processor has been fully loaded

    Declaration
    public override bool Loaded { get; }
    Property Value
    Type Description
    bool
    Overrides
    BaseTransactionProcessor.Loaded

    RootTransactionEntity

    The root transaction entity for this transaction processor

    Declaration
    public override IHeaderTransactionalEntity RootTransactionEntity { get; }
    Property Value
    Type Description
    IHeaderTransactionalEntity
    Overrides
    BaseTransactionProcessor.RootTransactionEntity

    Targets

    The Transfer Targets loaded from the Transfer entity for this operation

    Declaration
    public IEnumerable<ITransferTargetPartner> Targets { get; }
    Property Value
    Type Description
    IEnumerable<ITransferTargetPartner>

    TransactionTypValueOverrides

    The Transfer Transaction Type Value Overrides loaded from the Transfer entity for this operation

    Declaration
    public IEnumerable<ITransferTransactionTypeValueOverride> TransactionTypValueOverrides { get; }
    Property Value
    Type Description
    IEnumerable<ITransferTransactionTypeValueOverride>

    Transfer

    The root transfer record this processor is responsible for

    Declaration
    public ITransfer Transfer { get; }
    Property Value
    Type Description
    ITransfer

    TransferedItems

    A list of the items transferred by this processor, once the operation has been processed

    The dictionary contains the globally unique id of each item in the system that should be transferred by this process.

    The corrosponding value holds the list of records the system creates that transfers the appropriate amount off the original, and onto the target partners
    Declaration
    public Dictionary<Guid, List<ICanBeTransferred>> TransferedItems { get; }
    Property Value
    Type Description
    Dictionary<Guid, List<ICanBeTransferred>>

    Methods

    AddEntityOverride(ITransferEntityOverride)

    Declaration
    public void AddEntityOverride(ITransferEntityOverride entityOverride)
    Parameters
    Type Name Description
    ITransferEntityOverride entityOverride

    AddTarget(ITransferTargetPartner)

    Declaration
    public void AddTarget(ITransferTargetPartner target)
    Parameters
    Type Name Description
    ITransferTargetPartner target

    AddToDataSetToProcess(IBaseEntity, EntityOperation)

    If a modified item belongs in the processor (IsChangedItemPartOfDataSet(IBaseEntity)), this adds the item to the processor if it already isn't a member of it

    Declaration
    public override void AddToDataSetToProcess(IBaseEntity item, EntityOperation operationType)
    Parameters
    Type Name Description
    IBaseEntity item

    The item to add to the processor

    EntityOperation operationType

    The type of operation that modified the item. Useful as deleted items can often be treated differently in a processor.

    Overrides
    BaseTransactionProcessor.AddToDataSetToProcess(IBaseEntity, EntityOperation)

    AddTranValueOverride(ITransferTransactionTypeValueOverride)

    Declaration
    public void AddTranValueOverride(ITransferTransactionTypeValueOverride valueOverride)
    Parameters
    Type Name Description
    ITransferTransactionTypeValueOverride valueOverride

    Calculate()

    Declaration
    public Task Calculate()
    Returns
    Type Description
    Task

    CanWrite(IBaseEntity)

    Indicates if the processor allows items to be written to depending on the users permission and transaction status

    Declaration
    public override bool CanWrite(IBaseEntity baseEntity)
    Parameters
    Type Name Description
    IBaseEntity baseEntity
    Returns
    Type Description
    bool
    Overrides
    BaseTransactionProcessor.CanWrite(IBaseEntity)

    CreateUpdateTransfers(IEnumerable<ICanBeTransferred>, Guid?, Guid?, Func<ICanBeTransferred, IEnumerable<ICanBeTransferred>, string[], string[]>, Func<ICanBeTransferred, Rounder>)

    Given a set of original records that need to be transferred, for a given forEntitySetEntityID and forTranValueID, this function goes through the following steps:

    For each original record it creates a transfer record moving the amount of the SourceEntityID, and another transferring record (for each EntityID) moving the calculated amount to them

    This process uses the GetTransferPercentage(Guid, Guid?, Guid?), and GetTransferringItem(Guid, ICanBeTransferred) methods and can be recreated manually if desired.

    The amounts to transfer are indicated by the UpdateOnTransfer attribute against each property of the original record that should be transfered, or are indicated with the propertyNamesToTransfer

    Declaration
    public Task<IEnumerable<ICanBeTransferred>> CreateUpdateTransfers(IEnumerable<ICanBeTransferred> originals, Guid? forEntitySetEntityID, Guid? forTranValueID, Func<ICanBeTransferred, IEnumerable<ICanBeTransferred>, string[], string[]> propertyNamesToTransfer = null, Func<ICanBeTransferred, Rounder> getRounder = null)
    Parameters
    Type Name Description
    IEnumerable<ICanBeTransferred> originals

    A list of original records that need to be transferred by this transfer processor

    Guid? forEntitySetEntityID

    The optional entity all these original records are associated with and thus maybe subject to ITransferEntityOverride overrides

    Guid? forTranValueID

    The optional transaction value these original records are associated with and thus maybe subject to ITransferTransactionTypeValueOverride overrides

    Func<ICanBeTransferred, IEnumerable<ICanBeTransferred>, string[], string[]> propertyNamesToTransfer

    A function that given a source transferred record, a list of all transferring records, and all standard properties the system would transfer (from properties with UpdateOnTransfer attribute), this function returns a list of property names to actually transfer

    Func<ICanBeTransferred, Rounder> getRounder

    A rounder set to a level the system should round all transferred amounts to. If null, no rounding is applied.

    Returns
    Type Description
    Task<IEnumerable<ICanBeTransferred>>

    All records created (or updated) for transfering amounts from/to the original records provided

    CustomUpdateCancelCorrectedItem(EntityDescriptor, ITransactionalEntity, ITransactionalEntity, bool)

    Provides the implementing class an opportunity to update the cancel, or corrected record generated automatically by the processor

    Declaration
    protected override Task CustomUpdateCancelCorrectedItem(EntityDescriptor type, ITransactionalEntity original, ITransactionalEntity cancelCorrected, bool isCorrectionRecord)
    Parameters
    Type Name Description
    EntityDescriptor type

    The type of the entity being cancelled or corrected

    ITransactionalEntity original

    The original entity record that has a cancel or corrected record generated for it

    ITransactionalEntity cancelCorrected

    The cancel or corrected record, indicated by isCorrectionRecord

    bool isCorrectionRecord

    Indicates cancelCorrected is a correction record. It is a cancelling record otherwise.

    Returns
    Type Description
    Task
    Overrides
    BaseTransactionProcessor.CustomUpdateCancelCorrectedItem(EntityDescriptor, ITransactionalEntity, ITransactionalEntity, bool)

    DisposeManagedState()

    Declaration
    protected override void DisposeManagedState()
    Overrides
    BaseTransactionProcessor.DisposeManagedState()

    ForceLoad()

    Forces the processor to load all items for the calculation.

    Some implementations do not run their process during save (such as the ITransferProcessor) and instead run them as tasks, and just use this for the cancel/correct logic

    As such the ProcessTransaction() and Load() can do nothing. This should be implemented by such processors to actually load for the system to correctly process cancel/corrects too
    Declaration
    protected override Task ForceLoad()
    Returns
    Type Description
    Task

    A task indicating the completion of the operation

    Overrides
    BaseTransactionProcessor.ForceLoad()

    GetAllItemsInThisProcessorExcludingSubProcessors()

    Returns all items in this base processor - Used by the system when reverting the status of a finalized transaction back to in progress

    Declaration
    public override IEnumerable<IBaseEntity> GetAllItemsInThisProcessorExcludingSubProcessors()
    Returns
    Type Description
    IEnumerable<IBaseEntity>

    An enumeration of all items in this transactional processor

    Overrides
    BaseTransactionProcessor.GetAllItemsInThisProcessorExcludingSubProcessors()

    GetTransferPercentage(Guid, Guid?, Guid?)

    Returns the calculated percentage that should be transferred from/to a given partner id (the source or target entities in the transfer), given a specified entity and transaction value that could affect the amounts depending on the overrides configuration

    Can be called by a TransferProcessorExtender to get the percentage to use for transferring items if calculating manually

    Declaration
    public decimal GetTransferPercentage(Guid partnerID, Guid? entityID, Guid? tranValueID)
    Parameters
    Type Name Description
    Guid partnerID

    The id of the entity that has amounts being transferred from/to them. The source or target entity in the transfer

    Guid? entityID

    An optional entity indicating the record being transferred is against an entity within an entity set, and maybe subject to overrides for the percentage configured in ITransferEntityOverride

    Guid? tranValueID

    An optional transaction value indicating the record being transferred is againast a transaction value amount, and maybe subject to overrides for the percentage configured in ITransferTransactionTypeValueOverride

    Returns
    Type Description
    decimal

    The calculated percentage that should be transferred from/to a given partner id (the source or target entities in the transfer), given a specified entity and transaction value that could affect the amounts depending on the overrides configuration

    GetTransferringItem(Guid, ICanBeTransferred)

    Retrieves a record that transfers an amount from the original record to the specified forEntityID

    If no such record exists yet (as this is the first time the process has been run) then it creates and returns a record for holding the transferred amount.

    Can be called by a TransferProcessorExtender to get, or create, records from an original to an entity to be transferred to/from
    Declaration
    public Task<ICanBeTransferred> GetTransferringItem(Guid forEntityID, ICanBeTransferred original)
    Parameters
    Type Name Description
    Guid forEntityID

    The id of the entity that an amount should be transferred from/to depending on if they are the SourceEntityID, or an EntityID

    ICanBeTransferred original

    An original record that needs amounts transferred from it to the source/target partners for the transfer

    Returns
    Type Description
    Task<ICanBeTransferred>

    A record that transfers an amount from the original record to the specified forEntityID

    Init(ITaskRunner, ServerTaskParameter)

    Initializes the task processor with the parameters for processing the task

    Declaration
    public Task Init(ITaskRunner runner, ServerTaskParameter ProcessTaskParameter)
    Parameters
    Type Name Description
    ITaskRunner runner

    The context within which the task is being processed

    ServerTaskParameter ProcessTaskParameter

    The parameter for running this task

    Returns
    Type Description
    Task

    A task indicating the completion of the operationn

    IsChangedItemPartOfDataSet(IBaseEntity)

    This function returns true if the specified modified item belongs in this processor.

    Non modified items will just automatically be loaded by the processor anyway, this is more to keep track of items as they are changed and should be added to the processor without having to reload

    Declaration
    public override bool IsChangedItemPartOfDataSet(IBaseEntity item)
    Parameters
    Type Name Description
    IBaseEntity item

    The item to check if it belongs in this processor

    Returns
    Type Description
    bool

    True if the specified item belongs in this processor

    Overrides
    BaseTransactionProcessor.IsChangedItemPartOfDataSet(IBaseEntity)

    IsLocked(IBaseEntity)

    Indicates if this item is currently locked. True if status is finalized or cancelled. Can be changed by the user in the UI to modify finalized transactions which this will process as a cancel/correct

    Declaration
    public override bool IsLocked(IBaseEntity baseEntity)
    Parameters
    Type Name Description
    IBaseEntity baseEntity
    Returns
    Type Description
    bool

    true if it can be unlocked to enable updates, otherwise false

    Overrides
    BaseTransactionProcessor.IsLocked(IBaseEntity)

    Load()

    A thread safe implementation to load all required data for the processor

    Once completed Loaded should return true.

    Declaration
    public override Task Load()
    Returns
    Type Description
    Task

    A task indicating the completion of the load operation

    Overrides
    BaseTransactionProcessor.Load()

    LoadLight()

    loads enough for ui interaction

    Declaration
    public Task LoadLight()
    Returns
    Type Description
    Task

    ProcessCancel(ITransactionalEntity, bool, BaseTransactionProcessor)

    Goes through all items in the processor and creates cancellation records for them while also resetting any changes they have back to their original values so the original record stays as is for cancellation

    Declaration
    protected override Task ProcessCancel(ITransactionalEntity cancellingRootEntity, bool wasCorrected, BaseTransactionProcessor rootProcessor)
    Parameters
    Type Name Description
    ITransactionalEntity cancellingRootEntity
    bool wasCorrected

    Indicates that the system also generated correction records for the original transactional entities too

    BaseTransactionProcessor rootProcessor
    Returns
    Type Description
    Task

    A task indicating the completion of the task

    Overrides
    BaseTransactionProcessor.ProcessCancel(ITransactionalEntity, bool, BaseTransactionProcessor)

    ProcessCorrect(ITransactionalEntity, TransactionStatus, BaseTransactionProcessor)

    Goes through all items in the processor and creates correction records for them

    Declaration
    protected override Task ProcessCorrect(ITransactionalEntity correctingRootItem, TransactionStatus correctionStatus, BaseTransactionProcessor rootProcessor)
    Parameters
    Type Name Description
    ITransactionalEntity correctingRootItem

    The new root item for all the correction records

    TransactionStatus correctionStatus
    BaseTransactionProcessor rootProcessor
    Returns
    Type Description
    Task

    A task indicating the completion of the task

    Overrides
    BaseTransactionProcessor.ProcessCorrect(ITransactionalEntity, TransactionStatus, BaseTransactionProcessor)

    ProcessTask(CancellationToken)

    A function that implements the process for this task using the parameters provided during Init(ITaskRunner, ServerTaskParameter)

    Declaration
    public Task<object> ProcessTask(CancellationToken cancel)
    Parameters
    Type Name Description
    CancellationToken cancel

    A cancellation token for cancelling any long running task

    Returns
    Type Description
    Task<object>

    An optional object detailing the result which can be converted using ITaskResultHandler into a ServerTaskResult, or is a ServerTaskResult itself

    RemoveEntityOverride(ITransferEntityOverride)

    Declaration
    public void RemoveEntityOverride(ITransferEntityOverride entityOverride)
    Parameters
    Type Name Description
    ITransferEntityOverride entityOverride

    RemoveTarget(ITransferTargetPartner)

    Declaration
    public void RemoveTarget(ITransferTargetPartner target)
    Parameters
    Type Name Description
    ITransferTargetPartner target

    RemoveTranValueOverride(ITransferTransactionTypeValueOverride)

    Declaration
    public void RemoveTranValueOverride(ITransferTransactionTypeValueOverride valueOverride)
    Parameters
    Type Name Description
    ITransferTransactionTypeValueOverride valueOverride

    SetLock(IBaseEntity, bool)

    Sets the locked status IBaseEntity

    Declaration
    public override void SetLock(IBaseEntity baseEntity, bool value)
    Parameters
    Type Name Description
    IBaseEntity baseEntity
    bool value
    Overrides
    BaseTransactionProcessor.SetLock(IBaseEntity, bool)

    UpdateCalculatedProperties(ITransactionalEntity)

    Updates calculated properties on the entity (and presumably sub affected entities) such as financial date

    Declaration
    protected override Task UpdateCalculatedProperties(ITransactionalEntity tranEntity)
    Parameters
    Type Name Description
    ITransactionalEntity tranEntity
    Returns
    Type Description
    Task
    Overrides
    BaseTransactionProcessor.UpdateCalculatedProperties(ITransactionalEntity)

    UpdateExtendedProperties(IBaseEntity, IBaseEntity)

    For a given original item as part of a transfer, will create any extended properties that are marked as par of the set of data that should be copied over when created as a transfer

    Declaration
    public Task UpdateExtendedProperties(IBaseEntity originalItem, IBaseEntity newItem)
    Parameters
    Type Name Description
    IBaseEntity originalItem
    IBaseEntity newItem
    Returns
    Type Description
    Task

    Validate()

    Performs custom validation to validate this processor and all transactional entities within it

    Throws an error for any validation failure

    Declaration
    public override Task Validate()
    Returns
    Type Description
    Task

    A task indicating the completion of this operation

    Overrides
    BaseTransactionProcessor.Validate()

    Implements

    ITransferProcessor
    ILockable
    ITaskProcessor
    ICanBeRevertedTransactionProcessor
    IBaseDataSetProcessorWithDBSave
    IBaseDataSetProcessor
    IProcessor
    IDisposable

    Extension Methods

    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.