Ejemplo n.º 1
0
    private void grid_OnAction(string actionName, object actionArgument)
    {
        int skuId = ValidationHelper.GetInteger(actionArgument, 0);

        switch (actionName.ToLowerCSafe())
        {
        case "edit":
            URLHelper.Redirect("~/CMSModules/Ecommerce/Pages/Tools/Products/Product_Edit_Frameset.aspx?categoryid=" + categoryId + "&productid=" + skuId + "&siteId=" + categoryObj.CategorySiteID);
            break;

        case "delete":
            // Check permissions
            CheckModifyPermission();

            // Check dependencies
            if (SKUInfoProvider.CheckDependencies(skuId))
            {
                // Show error message
                ShowError(GetString("Ecommerce.DeleteDisabled"));

                return;
            }

            SKUInfoProvider.DeleteSKUInfo(skuId);
            grid.ReloadData();

            break;

        case "moveup":
            // Check permissions
            CheckModifyPermission();

            SKUInfoProvider.MoveSKUOptionUp(skuId);
            break;

        case "movedown":
            // Check permissions
            CheckModifyPermission();

            SKUInfoProvider.MoveSKUOptionDown(skuId);
            break;
        }
    }
Ejemplo n.º 2
0
    private void grid_OnAction(string actionName, object actionArgument)
    {
        int skuId = ValidationHelper.GetInteger(actionArgument, 0);

        switch (actionName.ToLowerCSafe())
        {
        case "edit":
            // Show product tabs for type Products, otherwise show only general tab
        {
            string url = (categoryObj.CategoryType == OptionCategoryTypeEnum.Products) ?
                         UIContextHelper.GetElementUrl("CMS.ECommerce", "ProductOptions.Options.Edit") :
                         "~/CMSModules/Ecommerce/Pages/Tools/Products/Product_Edit_General.aspx";

            url = URLHelper.AddParameterToUrl(url, "displaytitle", "false");
            url = URLHelper.AddParameterToUrl(url, "productId", skuId.ToString());
            url = URLHelper.AddParameterToUrl(url, "categoryid", categoryId.ToString());
            url = URLHelper.AddParameterToUrl(url, "siteId", categoryObj.CategorySiteID.ToString());
            url = URLHelper.AddParameterToUrl(url, "objectid", categoryId.ToString());
            url = URLHelper.AddParameterToUrl(url, "dialog", QueryHelper.GetString("dialog", "0"));

            // Add parent product id
            if (parentProductId > 0)
            {
                url += "&parentProductId=" + parentProductId;
            }

            URLHelper.Redirect(url);
        }
        break;

        case "delete":
            // Check permissions
            CheckModifyPermission();

            // Check dependencies
            if (SKUInfoProvider.CheckDependencies(skuId))
            {
                // Show error message
                ShowError(GetString("Ecommerce.DeleteDisabled"));

                return;
            }

            // Check if same variant is defined by this option
            DataSet variants = VariantOptionInfoProvider.GetVariantOptions()
                               .TopN(1)
                               .Columns("VariantSKUID")
                               .WhereEquals("OptionSKUID", skuId);

            if (!DataHelper.DataSourceIsEmpty(variants))
            {
                // Option is used in some variant
                ShowError(GetString("com.option.usedinvariant"));

                return;
            }

            SKUInfoProvider.DeleteSKUInfo(skuId);
            ugOptions.ReloadData();

            break;

        case "moveup":
            // Check permissions
            CheckModifyPermission();

            SKUInfoProvider.MoveSKUOptionUp(skuId);
            break;

        case "movedown":
            // Check permissions
            CheckModifyPermission();

            SKUInfoProvider.MoveSKUOptionDown(skuId);
            break;
        }
    }