Exemplo n.º 1
0
        public IContainerStepBuilder <TData, Recur, TStepBody> Recur(Expression <Func <TData, TimeSpan> > interval, Expression <Func <TData, bool> > until)
        {
            var newStep = new CancellableStep <Recur, TData>(until);
            Expression <Func <Recur, TimeSpan> > intervalExpr = (x => x.Interval);
            Expression <Func <Recur, bool> >     untilExpr    = (x => x.StopCondition);

            newStep.Inputs.Add(new DataMapping()
            {
                Source = interval, Target = intervalExpr
            });
            newStep.Inputs.Add(new DataMapping()
            {
                Source = until, Target = untilExpr
            });

            WorkflowBuilder.AddStep(newStep);
            var stepBuilder = new ReturnStepBuilder <TData, Recur, TStepBody>(WorkflowBuilder, newStep, this);

            Step.Outcomes.Add(new StepOutcome()
            {
                NextStep = newStep.Id
            });

            return(stepBuilder);
        }
Exemplo n.º 2
0
        public IStepBuilder <TData, WaitFor> WaitFor(string eventName, Expression <Func <TData, IStepExecutionContext, string> > eventKey, Expression <Func <TData, DateTime> > effectiveDate = null, Expression <Func <TData, bool> > cancelCondition = null)
        {
            WorkflowStep <WaitFor> newStep;

            if (cancelCondition != null)
            {
                newStep = new CancellableStep <WaitFor, TData>(cancelCondition);
            }
            else
            {
                newStep = new WorkflowStep <WaitFor>();
            }

            WorkflowBuilder.AddStep(newStep);
            var stepBuilder = new StepBuilder <TData, WaitFor>(WorkflowBuilder, newStep);

            stepBuilder.Input((step) => step.EventName, (data) => eventName);
            stepBuilder.Input((step) => step.EventKey, eventKey);

            if (effectiveDate != null)
            {
                stepBuilder.Input((step) => step.EffectiveDate, effectiveDate);
            }

            Step.Outcomes.Add(new StepOutcome()
            {
                NextStep = newStep.Id
            });
            return(stepBuilder);
        }