예제 #1
0
        void DoBack(IApplicationContext ctx)
        {
            _history.Pop(); //remove current
            if (_history.Count > 0)
            {
                Step step = _history.Pop();
                InvokeCallback(ctx, WORKFLOW_BACK_EVENT
                               , _currentStep != null ? _currentStep.Name : "null"
                               , step != null ? step.Name : "null");

                OpenScreen(ctx, step, step.Parameters, true);
            }
            else
            {
                InvokeCallback(ctx, WORKFLOW_FINISH_EVENT, WORKFLOW_ROLLBACK_REASON);
                BusinessProcess.TerminateWorkflow(ctx, this, true);
            }
        }
예제 #2
0
        public void InvokeAction(IApplicationContext ctx
                                 , String name
                                 , Dictionary <String, object> parameters
                                 , bool isBackCommand = false)
        {
            try
            {
                if (_currentStep != null)
                {
                    _currentStep.SaveControlsState(ctx.ValueStack.Persistables);
                }

                if (this._currentStep.Actions.ContainsKey(name))
                {
                    Action a = this._currentStep.Actions[name];

                    if (!String.IsNullOrEmpty(a.NextStep))
                    {
                        DoForward(ctx, this._steps[a.NextStep], parameters, isBackCommand);
                        return;
                    }

                    if (!String.IsNullOrEmpty(a.NextWorkflow))
                    {
                        InvokeCallback(ctx, WORKFLOW_PAUSE_EVENT);
                        BusinessProcess.Start(ctx, a.NextWorkflow);
                        return;
                    }

                    BusinessProcess.TerminateWorkflow(ctx, this, false);

                    return;
                }

                if (_globalActions.Contains(name))
                {
                    switch (name)
                    {
                    case "Back":
                        DoBack(ctx);
                        break;

                    case "BackTo":
                        DoBack(ctx, parameters["step"].ToString());
                        break;

                    case "Commit":
                        DoCommit(ctx);
                        break;

                    case "Rollback":
                        DoRollback(ctx);
                        break;
                    }

                    return;
                }

                ActionHandlerEx.Busy = false;
                ActionHandler.Busy   = false;
            }
            catch (Exception e)
            {
                ctx.ValueStack.ExceptionHandler.Handle(e);
            }
        }
예제 #3
0
 void DoRollback(IApplicationContext ctx)
 {
     InvokeCallback(ctx, WORKFLOW_FINISH_EVENT, WORKFLOW_ROLLBACK_REASON);
     ClearState();
     BusinessProcess.TerminateWorkflow(ctx, this, true);
 }
예제 #4
0
 void DoCommit(IApplicationContext ctx)
 {
     InvokeCallback(ctx, WORKFLOW_FINISH_EVENT, WORKFLOW_COMMIT_REASON);
     ClearState();
     BusinessProcess.TerminateWorkflow(ctx, this, false);
 }