Simple workflow Design for WinForm Development Framework (transfer from Wu Huacong blog)

Source: Internet
Author: User

Simple workflow design of WinForm development framework

When it comes to workflow, a lot of people first reaction is that this thing is very deep, and sometimes feel far away from us, indeed perfect workflow design many aspects, and precisely because of the need to balance many aspects, general general workflow is difficult to achieve perfection. Microsoft also offers several versions of the WF framework support, as well as a number of manufacturers that are based on this framework to develop workflow applications.

Previously, because of the project needs, participated in some workflow project development, some of which is based on my simple workflow principle of expansion, including a Guangzhou each county and county use of industry approval business platform, because of their own process processing, interface design, flow and other aspects can be well in line with customer needs, Custom elasticity is good, the disadvantage is not enough common, also need to write the form part of the code.

Because of the business needs, the business is becoming more and more urgent, the company is to adopt a more general workflow framework to organize the current business, so I found a job flow in Guangzhou company, purchased their products, although claims to fully through the background configuration, 0 code to achieve Workflow business form processing, However, due to the customer's design requirements for the form is more, sometimes need to combine some external data interface, process processing also has further needs, this may break their original pattern, resulting in the form design, process configuration and so on, need to buy their engineers on-site services, To further improve the content of the whole project, resulting in a slow progress of the whole project, encountered acclimatized situation.

So feel that a workflow module, called again strong, if not well combined with the project application, even if the 0 code of the functional configuration, may also put you in an awkward situation, because through the configuration, may be easily implemented in the code of the form function, to pass 0 code configuration, the time spent more difficult to grasp, Because 0 of the code comes at a cost, you need to take advantage of their APIs, their business objects, and sometimes a lot of twists and turns, all of which can be very deadly weaknesses.

1. Design model of Simple workflow

In the absence of a third-party workflow module, a simple workflow is a semi-modular process engine built using a collaborative relationship between the database and the business object, which can be integrated into the project code for better integration to implement the relevant functions of the workflow.

First we know that we create any document in office, there is a concept of a template, so that we can easily take advantage of some out-of-the-box data and layout, the workflow is the same, there is a process template concept, as shown below.

Each process template, in itself, then pre-defines a series of processes to be handled differently within the process instance, so the process template also contains multiple process step objects whose relationships are composed as follows.

Each process instance, in addition to their own process data and field information, has itself a form design problem, such as fee approval, which may contain filled-in expense list data, and so on, so the process instance should also contain the business Form object for the process.

In this way they form a complete process business object relationship, as shown below.

2, process approval of the operation

For a process processing operation, we know that generally there is approval, rejection, return to a step, forwarded to the internal reading, reading, and including the drafters can revoke the form, and so on, of course, if there are some specific business, there may be some process of processing to operate, but basically can be attributed to the above several, It's just that the data they're dealing with each step is different. So the procedure for approving the steps is categorized as follows.

These operations can be implemented through the encapsulation of some interface operations, because they are basically generic, we pass in some of the process ID and other related identifiers, we can hand over to these standard interface completed.

If the approval interface is shown below, it contains a collection of functions such as passing, rejecting, jumping back to a step, adding steps, and so on.

The above interface is the approval process, for a process to implement the actions of the staff, and sometimes we may need to do a step for more than one process, such as the transfer to the internal staff for the read operation, then should be selected to deal with a number of people, the approximate processing interface effect is as follows.

Of course, if the applicant's application form is wrong and needs to be revoked, then also should have this action, after the withdrawal form, you can re-fill the form, and then submit the process again.

3. Process approval Form processing

In the form of dynamic design and display, there has been no good ideas, so I think the process module as a semi-modular can be part of the interface through the code to compile the way to integrate, so the form of filling, Form view to do the user control inside, and then in the interface reference can be.

As the following form filling interface is shown below, for different process forms, add a form's fill-in interface and save operation to the project.

To view and process the form operations, we can first make a view of the form information interface, and then the integration process of the processing toolbar, combined into a view, processing operations integrated process operations.

Of course, if you can have a dynamic design of the form, and then seamless integration of course more perfect, but such a operation, the interface design will not be very cumbersome, general developers are competent, so for other process forms, according to gourd painting scoop can be completed different forms.

And the inside of the toolbar code can be manipulated, although it may be integrated with different business processing, but we are still working on the dynamic processing, the code is as follows.

        PrivatevoidInittoolbar () {//If the process is revocable and the form status is in process, then the undo action can be usedbool Maycancel = Bllfactory<appapply>. Instance.isapplymaycancel (Applyid,Base. Loginuserinfo.id);This. btncancel.tovisibility (Maycancel);//Can be returned for re-editingbool Maybacktoedit = Bllfactory<appapply>. Instance.isapplymaybackedit (Applyid,Base. Loginuserinfo.id);This. btnedit.tovisibility (Maybacktoedit);//Determine if you need to display read statusbool Isreadstatus = Bllfactory<applyread>. Instance.isreadsatus (Applyid,Base. Loginuserinfo.id);This. btnread.tovisibility (Isreadstatus);//Hide Approval button if not current approverBOOL CanDeal = BLLFACTORY&LT;BLL. Applyuser>. Instance.ischeckpermission (Applyid,Base. Loginuserinfo.id);If(CanDeal) {Applyflowinfo Flowinfo = bllfactory<applyflow>. Instance.getfirstunhandledflow (Applyid);if (flowinfo! =Null) {String proctypename = bllfactory<appproc>new Barbuttonitem (); button. Caption = proctypename; button. Name = proctypename; button. Tag = Flowinfo; // Bind the process content button. ImageIndex = 33 baritempaintstyle.captionglyph; button. ItemClick + = new Itemclickeventhandler (button_ ItemClick); this.bar1. AddItem (button); } } }

The above for the process step processing, to a separate button event to judge processing, according to the different business step name for different processing, so that can be very good control processing.

Simple workflow Design for WinForm Development Framework (transfer from Wu Huacong blog)

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.