Esempio n. 1
0
        public FlowSettings ToPreviousStep(RequestBase request, int step)
        {
            int count = previousDataStack.Count - step;//step is zero based argument of the nav links

            //Number of items in the back up stack is one more than the number of links
            //e.g if when level == 0 and number items in the stack is 4 we must pop the stack 4 times;

            for (int i = 0; i < count - 1; i++)
            {
                previousDataStack.Pop();
            }

            IDialogHandler handler = BaseDialogHandler.Create(request);

            forwardRepopulateStack.Push(new ViewFieldsListPair {
                View = request.View, Fields = handler.FieldValues
            });                                                             //Get Fields to repopulate current form

            for (int i = 1; i < count - 1; i++)                             //pop one less item from the repopulate stack.  Repopulate stack gets updated on IDialog complete
            {
                forwardRepopulateStack.Push(previousRepopulateStack.Pop()); //get fields for prior forms
            }

            //get backup data for previous form
            ResetValuesOnBackup(previousDataStack.Pop());

            this.Director.ExecuteRulesEngine();

            return(this.GetFlowSettingsOnBackup());
        }
Esempio n. 2
0
        public FlowSettings Next(RequestBase request)
        {
            try
            {
                IDialogHandler handler = BaseDialogHandler.Create(request);
                IEnumerable <ValidationResult> errors = handler.GetErrors(request);
                if (errors.Count() > 0)
                {
                    return(new FlowSettings(handler.GetScreenSettings(request, errors)));
                }

                handler.Complete(this);

                previousRepopulateStack.Push(new ViewFieldsListPair {
                    View = request.View, Fields = handler.FieldValues
                });

                this.Director.ExecuteRulesEngine();

                return(this.GetFlowSettings());
            }
            catch (Exception ex)
            {
                //_logger.LogWarning(0, string.Format("Progress Next {0}", Newtonsoft.Json.JsonConvert.SerializeObject(this.Progress)));
                //this._logger.LogError(ex, ex.Message);
                return(this.GetFlowSettings(ex));
            }
        }
Esempio n. 3
0
        public FlowSettings Next(RequestBase request)
        {
            try
            {
                BaseDialogHandler handler = BaseDialogHandler.Create(request);
                handler.Complete(this, request);
                this.Director.ExecuteRulesEngine();

                return(new FlowSettings
                {
                    ScreenSettings = FlowDataCache.ScreenSettings,
                    NavigationBar = FlowDataCache.NavigationBar,
                    FlowState = ((Director)this.Director).FlowState
                });
            }
            catch (Exception ex)
            {
                _logger.LogWarning(0, string.Format("Progress Next {0}", Newtonsoft.Json.JsonConvert.SerializeObject(this.Progress)));
                this._logger.LogError(ex, ex.Message);
                throw;
            }
        }
Esempio n. 4
0
        public FlowSettings Previous(RequestBase request)
        {
            if (previousDataStack.Count <= 1)
            {
                throw new InvalidOperationException("{81BF4217-F4D2-459E-B842-85E4BC9D59D2}");
            }

            IDialogHandler handler = BaseDialogHandler.Create(request);

            //remove backup data for current form
            previousDataStack.Pop();

            forwardRepopulateStack.Push(new ViewFieldsListPair {
                View = request.View, Fields = handler.FieldValues
            });                                                                                                       //Get Fields to repopulate current form

            //get backup data for previous form
            ResetValuesOnBackup(previousDataStack.Pop());

            this.Director.ExecuteRulesEngine();

            return(this.GetFlowSettingsOnBackup());
        }
        public FlowSettings Next(RequestBase request)
        {
            try
            {
                IDialogHandler handler = BaseDialogHandler.Create(request);
                //temporarily disable server-side validation.
                IEnumerable <ValidationResult> errors = new List <ValidationResult>();//handler.GetErrors(request);
                if (errors.Count() > 0)
                {
                    return(new FlowSettings(handler.GetScreenSettings(request, errors)));
                }

                handler.Complete(this, request);
                this.Director.ExecuteRulesEngine();

                return(this.FlowSettings);
            }
            catch (Exception ex)
            {
                _logger.LogWarning(0, string.Format("Progress Next {0}", Newtonsoft.Json.JsonConvert.SerializeObject(this.Progress)));
                this._logger.LogError(ex, ex.Message);
                return(this.GetFlowSettings(ex));
            }
        }