Example #1
0
    /// <summary>
    /// Handles UniGrid's OnAction event.
    /// </summary>
    /// <param name="actionName">Name of the action which should be performed</param>
    /// <param name="actionArgument">ID of the item the action should be performed with</param>
    protected void gridElem_OnAction(string actionName, object actionArgument)
    {
        int variantId = ValidationHelper.GetInteger(actionArgument, 0);

        if (variantId > 0)
        {
            switch (actionName.ToLower())
            {
            case "edit":
                this.SelectedItemID = variantId;
                this.RaiseOnEdit();
                break;

            case "delete":
                if (CheckPermissions("CMS.ABTest", CMSAdminControl.PERMISSION_MANAGE))
                {
                    // Delete the object
                    ABVariantInfoProvider.DeleteABVariantInfo(variantId);
                    this.RaiseOnDelete();

                    // Reload data
                    gridElem.ReloadData();
                }
                break;
            }
        }
    }
Example #2
0
 /// <summary>
 /// Handles Unigrid's OnAction event.
 /// </summary>
 /// <param name="actionName">Name of the action</param>
 /// <param name="actionArgument">Action argument</param>
 protected void gridElem_OnAction(string actionName, object actionArgument)
 {
     switch (actionName)
     {
     case "delete":
         int variantID = ValidationHelper.GetInteger(actionArgument, 0);
         if (variantID > 0)
         {
             var variant = ABVariantInfoProvider.GetABVariantInfo(variantID);
             if (variant != null)
             {
                 if (variant.ABVariantPath != ABTest.ABTestOriginalPage)
                 {
                     ABVariantInfoProvider.DeleteABVariantInfo(variantID);
                 }
                 else
                 {
                     ShowError(GetString("abtesting.deleteoriginalvariant"));
                 }
             }
         }
         break;
     }
 }