Example #1
0
 private void SaveRecursiely(WorkflowJob wfJob, Func <WorkflowJob, int> saveJob, Dictionary <Guid, int> savedIds)
 {
     foreach (var job in wfJob.NextJobs)
     {
         SaveRecursiely(job, saveJob, savedIds);
     }
     wfJob.QueueJob.NextJobs = SaveJobs(wfJob.NextJobs, saveJob, savedIds).ToList();
 }
Example #2
0
 public WorkflowJob ContinueWith(WorkflowJob workflowJob)
 {
     if (this.TempId == workflowJob.TempId)
     {
         throw new Exception("Job cannot continue with it self!");
     }
     this.NextJobs.Add(workflowJob);
     return(this);
 }
Example #3
0
        public Workflow(WorkflowJob workflowJob)
        {
            this.RootWorkflowJob = workflowJob;

            GetAllJobs().ForEach(t =>
            {
                t.QueueJob.WorkflowId = this.WorkflowId;
            });
        }
Example #4
0
 public WorkflowJobGroup ContinueWith(WorkflowJob workflowJob)
 {
     foreach (var job in this.Jobs)
     {
         if (job.TempId == workflowJob.TempId)
         {
             throw new Exception("Job cannot continue with it self!");
         }
         job.NextJobs.Add(workflowJob);
     }
     return(this);
 }
Example #5
0
 private IEnumerable <WorkflowJob> GetJobsRecursively(WorkflowJob wf, HashSet <Guid> enumeratedIds)
 {
     if (wf.NextJobs.Any())
     {
         foreach (var item in wf.NextJobs.Where(t => !enumeratedIds.Contains(t.TempId)))
         {
             foreach (var resultedJob in GetJobsRecursively(item, enumeratedIds).ToList())
             {
                 enumeratedIds.Add(resultedJob.TempId);
                 yield return(resultedJob);
             }
         }
     }
     enumeratedIds.Add(wf.TempId);
     yield return(wf);
 }
Example #6
0
 public Workflow(WorkflowJob rootWorkflowJob, WorkflowJobGroup rootWorkflowJobGroup)
 {
     if (rootWorkflowJob != null)
     {
         this.RootWorkflowJob = rootWorkflowJob;
     }
     else if (rootWorkflowJobGroup != null)
     {
         this.RootWorkflowJobGroup = rootWorkflowJobGroup;
     }
     else
     {
         throw new Exception("Root Workflow job or Workflow group not set!");
     }
     GetAllJobs().ForEach(t =>
     {
         t.QueueJob.WorkflowId = this.WorkflowId;
     });
 }