Class ValueOffsetterExtender
The base class for creating a value offsetter extender that automatically enters the opposite value for certain configured ITransactionTypeValue
This can be used to enable functionality for a ITransactionCode that whenever an amount is entered for a certain value, the system automatically enters the opposite amount for another specified value, and vice-versa
Inherited Members
Namespace: LemonEdge.API.Core.FinancialServices.Processors.Transactional
Assembly: LemonEdge.API.Core.FinancialServices.dll
Syntax
public abstract class ValueOffsetterExtender : TransactionProcessorExtender
Remarks
For instance if you have sold (PCS) and current cost (PCC) configured as ITransactionTypeValue, and want them to auto offset, you can use the following:
[TransactionProcessorExtender("Sale - CurrentCost/SoldCost Auto Offset", nameof(SaleCurrentCostSoldCostOffseter), Description = "Offsets current cost with negative sold cost, and vice versa.")]
public class SaleCurrentCostSoldCostOffseter : ValueOffsetterExtender
{
public SaleCurrentCostSoldCostOffseter(ITransactionProcessor processor) : base(processor) { }
protected override string OffsetValueCodeX => "PCC"; //Current Cost
protected override string OffsetValueCodeY => "PCS"; //Sold Cost
}
Constructors
ValueOffsetterExtender(ITransactionProcessor)
Creates a new value offsetter extender for use in configuring transaction code behaviour
Declaration
public ValueOffsetterExtender(ITransactionProcessor processor)
Parameters
Type | Name | Description |
---|---|---|
ITransactionProcessor | processor | The transaction processor this algorithm runs automatically against |
Properties
OffsetValueCodeX
The Code of the value that you want automatically offset by the OffsetValueCodeY value
Declaration
protected abstract string OffsetValueCodeX { get; }
Property Value
Type | Description |
---|---|
string |
OffsetValueCodeY
The Code of the value that you want automatically offset by the OffsetValueCodeX value
Declaration
protected abstract string OffsetValueCodeY { get; }
Property Value
Type | Description |
---|---|
string |
Methods
OnPropertyChanged(IBaseEntity, string, bool)
Ensures whenever a transaction value of type OffsetValueCodeX or OffsetValueCodeY is changed, this automatically updates the other with the opposite value
Declaration
public override Task OnPropertyChanged(IBaseEntity item, string propName, bool ignoredByProcessor)
Parameters
Type | Name | Description |
---|---|---|
IBaseEntity | item | The transaction item that has changed |
string | propName | The name of the property that has changed |
bool | ignoredByProcessor |
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |