/// <summary> /// Gets and bulk updates workflows. Called when the "Get and bulk update workflows" button is pressed. /// Expects the CreateWorkflow method to be run first. /// </summary> private bool GetAndBulkUpdateWorkflows() { // Prepare the parameters string where = "WorkflowName LIKE N'MyNewWorkflow%'"; // Get the data InfoDataSet <WorkflowInfo> workflows = WorkflowInfoProvider.GetWorkflows(where, null, 0, null); if (!DataHelper.DataSourceIsEmpty(workflows)) { // Loop through the individual items foreach (WorkflowInfo modifyWorkflow in workflows) { // Update the properties modifyWorkflow.WorkflowDisplayName = modifyWorkflow.WorkflowDisplayName.ToUpper(); // Save the changes WorkflowInfoProvider.SetWorkflowInfo(modifyWorkflow); } return(true); } return(false); }
/// <summary> /// Saves data /// </summary> public void SaveData() { if (Workflow != null) { chkEmails.SetThreeStateValue(Workflow, "WorkflowSendEmails"); Workflow.WorkflowApprovedTemplateName = ValidationHelper.GetString(ucApprove.Value, null); Workflow.WorkflowReadyForApprovalTemplateName = ValidationHelper.GetString(ucReadyApproval.Value, null); Workflow.WorkflowRejectedTemplateName = ValidationHelper.GetString(ucReject.Value, null); Workflow.WorkflowPublishedTemplateName = ValidationHelper.GetString(ucPublish.Value, null); Workflow.WorkflowArchivedTemplateName = ValidationHelper.GetString(ucArchive.Value, null); Workflow.WorkflowNotificationTemplateName = ValidationHelper.GetString(ucNotif.Value, null); Workflow.WorkflowSendApproveEmails = chkApprove.Checked; Workflow.WorkflowSendReadyForApprovalEmails = chkReadyApproval.Checked; Workflow.WorkflowSendRejectEmails = chkReject.Checked; Workflow.WorkflowSendArchiveEmails = chkArchive.Checked; Workflow.WorkflowSendPublishEmails = chkPublish.Checked; // Save workflow info WorkflowInfoProvider.SetWorkflowInfo(Workflow); // Save selected users SaveUsersData(); ShowChangesSaved(); } }
/// <summary> /// Creates process. Called when the "Create process" button is pressed. /// </summary> private bool CreateProcess() { // Create new process object and set its properties WorkflowInfo newProcess = new WorkflowInfo() { WorkflowDisplayName = "My new process", WorkflowName = "MyNewProcess", WorkflowType = WorkflowTypeEnum.Automation, WorkflowRecurrenceType = ProcessRecurrenceTypeEnum.Recurring }; // Save the process WorkflowInfoProvider.SetWorkflowInfo(newProcess); // Create default steps WorkflowStepInfoProvider.CreateDefaultWorkflowSteps(newProcess); // Get the step with codename 'Finished' and allow Move to previous WorkflowStepInfo finishedStep = WorkflowStepInfoProvider.GetWorkflowStepInfo("Finished", newProcess.WorkflowID); finishedStep.StepAllowReject = true; // Save the 'Finished' step WorkflowStepInfoProvider.SetWorkflowStepInfo(finishedStep); return(true); }
/// <summary> /// Saves data of edited workflow from TextBoxes into DB. /// </summary> protected void ButtonOK_Click(object sender, EventArgs e) { // finds whether required fields are not empty string result = new Validator().NotEmpty(TextBoxWorkflowDisplayName.Text, GetString("Development-Workflow_New.RequiresDisplayName")) .NotEmpty(txtCodeName.Text, GetString("Development-Workflow_New.RequiresCodeName")) .IsCodeName(txtCodeName.Text, GetString("general.invalidcodename")) .Result; if (result == "") { if (currentWorkflow != null) { // Codename must be unique WorkflowInfo wiCodename = WorkflowInfoProvider.GetWorkflowInfo(txtCodeName.Text); if ((wiCodename == null) || (wiCodename.WorkflowID == currentWorkflow.WorkflowID)) { if (currentWorkflow.WorkflowDisplayName != TextBoxWorkflowDisplayName.Text) { // Refresh header ScriptHelper.RefreshTabHeader(Page, null); } currentWorkflow.WorkflowDisplayName = TextBoxWorkflowDisplayName.Text; currentWorkflow.WorkflowName = txtCodeName.Text; currentWorkflow.WorkflowAutoPublishChanges = chkAutoPublish.Checked; // Inherited from global settings if (radSiteSettings.Checked) { currentWorkflow.WorkflowUseCheckinCheckout = null; } else { currentWorkflow.WorkflowUseCheckinCheckout = radYes.Checked; } // Save workflow info WorkflowInfoProvider.SetWorkflowInfo(currentWorkflow); lblInfo.Visible = true; lblInfo.Text = GetString("General.ChangesSaved"); } else { lblError.Visible = true; lblError.Text = GetString("Development-Workflow_New.WorkflowExists"); } } else { lblError.Visible = true; lblError.Text = GetString("Development-Workflow_General.WorkflowDoesNotExists"); } } else { lblError.Visible = true; lblError.Text = result; } }
/// <summary> /// Saves new wokflow's data into DB. /// </summary> /// <returns>Returns ID of created wokflow</returns> protected int SaveNewWorkflow() { WorkflowInfo wi = new WorkflowInfo(); wi.WorkflowDisplayName = txtWorkflowDisplayName.Text; wi.WorkflowName = txtWorkflowCodeName.Text; WorkflowInfoProvider.SetWorkflowInfo(wi); return(wi.WorkflowID); }
/// <summary> /// Gets and updates workflow. Called when the "Get and update workflow" button is pressed. /// Expects the CreateWorkflow method to be run first. /// </summary> private bool GetAndUpdateWorkflow() { // Get the workflow WorkflowInfo updateWorkflow = WorkflowInfoProvider.GetWorkflowInfo("MyNewWorkflow"); if (updateWorkflow != null) { // Update the properties updateWorkflow.WorkflowDisplayName = updateWorkflow.WorkflowDisplayName.ToLowerCSafe(); // Save the changes WorkflowInfoProvider.SetWorkflowInfo(updateWorkflow); return(true); } return(false); }
/// <summary> /// Creates workflow. Called when the "Create workflow" button is pressed. /// </summary> private bool CreateWorkflow() { // Create new workflow object WorkflowInfo newWorkflow = new WorkflowInfo(); // Set the properties newWorkflow.WorkflowDisplayName = "My new workflow"; newWorkflow.WorkflowName = "MyNewWorkflow"; // Save the workflow WorkflowInfoProvider.SetWorkflowInfo(newWorkflow); // Create the three default workflow steps WorkflowStepInfoProvider.CreateDefaultWorkflowSteps(newWorkflow); return(true); }
/// <summary> /// Gets and updates process. Called when the "Get and update process" button is pressed. /// Expects the CreateProcess method to be run first. /// </summary> private bool GetAndUpdateProcess() { // Get the process WorkflowInfo modifyProcess = WorkflowInfoProvider.GetWorkflowInfo("MyNewProcess", WorkflowTypeEnum.Automation); if (modifyProcess != null) { // Update the properties modifyProcess.WorkflowDisplayName = modifyProcess.WorkflowDisplayName.ToLower(); // Save the changes WorkflowInfoProvider.SetWorkflowInfo(modifyProcess); return(true); } return(false); }