Esempio n. 1
0
    /// <summary>
    /// Deletes css stylesheet. Called when the "Delete stylesheet" button is pressed.
    /// Expects the CreateCssStylesheet method to be run first.
    /// </summary>
    private bool DeleteCssStylesheet()
    {
        // Get the css stylesheet
        CssStylesheetInfo deleteStylesheet = CssStylesheetInfoProvider.GetCssStylesheetInfo("MyNewStylesheet");

        // Delete the css stylesheet
        CssStylesheetInfoProvider.DeleteCssStylesheetInfo(deleteStylesheet);

        return(deleteStylesheet != null);
    }
 /// <summary>
 /// Handles the UniGrid's OnAction event.
 /// </summary>
 /// <param name="actionName">Name of item (button) that threw event</param>
 /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
 protected void UniGridRoles_OnAction(string actionName, object actionArgument)
 {
     if (actionName == "edit")
     {
         URLHelper.Redirect("CssStylesheet_Edit.aspx?cssstylesheetid=" + actionArgument.ToString() + "&tabmode=1");
     }
     else if (actionName == "delete")
     {
         CssStylesheetInfoProvider.DeleteCssStylesheetInfo(Convert.ToInt32(actionArgument));
     }
 }
Esempio n. 3
0
    /// <summary>
    /// Deletes object. Called when the "Delete object" button is pressed.
    /// Expects the CreateVersionedObject method to be run first.
    /// </summary>
    private bool DeleteObject()
    {
        // Get the css stylesheet
        CssStylesheetInfo deleteStylesheet = CssStylesheetInfoProvider.GetCssStylesheetInfo("MyNewVersionedStylesheet");

        if (deleteStylesheet != null)
        {
            // Check if restoring from recycle bin is allowed on current site
            if (ObjectVersionManager.AllowObjectRestore(deleteStylesheet, CMSContext.CurrentSiteName))
            {
                // Delete the css stylesheet
                CssStylesheetInfoProvider.DeleteCssStylesheetInfo(deleteStylesheet);

                return(true);
            }
        }

        return(false);
    }
Esempio n. 4
0
    /// <summary>
    /// Destroys object (without creating new version for recycle bin). Called when the "DestroyObject" button is pressed.
    /// Expects the CreateVersionedObject method to be run first.
    /// </summary>
    private bool DestroyObject()
    {
        // Get the css stylesheet
        CssStylesheetInfo destroyStylesheet = CssStylesheetInfoProvider.GetCssStylesheetInfo("MyNewVersionedStylesheet");

        if (destroyStylesheet != null)
        {
            // Destroy the object (in action context with disabled creating of new versions for recycle bin)
            using (CMSActionContext context = new CMSActionContext())
            {
                // Disable creating of new versions
                context.CreateVersion = false;

                // Destroy the css stylesheet
                CssStylesheetInfoProvider.DeleteCssStylesheetInfo(destroyStylesheet);

                return(true);
            }
        }

        return(false);
    }