Click here to Skip to main content
15,888,325 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi friends can any one give me idea about the unlock the activity in workflow when its locked..? we have to create one custom method for that but i don't know how to do that and my code is

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();

            }

        }


please try to give me your valuable suggestions
Thank you
Posted
Updated 9-Jun-14 20:52pm
v4
Comments
Suvabrata Roy 10-Jun-14 2:54am    
What is you requirement a piece of code is not enough to understand.
Sharath.Mitte 10-Jun-14 3:05am    
Hi Roy,
thanks for your reply..when am executing the workflow for example assume that i have 3 activities first one is capture claim and next is verify that claim and approve the claim, if i have completed the first activity the next action will be updated like as Verify the claim so am executing that flow, if any error occurred like disconnecting the internet that time my activity is getting locked state, so i have to unlock that one and continue the next actions

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900