/// <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 gridProcesses_OnAction(string actionName, object actionArgument)
    {
        int processId = Convert.ToInt32(actionArgument);

        switch (actionName)
        {
        case "edit":
            var url = UIContextHelper.GetElementUrl(ModuleName.ONLINEMARKETING, "EditProcess");
            url = URLHelper.AddParameterToUrl(url, "displayTitle", "false");
            url = URLHelper.AddParameterToUrl(url, "objectId", processId.ToString());
            URLHelper.Redirect(url);
            break;

        case "delete":
            if (!WorkflowStepInfoProvider.CanUserManageAutomationProcesses(CurrentUser, CurrentSiteName))
            {
                RedirectToAccessDenied(ModuleName.ONLINEMARKETING, "ManageProcesses");
            }

            // Delete the workflow with all the dependencies
            WorkflowInfoProvider.DeleteWorkflowInfo(processId);

            ShowConfirmation(GetString("ma.process.delete.confirmation"));
            break;
        }
    }
Ejemplo n.º 2
0
    /// <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 gridProcesses_OnAction(string actionName, object actionArgument)
    {
        int processId = Convert.ToInt32(actionArgument);

        switch (actionName)
        {
        case "edit":
            var url = UIContextHelper.GetElementUrl(ModuleName.ONLINEMARKETING, "EditProcess");
            url = URLHelper.AddParameterToUrl(url, "displayTitle", "false");
            url = URLHelper.AddParameterToUrl(url, "objectId", processId.ToString());
            URLHelper.Redirect(AddSiteQuery(url, null));
            break;

        case "delete":
            if (AutomationHelper.CheckProcessDependencies(processId))
            {
                ShowError(GetString("MA.process.CannotDeleteUsed"));

                return;
            }

            if (!WorkflowStepInfoProvider.CanUserManageAutomationProcesses(CurrentUser, CurrentSiteName))
            {
                RedirectToAccessDenied(ModuleName.ONLINEMARKETING, "ManageProcesses");
            }

            // Delete the workflow
            WorkflowInfoProvider.DeleteWorkflowInfo(processId);
            break;
        }
    }
Ejemplo n.º 3
0
    /// <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 UniGridWorkflows_OnAction(string actionName, object actionArgument)
    {
        int workflowid = Convert.ToInt32(actionArgument);

        switch (actionName)
        {
        case "edit":
            URLHelper.Redirect("Workflow_Edit.aspx?workflowid=" + workflowid);
            break;

        case "delete":
            // Check if documents use the workflow
            List <string> documentNames = new List <string>();
            if (WorkflowInfoProvider.CheckDependencies(workflowid, ref documentNames))
            {
                // Encode and localize names
                StringBuilder sb = new StringBuilder();
                documentNames.ForEach(item => sb.Append("<br />", HTMLHelper.HTMLEncode(ResHelper.LocalizeString(item))));
                ShowError(GetString("Workflow.CannotDeleteUsed"), GetString("workflow.documentlist") + sb.ToString(), null);
                return;
            }
            else
            {
                // Delete the workflow
                WorkflowInfoProvider.DeleteWorkflowInfo(workflowid);
            }
            break;
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Deletes workflow. Called when the "Delete workflow" button is pressed.
    /// Expects the CreateWorkflow method to be run first.
    /// </summary>
    private bool DeleteWorkflow()
    {
        // Get the workflow
        WorkflowInfo deleteWorkflow = WorkflowInfoProvider.GetWorkflowInfo("MyNewWorkflow", WorkflowTypeEnum.Approval);

        // Delete the workflow
        WorkflowInfoProvider.DeleteWorkflowInfo(deleteWorkflow);

        return(deleteWorkflow != null);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Deletes process. Called when the "Delete process" button is pressed.
    /// Expects the CreateProcess method to be run first.
    /// </summary>
    private bool DeleteProcess()
    {
        // Get the process
        WorkflowInfo deleteProcess = WorkflowInfoProvider.GetWorkflowInfo("MyNewProcess", WorkflowTypeEnum.Automation);

        // Delete the process
        WorkflowInfoProvider.DeleteWorkflowInfo(deleteProcess);

        return(deleteProcess != null);
    }
Ejemplo n.º 6
0
    /// <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 gridProcesses_OnAction(string actionName, object actionArgument)
    {
        int processId = Convert.ToInt32(actionArgument);

        switch (actionName)
        {
        case "edit":
            URLHelper.Redirect(AddSiteQuery("Process/Frameset.aspx?processid=" + processId, null));
            break;

        case "delete":
            if (WorkflowInfoProvider.CheckProcessDependencies(processId))
            {
                ShowError(GetString("MA.process.CannotDeleteUsed"));
                return;
            }
            else
            {
                // Delete the workflow
                WorkflowInfoProvider.DeleteWorkflowInfo(processId);
            }
            break;
        }
    }
    /// <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 OnAction(string actionName, object actionArgument)
    {
        int workflowid = Convert.ToInt32(actionArgument);

        switch (actionName)
        {
        case "delete":
            // Check if documents use the workflow
            List <string> documentNames = new List <string>();
            if (WorkflowInfoProvider.CheckDependencies(workflowid, ref documentNames))
            {
                // Encode and localize names
                StringBuilder sb = new StringBuilder();
                documentNames.ForEach(item => sb.Append("<br />", HTMLHelper.HTMLEncode(ResHelper.LocalizeString(item))));
                Control.ShowError(Control.GetString("Workflow.CannotDeleteUsed"), Control.GetString("workflow.documentlist") + sb);
            }
            else
            {
                // Delete the workflow
                WorkflowInfoProvider.DeleteWorkflowInfo(workflowid);
            }
            break;
        }
    }
Ejemplo n.º 8
0
    /// <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)
    {
        int workflowid = Convert.ToInt32(actionArgument);

        if (actionName == "edit")
        {
            URLHelper.Redirect("Workflow_Edit.aspx?workflowid=" + workflowid);
        }
        else if (actionName == "delete")
        {
            // Check if documents use the workflow
            if (WorkflowInfoProvider.CheckDependencies(workflowid))
            {
                lblError.Text    = GetString("Workflow.CannotDeleteUsed");
                lblError.Visible = true;
                return;
            }
            else
            {
                // Delete the workflow
                WorkflowInfoProvider.DeleteWorkflowInfo(workflowid);
            }
        }
    }