Пример #1
0
    private void UniGridAlias_OnAction(string actionName, object actionArgument)
    {
        if (Node != null)
        {
            // Check modify permissions
            if (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied)
            {
                return;
            }

            string action = DataHelper.GetNotEmpty(actionName, String.Empty).ToLowerCSafe();

            switch (action)
            {
            case "edit":
                // Edit action
                URLHelper.Redirect(UrlResolver.ResolveUrl("Alias_Edit.aspx?nodeid=" + NodeID + "&aliasid=" + Convert.ToString(actionArgument)));
                break;

            case "delete":
                // Delete action
                int aliasId = ValidationHelper.GetInteger(actionArgument, 0);
                if (aliasId > 0)
                {
                    // Delete
                    DocumentAliasInfoProvider.DeleteDocumentAliasInfo(aliasId);

                    // Log synchronization
                    DocumentSynchronizationHelper.LogDocumentChange(Node, TaskTypeEnum.UpdateDocument, DocumentManager.Tree);
                }
                break;
            }
        }
    }
Пример #2
0
    private void UniGridAlias_OnAction(string actionName, object actionArgument)
    {
        // Manage edit and delete
        int               aliasID = ValidationHelper.GetInteger(actionArgument, 0);
        string            action  = DataHelper.GetNotEmpty(actionName, String.Empty).ToLowerCSafe();
        TreeProvider      tree    = new TreeProvider(MembershipContext.AuthenticatedUser);
        DocumentAliasInfo dai     = DocumentAliasInfoProvider.GetDocumentAliasInfo(aliasID);

        if (dai != null)
        {
            // Find node
            TreeNode node = tree.SelectSingleNode(dai.AliasNodeID);

            if (node != null)
            {
                // Check modify permissions
                if (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(node, NodePermissionsEnum.Modify) == AuthorizationResultEnum.Denied)
                {
                    return;
                }

                // Edit only if node exists
                if (action == "edit")
                {
                    URLHelper.Redirect("Alias_Edit.aspx?nodeid=" + node.NodeID + "&aliasid=" + aliasID + "&defaultNodeID=" + NodeID + "&dialog=1");
                }
            }

            // Delete even if node does not exist
            if (action == "delete")
            {
                if (aliasID > 0)
                {
                    // Delete
                    DocumentAliasInfoProvider.DeleteDocumentAliasInfo(aliasID);

                    // Log synchronization
                    DocumentSynchronizationHelper.LogDocumentChange(node, TaskTypeEnum.UpdateDocument, tree);
                }
            }
        }
    }
Пример #3
0
    /// <summary>
    /// Deletes document alias. Called when the "Delete alias" button is pressed.
    /// Expects the CreateDocumentAlias method to be run first.
    /// </summary>
    private bool DeleteDocumentAlias()
    {
        // Prepare the parameters
        string orderBy = "";

        string where = "AliasURLPath = N'/MyNewAlias'";

        // Get the data
        DataSet aliases = DocumentAliasInfoProvider.GetDocumentAliases(where, orderBy);

        if (!DataHelper.DataSourceIsEmpty(aliases))
        {
            DocumentAliasInfo deleteAlias = new DocumentAliasInfo(aliases.Tables[0].Rows[0]);

            // Delete the document alias
            DocumentAliasInfoProvider.DeleteDocumentAliasInfo(deleteAlias);

            return(true);
        }

        return(false);
    }