WorkflowApplication app = new WorkflowApplication(new InsuredMemberWorkFlow.CreatePatient()); AutoResetEvent instanceUnloaded = new AutoResetEvent(false); InstanceStore store = new SqlWorkflowInstanceStore(ConfigurationManager.ConnectionStrings["workflowDB"].ConnectionString); InstanceHandle handle = store.CreateInstanceHandle(); var deleteOwnerCmd = new DeleteWorkflowOwnerCommand(); handle.Free(); app.InstanceStore = store; app.PersistableIdle = (e) => { return PersistableIdleAction.Unload; }; app.Idle = (e) => { instanceUnloaded.Set(); }; app.Unloaded = (e) => { instanceUnloaded.Set(); }; app.Completed = (e) => { // ShowHideButtons(); }; //Tracking Code var fileTrackingProfile = new TrackingProfile(); fileTrackingProfile.Queries.Add(new WorkflowInstanceQuery { States = { "*" } }); fileTrackingProfile.Queries.Add(new ActivityStateQuery() { ActivityName = "*", States = { "*" }, Variables = { "*" } }); fileTrackingProfile.Queries.Add(new CustomTrackingQuery() { ActivityName = "*", Name = "*" }); var fileTrackingParticipant = new FileTrackingParticipant { TrackingProfile = fileTrackingProfile }; app.Extensions.Add(fileTrackingParticipant); //---End Tracking code if (objPatient.WorkFlowId == Guid.Empty) { id = app.Id; // Run the workflow. app.Run(); objPatient.WorkFlowId = app.Id; app.ResumeBookmark("SubmitClaimBookmark", objPatient); Session["Action"] = "SC"; } else if (objPatient.WorkFlowId != null) { app.Load(objPatient.WorkFlowId); if (objPatient.NextAction == "Submit Claim") { app.ResumeBookmark("SubmitClaimBookmark", objPatient); Session["Action"] = "SC"; } else if (objPatient.NextAction == "Verify Claim") { app.ResumeBookmark("VerifyClaimBookmark", objPatient); Session["Action"] = "VC"; } instanceUnloaded.WaitOne(); // Wait for the workflow to go idle before gathering // the user's input. string AC = Session["Action"].ToString(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)