コード例 #1
0
    /// <summary>
    /// Handles the settings key action event.
    /// </summary>
    /// <param name="actionName">Name of item (button) that throws event</param>
    /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
    protected void grpEdit_OnKeyAction(string actionName, object actionArgument)
    {
        int             keyId = ValidationHelper.GetInteger(actionArgument, 0);
        SettingsKeyInfo ski   = SettingsKeyInfoProvider.GetSettingsKeyInfo(keyId);

        switch (actionName.ToLowerCSafe())
        {
        case ("edit"):
            // Redirect to key edit page
            if (ski != null)
            {
                URLHelper.Redirect(URLHelper.AppendQuery(UIContextHelper.GetElementUrl(ModuleName.CMS, "Modules.Settings.EditSettingsKey", false), "keyname=" + ski.KeyName + "&moduleid=" + moduleId));
            }
            break;

        case ("delete"):
            try
            {
                SettingsKeyInfoProvider.DeleteSettingsKeyInfo(ski);
            }
            catch
            {
                ShowError(GetString("settingsedit.settingskey_edit.errordelete"));
            }
            break;

        case ("moveup"):
            SettingsKeyInfoProvider.MoveSettingsKeyUp(ski.KeyName);
            break;

        case ("movedown"):
            SettingsKeyInfoProvider.MoveSettingsKeyDown(ski.KeyName);
            break;
        }
    }