The following are examples of implemented methods for secondary development by customer technical personnel.

  1. Local Programs

Enter the parameter name in the Argument List item. Multiple parameters are separated by commas. If there is no parameter, it can be left blank. Enter the class name and namespace to be called locally in the Expression item.

The following is an example of a local method implementation:

/// <summary>

/// Order submission service class (corresponding to the order submission node in the order process)

/// </summary>

public class OrderSubmitService : ExternalServiceBase, IExternalService

{

/// <summary>

/// Business logic pre-call method

/// </summary>

public override void Execute()

{

//Implement your own business logic

var id = DelegateService.GetID();

var amount = DelegateService.GetVariable("amount");

DoSomethingElse(amount, 20);

}

 

/// <summary>

/// Specific implementation method of business logic

/// </summary>

/// <param name="amount"></param>

/// <param name="newAmount"></param>

private void DoSomethingElse(string amount, int newAmount)

{

var intAmount = 0;

int.TryParse(amount, out intAmount);

 

if (intAmount < newAmount)

{

DelegateService.SetVariable("amount", newAmount.ToString());

}

 

//Call other business processing logic

var session = DelegateService.GetSession();

//Implement other database business logic

//.............................

}

}

During the execution of the engine flow, when the node is parsed to have an Action definition that calls an external event, the reflection method will be used to find out whether the component has an OrderSubmitService class, and whether it is a service class that implements the ExtneralServiceBase and IExternalService interfaces, so that the Execute() method can be executed. It must meet the above-mentioned search base class inheritance and interface implementation conditions to be reflected and executed, otherwise it cannot be executed. This ensures that the clearly defined event program code is executed.

  1. WebApi

Http request method, supports Get, Post, Put, Delete methods         

Step 1: Event definition on node attributes

Step 2: Process variable definition

Write process variables (WfProcessVariable) through the WorkflowService interface. The variables are used to pass the parameters of the WebApi method. Here is an example:

Step 3: Example of implementing the interface method of the called WebApi program

            The above example has two parameters: runner and role. In the WebApi method code, you can use JSON format data as the receiver and then perform serialization processing accordingly.

IMG_256


  1. CSharpLibrary

In the node binding event, you can use the C# class library, as shown below:


  1. Stored Procedures

A stored procedure is a program procedure defined by the database that contains SQL script syntax (for example, saving the above SQL script separately as a stored procedure), which is limited to the same database instance by default.