コード例 #1
0
    void categoryGrid_OnAction(string actionName, object actionArgument)
    {
        int categoryId = ValidationHelper.GetInteger(actionArgument, 0);

        switch (actionName.ToLowerCSafe())
        {
        case "up":
        case "down":
            // In case Up or Down action was performed permissions are checked
            RaiseOnCheckPermissions(PERMISSION_MODIFY, this);

            SKUOptionCategoryInfo selectedItem = SKUOptionCategoryInfoProvider.GetSKUOptionCategoryInfo(categoryId, ProductID);

            if (actionName.ToLowerCSafe() == "up")
            {
                // Move SKU Category Up
                SKUOptionCategoryInfoProvider.MoveSKUCategoryOrderUp(selectedItem);
            }
            else
            {
                // Move SKU Category Down
                SKUOptionCategoryInfoProvider.MoveSKUCategoryOrderDown(selectedItem);
            }

            // Clear selected rows
            categoryGrid.ResetSelection();

            // Reload uniGrid & uniSelector
            categoryGrid.ReloadData();

            break;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // SKU option category info to select options from
        optionSKUCategoryInfo = SKUOptionCategoryInfo.Provider.Get(CategoryID, ProductID);

        // Redirect user if edited option category for this product does not exist
        if (optionSKUCategoryInfo == null)
        {
            EditedObject = null;
        }
        else
        {
            // Set title and help
            var    optionCategoryInfo = OptionCategoryInfo.Provider.Get(optionSKUCategoryInfo.CategoryID);
            var    categoryFullName   = optionCategoryInfo.CategoryFullName;
            string titleText          = string.Format(GetString("com.optioncategory.select"), HTMLHelper.HTMLEncode(categoryFullName));

            SetTitle(titleText);
        }

        // Register event handlers
        rbAllowAllOption.SelectedIndexChanged += rbAllowAllOption_SelectedIndexChanged;
        ugOptions.OnExternalDataBound         += ugOptions_OnExternalDataBound;
        ugOptions.OnBeforeDataReload          += ugOptions_OnBeforeDataReload;

        Save += btnOk_Click;

        // Initialize value of controls
        if (!RequestHelper.IsPostBack())
        {
            rbAllowAllOption.SelectedValue = optionSKUCategoryInfo.AllowAllOptions ? ALLOW_ALL : SELECTED_ONLY;
            ugOptions.SelectedItems        = SelectedOptionsIds;
        }

        // Hide selection if all options are allowed
        ugOptions.GridOptions.ShowSelection = rbAllowAllOption.SelectedValue != ALLOW_ALL;

        // Display only options for particular category
        ugOptions.WhereCondition = "SKUOptionCategoryID=" + CategoryID;

        // Navigate user if there is nothing to select from
        ugOptions.ZeroRowsText = GetString("com.selectableoptions.nodata");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // SKU option category info to select options from
        optionSKUCategoryInfo = SKUOptionCategoryInfoProvider.GetSKUOptionCategoryInfo(CategoryID, ProductID);

        // Redirect user if edited option category for this product does not exist
        if (optionSKUCategoryInfo == null)
        {
            EditedObject = null;
        }
        else
        {
            // Set title and help
            var optionCategoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(optionSKUCategoryInfo.CategoryID);
            var categoryFullName = optionCategoryInfo.CategoryFullName;
            string titleText = string.Format(GetString("com.optioncategory.select"), HTMLHelper.HTMLEncode(categoryFullName));

            SetTitle(titleText);
        }

        // Register event handlers
        rbAllowAllOption.SelectedIndexChanged += rbAllowAllOption_SelectedIndexChanged;
        ugOptions.OnExternalDataBound += ugOptions_OnExternalDataBound;
        ugOptions.OnBeforeDataReload += ugOptions_OnBeforeDataReload;

        Save += btnOk_Click;

        // Initialize value of controls
        if (!RequestHelper.IsPostBack())
        {
            rbAllowAllOption.SelectedValue = optionSKUCategoryInfo.AllowAllOptions ? ALLOW_ALL : SELECTED_ONLY;
            ugOptions.SelectedItems = SelectedOptionsIds;
        }

        // Hide selection if all options are allowed
        ugOptions.GridOptions.ShowSelection = rbAllowAllOption.SelectedValue != ALLOW_ALL;

        // Display only options for particular category
        ugOptions.WhereCondition = "SKUOptionCategoryID=" + CategoryID;

        // Navigate user if there is nothing to select from
        ugOptions.ZeroRowsText = GetString("com.selectableoptions.nodata");
    }