Today, we use k2.net 2003 to design a process.
In k2.net 2003, the process design tool is k2.net 2003 studio, which is a graphical process development, design, and deployment environment. K2.net 2003 studio organizes processes in the same way as Visual Studio. NET 2003. It also consists of solution and project, followed by process. K2.net 2003 studio can only open one solution at a time, but can open multiple projects at a time.
Now we can simulate a procurement application process.
- A user in an enterprise wants to apply for an item. He opens the web form of the procurement application and fill in the relevant application information, such as the type of the item to be purchased (software, hardware, publications, and services ). Click Submit in the form;
- After the form is submitted, the K2 process starts to flow. First, the K2 server determines the item type. If it is software or hardware, the application form will be sent to the IT department. If it is another category, the application form will be sent directly to the applicant's manager for approval;
- After receiving the application, the IT department first checks whether the applied item is in stock. The related task executor will go to the worklist of his k2.net workspace to execute the task. If there is inventory, there is no need to purchase, the purchase application is rejected, the process is stopped, and the applicant will receive a notification email. If there is no inventory, the process will go down to the applicant's manager for approval;
- After receiving the application, the applicant's manager enters the worklist for approval. You can select to agree or reject the request from the web form, and enter the reason for rejection. At the same time, the K2 server will send an email of consent or rejection to the applicant. The process ends here.
The following describes how to design this process in K2 studio.
Step 1: Create a process solution, project, and process
- open k2.net studio and create a solution. Select the solution path and enter the solution name: IT department solution. The name extension of K2 solution is. ksn. Right-click the new solution and choose add new project. In the displayed window, enter the Project name: IT department project, and select the script language (VB. NET or C #) used by the project #).
- k2 studio automatically creates three folders for the new project: Processes, code modules, and destination queues. The name extension of K2 project is. kpj.
- right-click the process folder and choose add new process. In the displayed window, enter the name of the process: it procurement process. K2 studio automatically opens the new process.
- right-click an IT department project and choose Properties. On the left of the displayed window, select export server, click Add, and enter the name of K2 server. Tip: Right-click K2 project or K2 process and select Properties to set them separately. Including:
- K2 project:
- Name: The name of K2 project;
- Description Description: Description of K2 project;
- Working hours working time: Set the default working time of K2 project;
- Export servers: Set the K2 server exported from K2 project;
- References reference: Add references to other. Net assemblies, COM objects, and Web services;
- Import imports: import other namespaces;
- K2 process:
- Name: The name of K2 process;
- Description Description: The description of K2 process;
- Priority priority: defines the priority of a process, such as high, medium, or low. You can use the priority attribute to filter the worklist;
- Expected duration estimated duration: defines the expected duration of the process. If the expected duration is exceeded, all process threads will be highlighted;
- Working hours work time: defines the work time of a process. You can select the work time to inherit from the upper-level project, or define the specific work time of the process;
- Data fields data field: used to define variables in the process-wide;
- XML fields XML field: used to define XML fields within the process range (process-wide;
- Exceptions exception: used to specify how the k2.net 2003 server records exception errors when the process fails.
Step 2: Design Process
-
- As shown in, drag and drop five default-type activities on the canvas. Double-click each activity to name the activity.
-
- Drag an activity of the default client type to the "IT manager approval" and "department manager approval" nodes, double-click the default client, and name it "Approval interface ", right-click the "Approval interface", choose "properties"> "event item", cancel "client side code", select "Internet", and enter the URL address: http: // server name/demo/itmgrapproval. aspx and http: // server name/demo/deptmgrapproval. and name it aspx: Approval page.
-
- Drag and Drop a server mail object to "IT manager reject". The system automatically starts the mail wizard, as shown in. After the Wizard is complete, name the server mail as "Notification Mail ".
-
- Right-click the "Notification Email" created in the previous step, select "copy", and paste it to the "department manager rejection" node; right-click the newly copied "Notification Email" and select "Run template" to modify the email content.
-
- Repeat the previous operation and add an email notification on the "department manager consent" node. As follows:
-
- Select the correct line shape to connect each activity node. Double-click each line to add remarks. Tip: you can move the remarks text of line.
-
- Define rules for each line. For example, right-click the line between "start" and "IT manager approval", select "properties", and click "add". The following definitions are made in the pop-up window.
- After defining the line business rules, define the task executors of the "IT manager approval" and "department manager approval" nodes. For example, right-click the "IT manager approval" node, select "properties"> "Destination rule", and select a task executor from ad, and drag it to the window on the right.
-
- Compilation process: At this time, the process design is basically completed. You can click "Tools"> "compile" to compile the process. If the process design is incorrect, K2 will prompt the cause and location of the error.
-
- Export Process: click "project"> "Export" to release the designed process to the K2 server.
-
- Assign process permissions: Open K2 Service Manager, find the released Process, and click "users" or "groups" to assign permissions.
Step 3: Design Process Form
- Open Visual Studio. NET 2003 and create a new web project.
- Add a k2smartform item to the project, for example:
- Open the Web. config file, move it to the end of the file, and add K2 Server:
- Open the created request. aspx and perform the following settings. pagetype must be set to planpage:
- Put several k2.net smartform controls on request. aspx and set the data of each control. Set the "Submit" button property to planbutton. For example:
- Add the other two K2 smartform: itmgrapproval. aspx and deptmgrapproval. aspx. Design the page and bind the control fields. Note that the pagetype of the two pages must be set to clientpage, And the submit button must be set to finishbutton. Then, set the activity to the "Approval interface" under the corresponding node ".
- After the check is correct, the project is generated.
Now, the process is designed. Next time, let's take a look at how to test and run the designed process.