コード例 #1
0
        public static string ProcessCommand(string paramCmd, HttpContext context)
        {
            var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context);

            _entityTypeCode     = ajaxInfo.GetXmlProperty("genxml/hidden/entitytypecode");
            _entityTypeCodeLang = ajaxInfo.GetXmlProperty("genxml/hidden/entitytypecodelang");
            if (_entityTypeCode == "")
            {
                _entityTypeCode = "PRD";
            }
            if (_entityTypeCodeLang == "")
            {
                _entityTypeCodeLang = "PRDLANG";
            }
            _themeFolder  = ajaxInfo.GetXmlProperty("genxml/hidden/themefolder");
            _templatename = ajaxInfo.GetXmlProperty("genxml/hidden/templatename");
            if (_templatename == "")
            {
                _templatename = "favoriteslist";
            }
            if (_themeFolder == "")
            {
                _themeFolder = "ClassicAjax";
            }
            var itemId       = ajaxInfo.GetXmlProperty("genxml/hidden/shopitemid");
            var itemlistname = ajaxInfo.GetXmlProperty("genxml/hidden/shoplistname");

            var strOut = "ORDER - ERROR!! - No Security rights for current user!";

            var cw = new ItemListData(PortalSettings.Current.PortalId, UserController.Instance.GetCurrentUserInfo().UserID);

            switch (paramCmd)
            {
            case "itemlist_add":
                if (Utils.IsNumeric(itemId))
                {
                    cw.Add(itemlistname, itemId);
                    strOut = cw.products;
                }
                break;

            case "itemlist_remove":
                if (Utils.IsNumeric(itemId))
                {
                    cw.Remove(itemlistname, itemId);
                    strOut = cw.products;
                }
                break;

            case "itemlist_delete":
                cw.DeleteList(itemlistname);
                strOut = "deleted";
                break;

            case "itemlist_productlist":
                strOut = GetProductItemListHtml(cw, itemlistname);
                break;

            case "itemlist_getpopup":
                strOut = GetProductItemListPopup(cw, itemlistname);
                break;
            }

            return(strOut);
        }