Sharath Quad

Sharath Quad

  • NA
  • 9
  • 4.3k

How to Unlock the locked record and how to continue windows

Jun 10 2014 3:30 AM
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);
//setup persistence
// InstanceStore store = new SqlWorkflowInstanceStore(@"Data Source=.;Initial Catalog=workflowDB;User ID=sa;Password=$a");
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();
 
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