/// <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; } }
/// <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; } }
/// <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); } } }