Esempio n. 1
0
    /// <summary>
    /// Deletes page template scope. Called when the "Delete scope" button is pressed.
    /// Expects the CreatePageTemplateScope method to be run first.
    /// </summary>
    private bool DeletePageTemplateScope()
    {
        string columns = "";

        string where = "";

        // Get template object
        PageTemplateInfo template = PageTemplateInfoProvider.GetPageTemplateInfo("MyNewTemplate");

        // If template exists
        if (template != null)
        {
            where = "PageTemplateScopeTemplateID = " + template.PageTemplateId;
        }


        DataSet scopes = PageTemplateScopeInfoProvider.GetTemplateScopes(columns, where, null, 0);

        if (!DataHelper.DataSourceIsEmpty(scopes))
        {
            // Get the page template scope
            PageTemplateScopeInfo deleteScope = new PageTemplateScopeInfo(scopes.Tables[0].Rows[0]);

            // Delete the page template scope
            PageTemplateScopeInfoProvider.DeletePageTemplateScopeInfo(deleteScope);

            return(true);
        }
        return(false);
    }
Esempio n. 2
0
    /// <summary>
    /// Unigrid on action.
    /// </summary>
    /// <param name="actionName">Action name</param>
    /// <param name="actionArgument">Argument</param>
    private void unigridScopes_OnAction(string actionName, object actionArgument)
    {
        switch (actionName.ToLowerCSafe())
        {
        case "edit":
            URLHelper.Redirect(UrlResolver.ResolveUrl("PageTemplateScope_Edit.aspx?scopeid=" + ValidationHelper.GetString(actionArgument, "0") + "&templateid=" + PageTemplateID + "&siteID=" + siteID));
            break;

        case "delete":
            PageTemplateScopeInfoProvider.DeletePageTemplateScopeInfo(ValidationHelper.GetInteger(actionArgument, 0));
            break;
        }
    }