Exemplo n.º 1
0
        public static bool Active <T>()
        {
            var state = StateManager.GetState(SessionProvider.SessionId);

            return(state != null && state.Path == typeof(T).Name);
        }
Exemplo n.º 2
0
        public static bool Active()
        {
            var state = StateManager.GetState(SessionProvider.SessionId);

            return(state != null);
        }
Exemplo n.º 3
0
 public static object GetCorrelationId <T>(string name)
 {
     return(OnPath <T>() ? StateManager.GetCorrelationId(SessionProvider.SessionId, name) : null);
 }
Exemplo n.º 4
0
 public static object GetCorrelationId(string name)
 {
     return(StateManager.GetCorrelationId(SessionProvider.SessionId, name));
 }
Exemplo n.º 5
0
 public static void Done()
 {
     StateManager.RemoveState(SessionProvider.SessionId);
 }
Exemplo n.º 6
0
        public static ActionResult Resume()
        {
            var state = StateManager.GetState(SessionProvider.SessionId);

            if (state == null)
            {
                throw new RouteFlowException("RouteFlow:SessionID not valid in RouteFlow table");
            }

            var result = PathManager.GetEndpointByName(state.Path, state.Current.Name);

            if (result == null)
            {
                // stumped
                return(null);
            }

            var routeValues = new RouteValueDictionary();

            if (result.Correlations != null)
            {
                result.Correlations.ForEach(x =>
                {
                    if (x.Type == "SET")
                    {
                        if (routeValues.ContainsKey(x.RouteItem))
                        {
                            SetCorrelationId(x.Key, routeValues[x.RouteItem]);
                        }
                    }
                    //SetCorrelationId(x.Key, state.Current.Context.ActionParameters[x.RouteItem]);
                    if (x.Type == "GET")
                    {
                        var value = GetCorrelationId(x.Key);
                        if (value == null && x.IsRequired)
                        {
                            throw new ApplicationException(string.Format("RouteFlow:Correlation ({0}) is Required but not present", x.Key));
                        }
                        if (routeValues.ContainsKey(x.RouteItem))
                        {
                            routeValues[x.RouteItem] = value;
                        }
                        else
                        {
                            routeValues.Add(x.RouteItem, value);
                        }
                    }
                });
            }


            routeValues.Add("controller", result.Controller);
            routeValues.Add("action", result.Action);
            routeValues.Add("area", result.Area);

            routeValues.Extend(result.RouteValues);

            state.Current.SkipTo = null;
            state.Current.Name   = result.StepName;

            return(new RedirectToRouteResult(routeValues));
        }