Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Fail.cs
1using System.Threading.Tasks;
2using System.Xml;
5
7{
11 public class Fail : ActionNode
12 {
13 private Reason reason;
14
18 public Fail()
19 : base()
20 {
21 }
22
26 public override string LocalName => nameof(Fail);
27
32 public override IStateMachineNode Create()
33 {
34 return new Fail();
35 }
36
41 public override async Task Parse(XmlElement Xml)
42 {
43 await base.Parse(Xml);
44
45 this.ConvertValueAttributeToElement<Reason>(Xml, true);
46 }
47
51 protected override void OnChildNodesUpdated()
52 {
53 base.OnChildNodesUpdated();
54
55 this.reason = this.GetValueElement<Reason>();
56 }
57
62 public override async Task Execute(EvaluationArguments Arguments)
63 {
64 Contract Contract = await Arguments.Legal.GetContract(Arguments.Token?.CreationContract ?? Arguments.Machine.DefinitionContractId);
65 string Reason = (await this.reason.Evaluate(Arguments))?.ToString();
66
67 Arguments.Profiler?.Event(Reason);
68
69 await StateMachine.GoToState(string.Empty, Arguments);
70 await NeuroFeaturesProcessor.RejectContract(Contract, false, Reason, true, Arguments.Legal, Arguments.EDaler);
71
72 Arguments.Profiler?.Stop();
73 }
74 }
75}
Marketplace processor, brokering sales of items via tenders and offers defined in smart contracts.
CaseInsensitiveString CreationContract
ID of contract that details the creation of the token.
Definition: Token.cs:267
Abstract base class for State-Machine action nodes.
Definition: ActionNode.cs:9
Fail the contract used to create the token, associated with the state-machine.
Definition: Fail.cs:12
override IStateMachineNode Create()
Creates a new node of the corresponding type.
Definition: Fail.cs:32
override async Task Execute(EvaluationArguments Arguments)
Evaluates the action node
Definition: Fail.cs:62
override async Task Parse(XmlElement Xml)
Parses the State-machine node.
Definition: Fail.cs:41
Fail()
Fail the contract used to create the token, associated with the state-machine.
Definition: Fail.cs:18
override void OnChildNodesUpdated()
Method called whenever ChildNodes is updated.
Definition: Fail.cs:51
Contains information required for evaluating script in a state-machine.
StateMachine Machine
Reference to state-machine definition.
Task< object > Evaluate(EvaluationArguments Arguments)
Evaluates the value node.
Definition: Value.cs:146
Class representing a state machine.
Definition: StateMachine.cs:37
static async Task GoToState(string StateId, EvaluationArguments Arguments)
Goes to a new state.
CaseInsensitiveString DefinitionContractId
ID of Definition Contract
Definition: StateMachine.cs:76