public override bool Validate()
        {
            var stepToken = GetBinding <FormWizardStepEntityToken>("BoundToken");
            var stepName  = GetBinding <string>("StepName");

            if (stepName == stepToken.StepName)
            {
                return(true);
            }

            if (!FormFieldModel.IsValidName(stepName))
            {
                ShowFieldMessage("StepName", "Step name is invalid, only a-z and 0-9 is allowed");

                return(false);
            }

            var wizard = DynamicWizardsFacade.GetWizard(stepToken.WizardName);

            var step = wizard.Model.Steps.SingleOrDefault(s => s.Name == stepName);

            if (step == null)
            {
                return(true);
            }

            ShowFieldMessage("StepName", "Step name already exists");

            return(false);
        }
Beispiel #2
0
        public override void OnFinish(object sender, EventArgs e)
        {
            var folderToken = (FormFolderEntityToken)EntityToken;
            var stepName    = GetBinding <string>("StepName");
            var formName    = GetBinding <string>("FormName");

            var wizard = DynamicWizardsFacade.GetWizard(folderToken.FormName);
            var step   = new WizardStepModel
            {
                Name          = stepName,
                FormName      = formName,
                Label         = stepName,
                LocalOrdering = wizard.Model.Steps.Count + 1
            };

            wizard.Model.Steps.Add(step);

            DynamicWizardsFacade.SaveWizard(wizard);

            var wizardStepToken = new FormWizardStepEntityToken(wizard.Name, step.Name);
            var workflowToken   = new WorkflowActionToken(typeof(EditWizardStepWorkflow));

            CreateAddNewTreeRefresher(EntityToken).PostRefreshMessages(wizardStepToken);
            ExecuteAction(wizardStepToken, workflowToken);
        }
        public override void Submit()
        {
            var def = DynamicWizardsFacade.GetWizard(ModelInstance.Name);

            foreach (var handler in def.SubmitHandlers)
            {
                handler.Submit(ModelInstance);
            }

            base.Submit();
        }
        public static void UpdateOrder(string wizardName, string consoleId, string entityToken, string serializedOrder)
        {
            var def = DynamicWizardsFacade.GetWizard(wizardName);

            UpdateOrder(def, serializedOrder);

            var serializedEntityToken = HttpUtility.UrlDecode(entityToken);

            if (!String.IsNullOrEmpty(serializedEntityToken))
            {
                UpdateParents(serializedEntityToken, consoleId);
            }
        }
        private static void UpdateOrder(DynamicWizardDefinition def, string serializedOrder)
        {
            var newOrder = ParseNewOrder(serializedOrder);
            var tmpList  = newOrder.OrderBy(i => i.Value).Select(itm => def.Model.Steps.Single(f => f.Name == itm.Key)).ToList();

            def.Model.Steps.Clear();

            foreach (var s in tmpList)
            {
                def.Model.Steps.Add(s);
            }

            DynamicWizardsFacade.SaveWizard(def);
        }
Beispiel #6
0
        public override void OnInitialize(object sender, EventArgs e)
        {
            if (BindingExist("BoundToken"))
            {
                return;
            }

            Bindings.Add("BoundToken", EntityToken);

            var modelReference = (IModelReference)((DataEntityToken)EntityToken).Data;
            var wizard         = DynamicWizardsFacade.GetWizard(modelReference.Name);

            SetupFormData(wizard, wizard.Model);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            var token  = (FormWizardStepEntityToken)entityToken;
            var wizard = DynamicWizardsFacade.GetWizard(token.WizardName);
            var step   = wizard.Model.Steps.Single(h => h.Name == token.StepName);

            wizard.Model.Steps.Remove(step);

            DynamicWizardsFacade.SaveWizard(wizard);

            new ParentTreeRefresher(flowControllerServicesContainer).PostRefreshMessages(entityToken);

            return(null);
        }
Beispiel #8
0
        public override void OnFinish(object sender, EventArgs e)
        {
            var name   = GetBinding <string>("Name");
            var wizard = new DynamicWizardDefinition(name);

            DynamicWizardsFacade.SaveWizard(wizard);

            var data  = ModelReferenceFacade.GetModelReference(name);
            var token = data.GetDataEntityToken();

            var workflowToken = new WorkflowActionToken(typeof(EditFormWizardWorkflow));

            CreateSpecificTreeRefresher().PostRefreshMessages(EntityToken);
            ExecuteAction(token, workflowToken);
        }
Beispiel #9
0
        public override void OnFinish(object sender, EventArgs e)
        {
            var wizardToken    = GetBinding <DataEntityToken>("BoundToken");
            var modelReference = (IModelReference)wizardToken.Data;

            var wizard = DynamicWizardsFacade.GetWizard(modelReference.Name);

            var requiresCaptcha      = GetBinding <bool>("RequiresCaptcha");
            var forceHttpsConnection = GetBinding <bool>("ForceHttpsConnection");

            wizard.Model.RequiresCaptcha = requiresCaptcha;
            wizard.Model.ForceHttps      = forceHttpsConnection;

            Save(wizard);
        }
        protected override void OnLoad(EventArgs e)
        {
            var wizardName = Request.QueryString["wizardName"];
            var def        = DynamicWizardsFacade.GetWizard(wizardName);

            Master.CustomJsonDataName  = "wizardName";
            Master.CustomJsonDataValue = Request.QueryString["wizardName"];

            Master.SortableItems = def.Model.Steps.Select(i => new SortableItem
            {
                Id   = i.Name,
                Name = i.Name
            });

            base.OnLoad(e);
        }
        public override void OnInitialize(object sender, EventArgs e)
        {
            if (BindingExist("BoundToken"))
            {
                return;
            }

            var wizardStepEntityToken = (FormWizardStepEntityToken)EntityToken;
            var wizard = DynamicWizardsFacade.GetWizard(wizardStepEntityToken.WizardName);
            var step   = wizard.Model.Steps.Single(s => s.Name == wizardStepEntityToken.StepName);

            Bindings.Add("StepName", step.Name);
            Bindings.Add("FormName", step.FormName);
            Bindings.Add("StepLabel", step.Label);
            Bindings.Add("NextButtonLabel", step.NextButtonLabel ?? String.Empty);
            Bindings.Add("PreviousButtonLabel", step.PreviousButtonLabel ?? String.Empty);

            Bindings.Add("BoundToken", wizardStepEntityToken);
        }
        public override void OnFinish(object sender, EventArgs e)
        {
            var stepToken = GetBinding <FormWizardStepEntityToken>("BoundToken");

            var stepName            = GetBinding <string>("StepName");
            var formName            = GetBinding <string>("FormName");
            var stepLabel           = GetBinding <string>("StepLabel");
            var nextButtonLabel     = GetBinding <string>("NextButtonLabel");
            var previousButtonLabel = GetBinding <string>("PreviousButtonLabel");

            var isNewName = stepName != stepToken.StepName;

            var wizard = DynamicWizardsFacade.GetWizard(stepToken.WizardName);

            var step = wizard.Model.Steps.Single(s => s.Name == stepToken.StepName);

            step.Name                = stepName;
            step.FormName            = formName;
            step.Label               = stepLabel;
            step.NextButtonLabel     = nextButtonLabel;
            step.PreviousButtonLabel = previousButtonLabel;

            DynamicWizardsFacade.SaveWizard(wizard);

            if (isNewName)
            {
                stepToken = new FormWizardStepEntityToken(wizard.Name, stepName);

                UpdateBinding("BoundToken", stepToken);
                SetSaveStatus(true, stepToken);
            }
            else
            {
                SetSaveStatus(true);
            }

            CreateParentTreeRefresher().PostRefreshMessages(EntityToken);
        }