示例#1
0
        public static View GetBySession(SiteSettings ss)
        {
            var view = !Request.IsAjax()
                ? QueryStrings.Data("View")?.Deserialize <View>()
                : null;
            var key = "View" + (ss.SiteId == 0
                ? Pages.Key()
                : ss.SiteId.ToString());

            if (view != null)
            {
                HttpContext.Current.Session[key] = view;
                return(view);
            }
            else if (Forms.ControlId() == "ViewSelector")
            {
                view = ss.Views?.Get(Forms.Int("ViewSelector")) ?? new View(ss);
                HttpContext.Current.Session[key] = view;
                return(view);
            }
            else if (HttpContext.Current.Session[key] != null)
            {
                view = (HttpContext.Current.Session[key] as View);
                view.SetByForm(ss);
                return(view);
            }
            else
            {
                view = ss.Views?.Get(ss.GridView) ?? new View(ss);
                HttpContext.Current.Session[key] = view;
                return(view);
            }
        }
 public string RequestData(string name)
 {
     return(HttpMethod == "GET"
         ? QueryStrings.Data(name)
         : Forms.Data(name));
 }