Class PeriodEndProcessor
Implements
Inherited Members
Namespace: LemonEdge.API.Core.FinancialServices.Processors.Transactional.PeriodEnd
Assembly: LemonEdge.API.Core.FinancialServices.dll
Syntax
[ServerTask("Recalculate Period End", "d8592592-d980-45ac-b649-b9416752112a", typeof(PeriodEndProcessParameter), DefaultForHasSaveProcessingTask = typeof(IPeriodEnd))]
public class PeriodEndProcessor : BaseTransactionProcessor, ICanBeRevertedTransactionProcessor, IPeriodEndProcessor, ITaskProcessor, IBaseDataSetProcessorWithDBSave, IBaseDataSetProcessor, IProcessor, IDisposable, ILockable
Constructors
PeriodEndProcessor(IEntityUpdater, IReadOnlyCache, UserInfo, IServiceContext, ITransactionsFinaliser)
Declaration
public PeriodEndProcessor(IEntityUpdater updater, IReadOnlyCache cache, UserInfo user, IServiceContext services, ITransactionsFinaliser transactionsFinaliser)
Parameters
Type | Name | Description |
---|---|---|
IEntityUpdater | updater | |
IReadOnlyCache | cache | |
UserInfo | user | |
IServiceContext | services | |
ITransactionsFinaliser | transactionsFinaliser |
PeriodEndProcessor(IServiceContext, ITransactionsFinaliser)
Declaration
public PeriodEndProcessor(IServiceContext context, ITransactionsFinaliser transactionsFinaliser)
Parameters
Type | Name | Description |
---|---|---|
IServiceContext | context | |
ITransactionsFinaliser | transactionsFinaliser |
Properties
Adjustments
Any manual adjustment records manually added to the period end, loaded from the PeriodEnd entity for this operation
Declaration
public IEnumerable<IPeriodEndAdjustment> Adjustments { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IPeriodEndAdjustment> |
CapitalAccountDataItems
All the capital account data item records generated by the process, to burn in all records for this period end for consistent, secure and fast reporting
Declaration
public IEnumerable<ICapitalAccountDataItem> CapitalAccountDataItems { get; }
Property Value
Type | Description |
---|---|
IEnumerable<ICapitalAccountDataItem> |
Loaded
Flag to indicate if the processor has been fully loaded
Declaration
public override bool Loaded { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
PeriodEnd
The root period end record this processor is responsible for
Declaration
public IPeriodEnd PeriodEnd { get; }
Property Value
Type | Description |
---|---|
IPeriodEnd |
RootTransactionEntity
The root transaction entity for this transaction processor
Declaration
public override IHeaderTransactionalEntity RootTransactionEntity { get; }
Property Value
Type | Description |
---|---|
IHeaderTransactionalEntity |
Overrides
Methods
AddAdjustment(ICapitalAccountDataItem)
Adds a manual capital account data item to the process linked to an IPeriodEndAdjustment
Declaration
public void AddAdjustment(ICapitalAccountDataItem adj)
Parameters
Type | Name | Description |
---|---|---|
ICapitalAccountDataItem | adj | The capital account data item record to add to the process |
AddAdjustment(IPeriodEndAdjustment)
Adds an adjustment manually to the processor
Declaration
public void AddAdjustment(IPeriodEndAdjustment adj)
Parameters
Type | Name | Description |
---|---|---|
IPeriodEndAdjustment | adj | The period end adjustment record to add to the process |
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
CalculateAsync(CancellationToken)
Calculates the period end process generating all the capital account data item entries
Declaration
public Task CalculateAsync(CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | token |
Returns
Type | Description |
---|---|
Task | A task indicating the completion of this operation |
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
DisposeManagedState()
Declaration
protected override void DisposeManagedState()
Overrides
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
Init(ITaskRunner, ServerTaskParameter)
Initializes the task processor with the parameters for processing the task
Declaration
public Task Init(ITaskRunner runner, ServerTaskParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
ITaskRunner | runner | The context within which the task is being processed |
ServerTaskParameter | parameter |
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
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
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
LoadLight()
Declaration
public Task LoadLight()
Returns
Type | Description |
---|---|
Task |
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 |
RemoveAdjustment(ICapitalAccountDataItem)
Removes a manually added capital account data item from the processor
Declaration
public void RemoveAdjustment(ICapitalAccountDataItem adj)
Parameters
Type | Name | Description |
---|---|---|
ICapitalAccountDataItem | adj | The capital account data item record to remove from the process |
RemoveAdjustment(IPeriodEndAdjustment)
Removes an adjustment from the processor
Declaration
public void RemoveAdjustment(IPeriodEndAdjustment adj)
Parameters
Type | Name | Description |
---|---|---|
IPeriodEndAdjustment | adj | The period end adjustment record to remove from the process |
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
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 |