namespace RuleExample
{
public workflow Tasks()
{
private List taskList;
public bool Completed
{
get;
private set;
}
// constructor
public Tasks(List taskList)
{
this.Completed = false;
this.taskList = taskList;
}
// MyRule is invoked whenever 'TaskList' changes or
// whenever a workflow in the 'TaskList' collection changes value.
rule MyRule()
{
// check all 'Task's (workflows) in the collection 'TaskList'
foreach(Task f in this.TaskList)
{
if(!f.IsCompleted)
{
//if a single task is not completed
this.IsAllTasksCompleted = false;
return;
}
}
// tasks must be completed
this.IsAllTasksCompleted = true;
}
}
}