public void SetSteps(string key)
        {
            _key = key;
            ShopStepSection section = ConfigurationManager.GetSection("shopping/steps") as ShopStepSection;

            _steps = new LinkedList <ShopStepInfoElement>();

            foreach (ShopStepInfoElement step in section.Steps[key].StepInfos)
            {
                _steps.AddLast(step);
            }
        }
示例#2
0
        public BaseCart GetCart(string key)
        {
            if (HttpContext.Current.Session == null)
            {
                return(null);
            }

            BaseCart cart = HttpContext.Current.Session[key] as BaseCart;

            if (cart == null)
            {
                ShopStepSection section = ConfigurationManager.GetSection("shopping/steps") as ShopStepSection;
                ShopStepElement element = section.Steps[key];

                if (element != null)
                {
                    cart = Activator.CreateInstance(Type.GetType(element.Type), element.Key) as BaseCart;
                    HttpContext.Current.Session[key] = cart;
                }
            }
            return(cart);
        }