Esempio n. 1
0
    /// <summary>
    /// Saves new workflow step's data into DB.
    /// </summary>
    /// <returns>Returns ID of created workflow step</returns>
    protected int SaveNewWorkflowStep()
    {
        SetFormValues(CurrentStepInfo);

        // Ensure correct order for basic workflow
        if (CurrentWorkflow.IsBasic)
        {
            // Get published step info for the proper position
            WorkflowStepInfo psi = WorkflowStepInfoProvider.GetPublishedStep(WorkflowID);
            if (psi != null)
            {
                CurrentStepInfo.StepOrder = psi.StepOrder;
                // Move the published step down
                psi.StepOrder += 1;
                WorkflowStepInfoProvider.SetWorkflowStepInfo(psi);

                // Move the archived step down
                WorkflowStepInfo asi = WorkflowStepInfoProvider.GetArchivedStep(WorkflowID);
                if (asi != null)
                {
                    asi.StepOrder += 1;
                    WorkflowStepInfoProvider.SetWorkflowStepInfo(asi);
                }
            }
        }

        CurrentStepInfo.StepWorkflowID = WorkflowID;
        WorkflowStepInfoProvider.SetWorkflowStepInfo(CurrentStepInfo);
        return(CurrentStepInfo.StepID);
    }
Esempio n. 2
0
    /// <summary>
    /// Saves new wokflow step's data into DB.
    /// </summary>
    /// <returns>Returns ID of created wokflow step</returns>
    protected int SaveNewWorkflowStep()
    {
        WorkflowStepInfo wsi = new WorkflowStepInfo();

        wsi.StepDisplayName = txtWorkflowDisplayName.Text;
        wsi.StepName        = txtWorkflowCodeName.Text;

        // Get published step info for the proper position
        WorkflowStepInfo psi = WorkflowStepInfoProvider.GetPublishedStep(workflowid);

        if (psi != null)
        {
            wsi.StepOrder = psi.StepOrder;
            // Move the published step down
            psi.StepOrder += 1;
            WorkflowStepInfoProvider.SetWorkflowStepInfo(psi);

            // Move the archived step down
            WorkflowStepInfo asi = WorkflowStepInfoProvider.GetArchivedStep(workflowid);
            if (asi != null)
            {
                asi.StepOrder += 1;
                WorkflowStepInfoProvider.SetWorkflowStepInfo(asi);
            }
        }

        wsi.StepWorkflowID = workflowid;
        WorkflowStepInfoProvider.SetWorkflowStepInfo(wsi);
        return(wsi.StepID);
    }
    /// <summary>
    /// Ensures correct steps order
    /// </summary>
    private void EnsureStepsOrder()
    {
        // Ensure correct order for basic workflow
        if ((CurrentWorkflow != null) && CurrentWorkflow.IsBasic)
        {
            // Get published step info for the proper position
            WorkflowStepInfo psi = WorkflowStepInfoProvider.GetPublishedStep(CurrentWorkflow.WorkflowID);
            if (psi != null)
            {
                CurrentStepInfo.StepOrder = psi.StepOrder;
                // Move the published step down
                psi.StepOrder += 1;
                WorkflowStepInfo.Provider.Set(psi);

                // Move the archived step down
                WorkflowStepInfo asi = WorkflowStepInfoProvider.GetArchivedStep(CurrentWorkflow.WorkflowID);
                if (asi != null)
                {
                    asi.StepOrder += 1;
                    WorkflowStepInfo.Provider.Set(asi);
                }
            }
        }
    }