Exemple #1
0
        public IStepBuilder <TData, Activity> Activity(string activityName, Expression <Func <TData, object> > parameters = null, Expression <Func <TData, DateTime> > effectiveDate = null, Expression <Func <TData, bool> > cancelCondition = null)
        {
            var newStep = new WorkflowStep <Activity>();

            newStep.CancelCondition = cancelCondition;

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

            stepBuilder.Input((step) => step.ActivityName, (data) => activityName);

            if (parameters != null)
            {
                stepBuilder.Input((step) => step.Parameters, parameters);
            }

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

            Step.Outcomes.Add(new StepOutcome()
            {
                NextStep = newStep.Id
            });
            return(stepBuilder);
        }
Exemple #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);
        }
Exemple #3
0
        public IStepBuilder <TData, TStepBody> CompensateWith(Action <IStepExecutionContext> body)
        {
            var newStep = new WorkflowStep <ActionStepBody>();

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

            stepBuilder.Input(x => x.Body, x => body);
            Step.CompensationStepId = newStep.Id;
            return(this);
        }
Exemple #4
0
        public IStepBuilder <TData, WaitFor> WaitFor(string eventName, Expression <Func <TData, IStepExecutionContext, string> > eventKey, Expression <Func <TData, DateTime> > effectiveDate = null)
        {
            var 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);
        }
        public IStepBuilder <TData, ActionStepBody> Then(Action <IStepExecutionContext> body)
        {
            var newStep = new WorkflowStep <ActionStepBody>();

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

            stepBuilder.Input(x => x.Body, x => body);
            Step.Outcomes.Add(new ValueOutcome {
                NextStep = newStep.Id
            });
            return(stepBuilder);
        }
        public IStepBuilder <TData, WaitFor> WaitFor(string eventName, Expression <Func <TData, string> > eventKey, Expression <Func <TData, DateTime> > effectiveDate = null, Expression <Func <TData, bool> > cancelCondition = null)
        {
            var newStep = new WorkflowStep <WaitFor>();

            newStep.CancelCondition = cancelCondition;

            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 ValueOutcome {
                NextStep = newStep.Id
            });
            return(stepBuilder);
        }