Wf4.0 practice (I): Document approval process

Source: Internet
Author: User

This use case combines many features of wf4.0 and WCF. The two technologies are used to approve a document. Includes a client applicationProgramIt submits and approves documents. The approval process management application facilitates communication between clients and executes the approval procedure rules. There are three types of approval workflows in this case:

1. A simple approval process
2. A quorum Approval process
3. A complicated approval process

The architecture diagram is as follows:

 

First, I will simulate a complicated approval process on a computer.

1. on a PC, I first start the server and then start four clients, as shown in:

 

2. Apply for a user

3. User A starts a complicated process

4. B and c receive approval tasks at the same time

5. After B and C agree, the task will arrive at D.

6. After processing D, the process is complete.

 

From the client perspective, the approval process has the following functions:

1. You can apply for a user on the client.

2. The client's WCF calls the server's WCF Service.

3. A Unique User ID is returned to the client before the user can start an approval process.

4. The client can initiate an approval file for a simple, quorum, or complex approval process.

5. After the approval button is clicked on the client interface, start a workflow instance in the client workflow service host.

6. A workflow sends an approval request to the server.

7. The server also starts a workflow to respond to the approval process.

8. Once the server-side approval workflow is executed, the result is sent back to the client.

9. Result displayed on the client.

10. The client will receive an approval request and can respond to the approval request at any time.

11. The client-side WCF Service can receive approval requests from the server.

12. Present the reviewed documents and materials.

13. You can approve or reject this document.

14. The WCF client sends a response to the server.

From the server point of view, the approval procedure functions are as follows:

1. The client requests to participate in the approval process.

2. The server's WCF Service can accept client requests
3. Generate a unique ID for the client. Store user information in the database.
4. The unique ID is sent back to the user.

5. Accept the approval request and execute the approval process

6. receive a request for approval to start a new workflow.

7. Different workflow activities are executed based on the request type (simple, quorum, or complex.

8. Related sending and receiving activities are used to send a request approval review to the client and wait for receiving a response.

9. The results of the approved workflow are sent to the client.

Server implementation:

1. As shown in the server project, approvalmanager is used to start the service. Approvalmanageractivitylibrary contains the defined workflow template. Approvalmessagecontractlibrary is a data contract. Trackinglibrary is used for tracking.

2. The core of the service is approvalmanageractivitylibrary. Use the correlation activity to define three processes.

The client defines a clientrequestapprovalworkflow workflow:

 

Summary: this is an official example of Microsoft, which is tedious to write.

Sample download

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.