コード例 #1
0
ファイル: AccountController.cs プロジェクト: vivek-meka/WeGo
        public ActionResult AddPOS(
            [Deserialize] WizardViewModel wizard,
            IStepViewModel step
            )
        {
            wizard.Steps[wizard.CurrentStepIndex] = step;
            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(Request["next"]))
                {
                    wizard.CurrentStepIndex++;
                }
                else if (!string.IsNullOrEmpty(Request["prev"]))
                {
                    wizard.CurrentStepIndex--;
                }
                else
                {
                    // TODO: we have finished: all the step partial
                    // view models have passed validation => map them
                    // back to the domain model and do some processing with
                    // the results

                    return(Content("thanks for filling this form", "text/plain"));
                }
            }
            else if (!string.IsNullOrEmpty(Request["prev"]))
            {
                // Even if validation failed we allow the user to
                // navigate to previous steps
                wizard.CurrentStepIndex--;
            }
            return(View(wizard));
        }
コード例 #2
0
 public ActionResult Index([Deserialize] WizardViewModel wizard, IStepViewModel step)
 {
     wizard.Steps[wizard.CurrentStepIndex] = step;
     if (ModelState.IsValid)
     {
         if (!string.IsNullOrEmpty(Request["next"]))
         {
             wizard.CurrentStepIndex++;
         }
         else if (!string.IsNullOrEmpty(Request["prev"]))
         {
             wizard.CurrentStepIndex--;
         }
         else
         {
             return(RedirectToAction("Index", "Home"));
         }
     }
     else if (!string.IsNullOrEmpty(Request["prev"]))
     {
         wizard.CurrentStepIndex--;
     }
     return(View(wizard));
 }
コード例 #3
0
 private static void SetNewRing(IStepViewModel stepViewModel, NewRingViewModel newRingViewModel)
 {
     stepViewModel.NewRingViewModel = newRingViewModel;
 }
コード例 #4
0
        protected virtual ActionResult Resume(string submitButton, Guid workflowKey, [DeserializeAttribute] IWizardModel Wizard, IStepViewModel stepModel)
        {
            this.InitializeWorkflowType(Wizard.WorkflowType);
            WorkflowService = new WorkflowService((System.Activities.Activity)GetNewWorfklowActivityIntance());
            if (ModelState.IsValid || submitButton != "Next" || stepModel.DontValidateNextButton)
            {
                //Persist Models
                Wizard.Steps[Wizard.CurrentStepIndex] = stepModel;
                Wizard.Command = submitButton;
                //Wizard.Save();

                Wizard.SetUrlHelper(System.Web.HttpContext.Current.Request.RequestContext);
                //Resume Workflow
                WorkflowService.ResumeWorkflow(Wizard);

                WorkflowService.RunWorkflow(Wizard, string.Empty);

                WorkflowService.Unload();

                Providers.WizardModelStoreProviderManager.Provider.SaveByKey(Wizard.Id.ToString(), Wizard);
                //Wizard.Save();
                ModelState.Clear();

                if (WorkflowService.IsCompleted || !string.IsNullOrEmpty(Wizard.ReturnUrl))
                {
                    return(Redirect(Wizard.ReturnUrl));
                }
                else
                {
                    return(View("Index", Wizard));
                }
            }

            return(View("Index", Wizard));
        }
コード例 #5
0
        protected virtual ActionResult Begin(string workflowType, System.Web.HttpContext Context, IStepViewModel step)
        {
            this.InitializeWorkflowType(workflowType);

            var    model     = (IWizardModel)GetNewModelContextInstance();
            string returnUrl = Request.UrlReferrer == null ? "/" : Request.UrlReferrer.PathAndQuery;

            model.ReturnUrl     = returnUrl;
            model.WorkflowType  = workflowType;
            model.UserPrincipal = Context.User;
            model.SetUrlHelper(Context.Request.RequestContext);

            if (step != null)
            {
                model.Steps.Add(step);
            }
            if (WorkflowService == null)
            {
                WorkflowService = new WorkflowService((System.Activities.Activity)GetNewWorfklowActivityIntance(), new Dictionary <string, object>()
                {
                    { "Context", model }
                });
            }

            Guid workflowKey = WorkflowService.StartWorkflow();

            model.Id = workflowKey;
            Providers.WizardModelStoreProviderManager.Provider.SaveByKey(workflowKey.ToString(), model);
            WorkflowService.Unload();

            return(RedirectToAction("Resume", "Wizard", new { workflowKey = workflowKey, workflowType = workflowType }));
        }