. Net workflow project display and code sharing (2) workflow engine and. net workflow

Source: Internet
Author: User

. Net workflow project display and code sharing (2) workflow engine and. net workflow

After introducing the Form class, we will introduce the workflow engine, which consists of four classes: process, process step, process instance, and process step instance.

Process type:

1 [Serializable] 2 public class Flow 3 {4 [XmlAttribute] 5 public Guid FlowId {get; set;} 6 [XmlAttribute] 7 public string FlowName {get; set ;} 8 public List <FlowStep> FlowSteps {get; set;} 9 [XmlAttribute] 10 public string FlowCategory {get; set;} 11 [XmlAttribute] 12 public bool Enabled {get; set;} 13 [XmlAttribute] 14 public DateTime CreateDate {get; set;} 15 public Person Creator {get; Set;} 16 17 public DateTime? CanRequestDateStart {get; set;} 18 19 public DateTime? CanRequestDateEnd {get; set;} 20 21 public string CreaterName22 {23 get24 {25 if (Creator! = Null) 26 return Creator. personName; 27 return string. empty; 28} 29} 30 [XmlAttribute] 31 public Guid FormId {get; set;} 32 [XmlAttribute] 33 public string FormName {get; set;} 34 public WorkflowConstant. accessMode {get; set;} 35 [XmlAttribute] 36 public short PeriodTime {get; set;} 37 [XmlAttribute] 38 public string RequestRights {get; set ;} 39 [XmlAttribute] 40 public string RequestGroup {Get; set;} 41 public string AccessModeDesc42 {43 get44 {45 switch (RequestRights) 46 {47 case "-unlimited-": 48 return ""; 49 default: 50 return RequestRights + ":"; 51} 52} 53} 54 55 [XmlAttribute] 56 public string RoleGroups {57 get58 {59 if (! String. isNullOrEmpty (RequestGroup) 60 {61 return string. join (",", RequestGroup. split (','). select (g => g. split ('|') [0]); 62} 63 else64 {65 return string. empty; 66} 67} 68} 69}View Code

Process steps:

1 [Serializable] 2 public class FlowStep 3 {4 [XmlAttribute] 5 public Guid StepId {get; set;} 6 [XmlAttribute] 7 public Guid previusstepid {get; set ;} 8 [XmlAttribute] 9 public Guid NextStepId {get; set;} 10 [XmlAttribute] 11 public int SequenceId {get; set;} 12 [XmlAttribute] 13 public string StepName {get; set;} 14 [XmlAttribute] 15 public string RightGroupTitle {get; set;} 16 public List <Guid> CanWriteFormContolIds {get; set ;} 17 [XmlAttribute] 18 public bool canreturntopreviusstep {get; set;} 19 [XmlAttribute] 20 public bool CanReturnToFirstStep {get; set;} 21 [XmlAttribute] 22 public bool AllowSelectAuditor {get; set;} 23 public WorkflowConstant. counterSignatureMode {get; set;} 24 [XmlAttribute] 25 public bool IsStartStep {get; set ;}26 [XmlAttribute] 27 public bool IsLastStep {get; set ;} 28 [XmlAttribute] 29 public bool CanUploadFile {get; set;} 30 [XmlAttribute] 31 public bool MustUploadFile {get; set;} 32 [XmlAttribute] 33 public int UploadFileCount {get; set;} 34}View Code

Process instance type:

1 [Serializable] 2 public class FlowInstance 3 {4 [XmlAttribute] 5 public Guid FlowInstantId {get; set;} 6 public Flow {get; set ;} 7 8 public List <FlowInstanceStep> FlowStepInstances {get; set;} 9 public Person Creator {get; set;} 10 [XmlAttribute] 11 public DateTime CreateDate {get; set ;} 12 [XmlAttribute] 13 public DateTime LastDealDate {get; set;} 14 [XmlAttribute] 15 public Workflow Constant. signatureStatus FlowStatus {get; set;} 16 17 public string FlowStatusName18 {19 get20 {21 switch (FlowStatus) 22 {23 case WorkflowConstant. signatureStatus. start: 24 return "in progress"; 25 break; 26 case WorkflowConstant. signatureStatus. undeal: 27 return "unprocessed"; 28 break; 29 case WorkflowConstant. signatureStatus. partialPassed: 30 return "partially passed"; 31 break; 32 case WorkflowConstant. signatureStatus. passed: 33 Return "through"; 34 break; 35 case WorkflowConstant. signatureStatus. outDated: 36 return "expired"; 37 break; 38 case WorkflowConstant. signatureStatus. canceled: 39 return "Canceled"; 40 break; 41 case WorkflowConstant. signatureStatus. rejecttopreviusstep: 42 return "back to previous step"; 43 break; 44 case WorkflowConstant. signatureStatus. rejectToFirstStep: 45 return "return first step"; 46 break; 47 case WorkflowConstant. signatureStatus. stopped: 48 retu Rn "stop"; 49 break; 50 case WorkflowConstant. signatureStatus. finish: 51 return "end"; 52 break; 53 default: 54 return string. empty; 55} 56} 57} 58 59 public DateTime? EndDate60 {61 get62 {63 if (Flow! = Null) 64 {65 return CreateDate. AddDays (Flow. PeriodTime); 66} 67 else return null; 68} 69} 70 71 public string CurrentStepDisplayName {get; set;} 72}View Code

Process step instance type:

1 [Serializable] 2 public class FlowInstanceStep 3 {4 [XmlAttribute] 5 public Guid StepInstanceId {get; set;} 6 public List <WorkflowPersonSignature> PersonSignatures {get; set ;} 7 8 public SerializableDictionary <Guid, string> WriteValues {get; set;} 9 10 public FlowStep {get; set;} 11 [XmlAttribute] 12 public DateTime CreateDate {get; set;} 13 [XmlAttribute] 14 public DateTime ProcessDate {get; set;} 15 [XmlAttribute] 16 public WorkflowConstant. signatureStatus StepStatus {get; set;} 17 public List <AttachFile> FileList {get; set;} 18}View Code

 

Set the process and steps. The process instances created in the future are obtained from the process.

This series of Navigation:

 

Related Article

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.