Example #1
0
 public static void Next(FlowProcess flow, FlowTask nexTask = null)
 {
     if (flow == null)
     {
         throw new ArgumentNullException("flow");
     }
     if (nexTask == null)
     {
         flow.Status = (int)FlowStatus.Complete;
         flow.CompleteTime = flow.SetupTime;
         flow.CurrentHandleUrl = string.Empty;
         flow.CurrentTaskSection = string.Empty;
         flow.CurrentHandler = null;
     }
     else
     {
         flow.Status = (int)FlowStatus.Processing;
         flow.CurrentHandleUrl = nexTask.HandleUrl;
         flow.CurrentTaskSection = nexTask.SectionName;
         flow.CurrentHandler = nexTask.Handler;
     }
 }
Example #2
0
 public static FlowTask CreateHandlingTask(FlowProcess process, SecurityUser handler, string taskName)
 {
     if (process == null)
     {
         throw new ArgumentNullException("process");
     }
     if (handler == null)
     {
         throw new ArgumentNullException("handler");
     }
     if (process.CurrentHandler.UserName != handler.UserName)
     {
         throw new ErrorException("HandlerNoRight");
     }
     if (string.IsNullOrWhiteSpace(taskName))
     {
         throw new ArgumentNullException("taskName");
     }
     return new FlowTask
     {
         FlowProcess = process,
         SectionName = process.CurrentTaskSection,
         Handler = process.CurrentHandler,
         HandleUrl = process.CurrentHandleUrl,
         HandleTime = DateTime.Now,
         Name = taskName
     };
 }
Example #3
0
 public static FlowProcess CreateProcess(FlowTask firstTask, FlowTask nexTask, string flowName)
 {
     if (firstTask == null)
     {
         throw new ArgumentNullException("firstTask");
     }
     if (string.IsNullOrWhiteSpace(flowName))
     {
         throw new ArgumentNullException("flowName");
     }
     FlowProcess flow = new FlowProcess
     {
         Name = flowName,
         SetupTime = DateTime.Now
     };
     if (nexTask == null)
     {
         flow.Status = (int)FlowStatus.Complete;
         flow.CompleteTime = flow.SetupTime;
     }
     else
     {
         flow.Status = (int)FlowStatus.Start;
         flow.CurrentHandleUrl = nexTask.HandleUrl;
         flow.CurrentTaskSection = nexTask.SectionName;
         flow.CurrentHandler = nexTask.Handler;
         nexTask.FlowProcess = flow;
     }
     firstTask.HandleTime = flow.SetupTime;
     firstTask.FlowProcess = flow;
     return flow;
 }