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.Processors.Transactional
Assembly: API.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 | 
|---|---|
| System.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 | 
|---|---|
| System.String | 
Methods
OnPropertyChanged(IBaseEntity, String)
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)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IBaseEntity | item | The transaction item that has changed  | 
      
| System.String | propName | The name of the property that has changed  | 
      
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | A task indicating the completion of the operation  |