Esempio n. 1
0
        public String GetCategoryProductList(HttpContext context, string editLangCurrent)
        {
            try
            {
                EditLangCurrent = editLangCurrent;
                var ajaxInfo = NBrightBuyUtils.GetAjaxInfo(context);
                var objQual  = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier;
                var dbOwner  = DotNetNuke.Data.DataProvider.Instance().DatabaseOwner;

                var strFilter = " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = {Settings:itemid}) ";

                strFilter = Utils.ReplaceSettingTokens(strFilter, ajaxInfo.ToDictionary());

                ajaxInfo.SetXmlProperty("genxml/hidden/filter", strFilter);
                ajaxInfo.SetXmlProperty("genxml/hidden/razortemplate", "Admin_CategoryProducts.cshtml");
                ajaxInfo.SetXmlProperty("genxml/hidden/themefolder", "config");

                var productFunctions = new ProductFunctions();
                return(productFunctions.ProductAdminList(context, true, EditLangCurrent, "", true));
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
Esempio n. 2
0
        public string ProcessCommand(string paramCmd, HttpContext context, string editlang = "")
        {
            var strOut   = "CATEGORY - ERROR!! - No Security rights or function command.";
            var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context);

            EntityTypeCode = ajaxInfo.GetXmlProperty("genxml/hidden/entitytypecode");
            if (EntityTypeCode == "")
            {
                EntityTypeCode = "CATEGORY";                       // default to category
            }
            EditLangCurrent = NBrightBuyUtils.GetEditLang(ajaxInfo, Utils.GetCurrentCulture());

            if (!paramCmd.ToLower().Contains("save"))
            {
                // pickup nextlang, indicates if we are changing languages. (Don't use if saving data, only for getting next language.)
                EditLangCurrent = NBrightBuyUtils.GetNextLang(ajaxInfo, EditLangCurrent);
            }

            if (PluginUtils.CheckPluginSecurity(PortalSettings.Current.PortalId, "categories"))
            {
                switch (paramCmd)
                {
                case "category_admin_getlist":
                    strOut = CategoryAdminList(context, "", EditLangCurrent);
                    break;

                case "category_admin_getdetail":
                    strOut = CategoryAdminDetail(context, 0, EditLangCurrent);
                    break;

                case "category_admin_addnew":
                    strOut = CategoryAdminAddNew(context);
                    break;

                case "category_admin_savelist":
                    strOut = CategoryAdminSaveList(context);
                    break;

                case "category_admin_save":
                    strOut = CategorySave(context, EditLangCurrent);
                    break;

                case "category_admin_saveexit":
                    strOut = CategorySave(context, EditLangCurrent);
                    break;

                case "category_admin_movecategory":
                    strOut = MoveCategoryAdmin(context);
                    break;

                case "category_admin_delete":
                    strOut = DeleteCategory(context);
                    break;

                case "category_updateimages":
                    strOut = UpdateCategoryImages(context, EditLangCurrent);
                    break;

                case "category_getproductselectlist":
                    var productFunctions = new ProductFunctions();
                    strOut = productFunctions.ProductAdminList(context, true, EditLangCurrent, "", true);
                    break;

                case "category_selectchangehidden":
                    strOut = CategoryHidden(context);
                    break;

                case "category_selectcatxref":
                    strOut = SelectCatXref(context, EditLangCurrent);
                    break;

                case "category_deletecatxref":
                    strOut = DeleteCatXref(context);
                    break;

                case "category_deleteallcatxref":
                    strOut = DeleteAllCatXref(context, EditLangCurrent);
                    break;

                case "category_copyallcatxref":
                    strOut = CopyAllCatXref(context);
                    break;

                case "category_moveallcatxref":
                    strOut = CopyAllCatXref(context, true);
                    break;

                case "category_cattaxupdate":
                    strOut = CatTaxUpdate(context, EditLangCurrent);
                    break;

                case "category_addgroupfilter":
                    strOut = AddGroupFilter(context, EditLangCurrent);
                    break;

                case "category_removegroupfilter":
                    strOut = RemoveGroupFilter(context, EditLangCurrent);
                    break;

                case "category_categorygroupfilter":
                    strOut = CategoryGroupFilters(context, EditLangCurrent);
                    break;
                }
            }

            switch (paramCmd)
            {
            case "category_categoryproductlist":
                strOut = GetCategoryProductList(context, EditLangCurrent);
                break;

            case "category_removeimage":
                strOut = RemoveCategoryImage(context, EditLangCurrent);
                break;

            case "category_displayproductselect":
                strOut = CategoryProductSelect(context, EditLangCurrent);
                break;
            }

            return(strOut);
        }