Class TriggerContext
The context class that holds all the changes that triggered a IActionTriggerGate
Inheritance
Inherited Members
Namespace: LemonEdge.API.Tasks.Parameters.Triggers
Assembly: API.dll
Syntax
public class TriggerContext : FormulaFunctionsWithContext, IFormulaFunctionsWithContextItem, IFormulaFunctions
Constructors
TriggerContext(IEntityRetriever, IReadOnlyCache, UserInfo, IBaseEntity)
Creates a new trigger context holding the information for the items that triggered a IActionTriggerGate
Declaration
public TriggerContext(IEntityRetriever retriever, IReadOnlyCache cache, UserInfo user, IBaseEntity item)
Parameters
Type | Name | Description |
---|---|---|
IEntityRetriever | retriever | A context for querying all the data in the syste, |
IReadOnlyCache | cache | A local cache |
UserInfo | user | The current logged in user |
IBaseEntity | item | The item in the system that this trigger is being activated by |
Properties
IsActionMatch
Holds the custom action string from the parameters
Declaration
public string IsActionMatch { get; }
Property Value
Type | Description |
---|---|
System.String |
IsDeleted
Indicates the triggered item was deleted as it has no current item, and only has a previous item
Declaration
public bool IsDeleted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsNew
Indicates the triggered item is new, as it has no older version
Declaration
public bool IsNew { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsUpdated
Indicates the triggered item is not new, as it has an older version
Declaration
public bool IsUpdated { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
NotifyItem
The main item (of type EntityTypeID) that notifies the action to be triggered.
Linked to through a relationship of the gate via ActionItemProperty
Declaration
public object NotifyItem { get; }
Property Value
Type | Description |
---|---|
System.Object |
NotifyOldItem
The previous version of the notification item. Will be null if the notification item is new
Declaration
public object NotifyOldItem { get; }
Property Value
Type | Description |
---|---|
System.Object |
OldItem
Declaration
public object OldItem { get; }
Property Value
Type | Description |
---|---|
System.Object |
Trigger
The parent action trigger that would be triggered by this context
Declaration
public IActionTrigger Trigger { get; }
Property Value
Type | Description |
---|---|
IActionTrigger |
Methods
GetNotifyOldValue(String)
Returns the old value of the specified property of the NotifyItem. Returns the previous version if it exists, else returns the current value if the item is new
Declaration
public object GetNotifyOldValue(string propName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
System.Object | The old value of the specified property of the NotifyItem. Returns the previous version if it exists, else returns the current value if the item is new |
GetNotifyOldValue<T>(String)
Returns the old value of the specified property of the NotifyItem. Returns the previous version if it exists, else returns the current value if the item is new
Declaration
public T GetNotifyOldValue<T>(string propName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
T | The old value of the specified property of the NotifyItem. Returns the previous version if it exists, else returns the current value if the item is new |
Type Parameters
Name | Description |
---|---|
T | The type of the specified property value |
GetNotifyValue(String)
Returns the value of the specified property of the NotifyItem. Returns the latest version if it exists, else returns the previous value if the item was deleted
Declaration
public object GetNotifyValue(string propName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
System.Object | The value of the specified property of the NotifyItem. Returns the latest version if it exists, else returns the previous value if the item was deleted |
GetNotifyValue<T>(String)
Returns the value of the specified property of the NotifyItem. Returns the latest version if it exists, else returns the previous value if the item was deleted
Declaration
public T GetNotifyValue<T>(string propName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
T | The value of the specified property of the NotifyItem. Returns the latest version if it exists, else returns the previous value if the item was deleted |
Type Parameters
Name | Description |
---|---|
T | The type of the specified property value |
GetOldValue(String)
Returns the old value of the specified property of the Item. Returns the previous version if it exists, else returns the current value if the item is new
Declaration
public object GetOldValue(string propName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
System.Object | The old value of the specified property of the Item. Returns the previous version if it exists, else returns the current value if the item is new |
GetOldValue<T>(String)
Returns the old value of the specified property of the Item. Returns the previous version if it exists, else returns the current value if the item is new
Declaration
public T GetOldValue<T>(string propName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
T | The old value of the specified property of the Item. Returns the previous version if it exists, else returns the current value if the item is new |
Type Parameters
Name | Description |
---|---|
T | The type of the specified property value |
GetValue(String)
Returns the value of the specified property of the Item. Returns the latest version if it exists, else returns the previous value if the item was deleted
Declaration
public override object GetValue(string propName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
System.Object | The value of the specified property of the Item. Returns the latest version if it exists, else returns the previous value if the item was deleted |
Overrides
GetValue<T>(String)
Returns the value of the specified property of the Item. Returns the latest version if it exists, else returns the previous value if the item was deleted
Declaration
public T GetValue<T>(string propName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propName | The name of the property value to return from the item |
Returns
Type | Description |
---|---|
T | The value of the specified property of the Item. Returns the latest version if it exists, else returns the previous value if the item was deleted |
Type Parameters
Name | Description |
---|---|
T | The type of the specified property value |
HasNotifyValueChanged(String)
Returns true if the value of the specified property has changed from the previous version to the current version of the NotifyItem and NotifyOldItem
Declaration
public bool HasNotifyValueChanged(string propName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propName | The name of the property value to see if it has changed between versions |
Returns
Type | Description |
---|---|
System.Boolean | True if the value of the specified property has changed from the previous version to the current version |
HasValueChanged(String)
Returns true if the value of the specified property has changed from the previous version to the current version of the Item and OldItem
Declaration
public bool HasValueChanged(string propName)
Parameters
Type | Name | Description |
---|---|---|
System.String | propName | The name of the property value to see if it has changed between versions |
Returns
Type | Description |
---|---|
System.Boolean | True if the value of the specified property has changed from the previous version to the current version |
NotifyItemAs<T>()
The item that notifies the action to be triggered (NotifyItem) as the correct type
Declaration
public T NotifyItemAs<T>()
Returns
Type | Description |
---|---|
T | The NotifyItem as the correct type |
Type Parameters
Name | Description |
---|---|
T | The type to cast the notification item as |
NotifyOldItemAs<T>()
The previous version of the item that notifies the action to be triggered (NotifyItem) as the correct type
Declaration
public T NotifyOldItemAs<T>()
Returns
Type | Description |
---|---|
T | The NotifyOldItem as the correct type |
Type Parameters
Name | Description |
---|---|
T | The type to cast the notification item as |
OldItemAs<T>()
Declaration
public T OldItemAs<T>()
Returns
Type | Description |
---|---|
T | The previous version of the item as the correct type |
Type Parameters
Name | Description |
---|---|
T | The type the old version should be cast to |