/// <summary> /// Creates navigation data from step details /// Walks through child processes if necessary /// </summary> /// <param name="stepData">Step information</param> /// <returns>Process navigation data</returns> private ProcessDetailsModel GetNavigationDataFromStep(ProcessDetailsModel stepData) { if (stepData == null) { return(new ProcessDetailsModel()); } var destProcess = new ProcessDetailsModel(); destProcess.InjectFrom(stepData); // walk through child processes until we find step which has reference to the page and not another process while (destProcess.ChildProcessId.HasValue) { destProcess = FindProcessStartingStep(destProcess.ChildProcessId.Value); } // return corresponding navigation data if (destProcess != null) { destProcess.IsMainStep = IsMainProcess(destProcess.ProcessId); destProcess.OriginalProcessStep = stepData.Step; return(destProcess); } return(new ProcessDetailsModel()); }
public ActionResult Index() { var model = new ProcessDetailsModel(); for (int i = 0; i < 5; i++) { model.ProcessTypes.Add(new CodeTablePair() { Key = i, Value = "test" }); } return(View(model)); }
/// <summary> /// Moves to the previous step of the current process /// If there's no previous, returns to the previous process /// </summary> /// <returns>Navigation result</returns> public ProcessDetailsModel PreviousStep() { var result = ProcessStack.CurrentProcess; if (!ProcessStack.IsProcessActive) { result.PageURL = "/"; return(result); } var previousStep = GetNavigationDataFromStep(FindPreviousStep(result.ProcessId, result.Step ?? 1)); if (validation.Validate(previousStep, Authenticated)) { ProcessStack.MoveTo(previousStep); } else { if (previousStep.NoProcessOrStep) { // no previous step - return to the previous process bool previousProcessExist = ProcessStack.Return(); if (previousProcessExist) { var previousProcess = GetNavigationDataFromStep(ProcessStack.CurrentProcess); return(previousProcess); } // no previous process - return to home screen result = new ProcessDetailsModel { PageURL = "/" }; return(result); } } return(result); }