continue workflow.....
hi everyone
I work on a project. In the project, workers fill a form and the filled forms go to the manager for approval. How can I do the followings:
Manager presses the link<<waiting for approval>>(on windows form project)and comes the list:
name surname request
aaaa bbbbbbb xxxxxxxx<<approve>> <<reject>>
cccc ddddd yyyyyyyy<< approve>> <<reject>>
when the manager click a link (approve or reject) the workflow instance continue with other processes.
1)Can I achieve (continuation of workflow after manager response) this by only taking the instance id from database?
2) Please can you give me underlying code of the links?
3) Is persistenceService mandatory for this application?
many thanks
[1036 byte] By [
madenci] at [2007-12-24]
1°yes ; when you workflow if waiting for an approval or rejection event, it can be persisted; you can retrieve the persisted workflow id from the db and reanimate them by sending an event.
2°you need something like this (see below), and the click event will call the FireApprovalReject function.
3°Not mandatory , but it's better if it's a long period running workflow : see above 1°
Code :
[Serializable]
public class ApproveRejectEventArgs : ExternalDataEventArgs
{
public ApproveRejectEventArgs(Guid guid, bool approve)
: base(guid)
{
}
}
[ExternalDataExchange]
interface IApproveReject
{
event EventHandler<ApproveRejectEventArgs> ApproveOrReject;
}
class MyService : IApproveReject
{
public event EventHandler<ApproveRejectEventArgs> ApproveOrReject;
public void FireApprovalReject(bool approve, Guid workflowId)
{
if (ApproveOrReject != null)
{
ApproveRejectEventArgs evt = new ApproveRejectEventArgs(workflowId, approve);
ApproveOrReject(this, evt);
}
}
}
}