protected void btnSubmit_Click(object sender, EventArgs e) { ReviewUseCarApplyForm form = new ReviewUseCarApplyForm(); if (rbtOK.Checked) { form.Agree = 1; } else { form.Agree = 3; } form.UseCarApplyFormID = int.Parse(this.LblID.Text.ToString()); form.ReviewUserName = this.txtYName.Text.ToString(); if (int.Parse(Session["IDsdfsdf"].ToString()) == 6) { UseCarWorkFlowProcess.RunRenewInstance(Guid.Parse(this.lblQC.Text.ToString()), form); } else { UseCarWorkFlowProcess.RunReviewApply(Guid.Parse(this.lblQC.Text.ToString()), form); } lbMsg.Text = "提交成功!"; this.btnSubmit.Visible = false; gvDataBind(); Session["IDsdfsdf"] = null; }
public static void RunReviewApply(Guid id, ReviewUseCarApplyForm Form) { SqlWorkflowInstanceStore instanceStore = new SqlWorkflowInstanceStore(@"server=.\SQLEXPRESS;database=aspnetdb;uid=sa;pwd=123456"); WorkflowApplication application2 = new WorkflowApplication(new UseCarApply()); application2.InstanceStore = instanceStore; application2.Completed = (workflowApplicationCompletedEventArgs) => { Console.WriteLine("\nWorkflowApplication has Completed in the {0} state.", workflowApplicationCompletedEventArgs.CompletionState); instanceUnloaded.Set(); }; application2.PersistableIdle = (e) => { instanceUnloaded.Set(); return PersistableIdleAction.Unload; }; application2.Unloaded = (workflowApplicationEventArgs) => { Console.WriteLine("WorkflowApplication has Unloaded\n"); instanceUnloaded.Set(); }; application2.Load(id); application2.ResumeBookmark("WaitForExamine", Form); instanceUnloaded.WaitOne(); Console.ReadLine(); }