Exemplo n.º 1
0
    protected override void OnListControlAction(string actionName, object actionArgument)
    {
        var graphName = QueryHelper.GetString("graph", String.Empty);

        switch (actionName.ToLowerInvariant())
        {
        case "delete":
            var sourcePointGuid = ValidationHelper.GetGuid(actionArgument, Guid.Empty);
            if (sourcePointGuid != Guid.Empty && CreateDeleteAction(sourcePointGuid))
            {
                WorkflowScriptHelper.RefreshDesignerFromDialog(Page, CurrentStepInfo.StepID, graphName);
            }
            break;

        case "#move":
            if (UniGridFunctions.TryParseMoveActionArguments(actionArgument.ToString(), out _, out var oldIndex, out var newIndex))
            {
                if (CurrentStepInfo.MoveSourcePoint(oldIndex, newIndex))
                {
                    WorkflowScriptHelper.RefreshDesignerFromDialog(Page, CurrentStepInfo.StepID, graphName);
                }
            }
            break;
        }
    }
Exemplo n.º 2
0
    protected void gridElem_OnAction(string actionName, object actionArgument)
    {
        Guid sourcePointGuid = ValidationHelper.GetGuid(actionArgument, Guid.Empty);

        if (sourcePointGuid != Guid.Empty)
        {
            string graphName = QueryHelper.GetString("graph", String.Empty);

            switch (actionName.ToLowerCSafe())
            {
            case "edit":
                string url = URLHelper.AddParameterToUrl(UIContextHelper.GetElementUrl("CMS", "Workflows.EditCase", false), "workflowStepId", WorkflowStepID.ToString());
                url = URLHelper.AddParameterToUrl(url, "isindialog", QueryHelper.GetBoolean("isindialog", false).ToString());
                url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url));
                url = URLHelper.AddParameterToUrl(url, "sourcepointGuid", sourcePointGuid.ToString());
                url = URLHelper.AddParameterToUrl(url, "graph", graphName);
                URLHelper.Redirect(url);
                break;

            case "delete":
                WorkflowStepInfo step = WorkflowStepInfoProvider.GetWorkflowStepInfo(WorkflowStepID);
                if (step == null)
                {
                    ShowError(GetString("graphservice.missingnode"));
                }
                string result = step.RemoveSourcePoint(sourcePointGuid);
                if (!String.IsNullOrEmpty(result))
                {
                    ShowError(result);
                }
                else
                {
                    WorkflowHelper.RefreshDesignerFromDialog(Page, CurrentStepInfo.StepID, graphName);
                }
                break;

            case "moveup":
                CurrentStepInfo.MoveSourcePointUp(sourcePointGuid);
                WorkflowHelper.RefreshDesignerFromDialog(Page, CurrentStepInfo.StepID, graphName);;
                break;

            case "movedown":
                CurrentStepInfo.MoveSourcePointDown(sourcePointGuid);
                WorkflowHelper.RefreshDesignerFromDialog(Page, CurrentStepInfo.StepID, graphName);
                break;
            }
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// Sets values from UI to provided source point object.
    /// </summary>
    /// <param name="sourcePoint">Source point</param>
    private void SetValues(SourcePoint sourcePoint)
    {
        if (sourcePoint != null)
        {
            sourcePoint.Label   = txtLabel.Text;
            sourcePoint.Text    = txtText.Text;
            sourcePoint.Tooltip = txtTooltip.Text;

            if (ShowCondition && (sourcePoint.Type != SourcePointTypeEnum.SwitchDefault))
            {
                sourcePoint.Condition = cbCondition.Text;
            }

            if (CurrentStepInfo != null && IsRejectPlaceholderVisible())
            {
                CurrentStepInfo.SetValue("StepAllowReject", chkStepAllowReject.Checked);
            }
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// Saves data of edited source point from controls to edited object.
    /// </summary>
    /// <param name="validateData">Indicates whether form data should be validated prior to save</param>
    public void SaveData(bool validateData)
    {
        if (Visible && !StopProcessing)
        {
            if (!validateData || ValidateData())
            {
                var graphName = QueryHelper.GetString("graph", String.Empty);

                if (CurrentSourcePoint == null)
                {
                    // Create new source point
                    SourcePoint sp = WorkflowHelper.CreateSourcePoint(CurrentWorkflow.WorkflowType, CurrentStepInfo.StepType);
                    SetValues(sp);

                    // AddSourcePoint saves the workflow step to database
                    CurrentStepInfo.AddSourcePoint(sp);
                    SourcePointGuid = sp.Guid;
                    if (String.IsNullOrEmpty(AfterCreateRedirectURL))
                    {
                        ShowChangesSaved();
                    }
                    else
                    {
                        var queryString = $"?workflowstepid={CurrentStepInfo.StepID}&sourcepointGuid={SourcePointGuid}&graph={graphName}&saved=1";
                        URLHelper.Redirect(UrlResolver.ResolveUrl(URLHelper.AppendQuery(AfterCreateRedirectURL, queryString)));
                    }
                }
                else
                {
                    // Edit existing source point
                    if (CurrentSourcePoint.Label != txtLabel.Text.Trim())
                    {
                        // Refresh header
                        ScriptHelper.RefreshTabHeader(Page);
                    }

                    SetValues(CurrentSourcePoint);
                    WorkflowScriptHelper.RefreshDesignerFromDialog(Page, CurrentStepInfo.StepID, graphName);
                }
            }
        }
    }
Exemplo n.º 5
0
    protected override void OnListControlAction(string actionName, object actionArgument)
    {
        var sourcePointGuid = ValidationHelper.GetGuid(actionArgument, Guid.Empty);
        var oldIndex        = CurrentStepInfo.StepDefinition.SourcePoints.FindIndex(i => i.Guid == sourcePointGuid);
        var graphName       = QueryHelper.GetString("graph", String.Empty);

        if (sourcePointGuid != Guid.Empty)
        {
            switch (actionName.ToLowerInvariant())
            {
            case "edit":
                var url = URLHelper.AddParameterToUrl(UIContextHelper.GetElementUrl(ModuleName.CMS, "Workflows.EditCase", false), "workflowStepId", WorkflowStepID.ToString());
                url = URLHelper.AddParameterToUrl(url, "isindialog", QueryHelper.GetBoolean("isindialog", false).ToString());
                url = AddHashAndGraphParametersToUrl(url, sourcePointGuid.ToString());

                URLHelper.Redirect(url);
                break;

            case "delete":
                if (CreateDeleteAction(sourcePointGuid))
                {
                    WorkflowScriptHelper.RefreshDesignerFromDialog(Page, CurrentStepInfo.StepID, graphName);
                }
                break;

            case "moveup":
                if (CurrentStepInfo.MoveSourcePoint(oldIndex, oldIndex - 1))
                {
                    WorkflowScriptHelper.RefreshDesignerFromDialog(Page, CurrentStepInfo.StepID, graphName);
                }
                break;

            case "movedown":
                if (CurrentStepInfo.MoveSourcePoint(oldIndex, oldIndex + 1))
                {
                    WorkflowScriptHelper.RefreshDesignerFromDialog(Page, CurrentStepInfo.StepID, graphName);
                }
                break;
            }
        }
    }
Exemplo n.º 6
0
    protected void gridElem_OnAction(string actionName, object actionArgument)
    {
        Guid sourcePointGuid = ValidationHelper.GetGuid(actionArgument, Guid.Empty);

        if (sourcePointGuid != Guid.Empty)
        {
            switch (actionName.ToLowerCSafe())
            {
            case "edit":
                if (!String.IsNullOrEmpty(ItemEditUrl))
                {
                    string url = URLHelper.AddParameterToUrl(ItemEditUrl, "workflowStepId", WorkflowStepID.ToString());
                    url = URLHelper.AddParameterToUrl(url, "sourcePointGuid", sourcePointGuid.ToString());
                    URLHelper.Redirect(url);
                }
                break;

            case "delete":
                WorkflowStepInfo step = WorkflowStepInfoProvider.GetWorkflowStepInfo(WorkflowStepID);
                if (step == null)
                {
                    ShowError(GetString("graphservice.missingnode"));
                }
                string result = step.RemoveSourcePoint(sourcePointGuid);
                if (!String.IsNullOrEmpty(result))
                {
                    ShowError(result);
                }
                break;

            case "moveup":
                CurrentStepInfo.MoveSourcePointUp(sourcePointGuid);
                break;

            case "movedown":
                CurrentStepInfo.MoveSourcePointDown(sourcePointGuid);
                break;
            }
        }
    }
Exemplo n.º 7
0
    /// <summary>
    /// Saves data of edited source point from controls to edited object.
    /// </summary>
    /// <param name="validateData">Indicates whether form data should be validated prior to save</param>
    public void SaveData(bool validateData)
    {
        if (Visible && !StopProcessing)
        {
            if (!validateData || ValidateData())
            {
                if (CurrentSourcePoint == null)
                {
                    // Create new source point
                    SourcePoint sp = WorkflowHelper.CreateSourcePoint(CurrentStepInfo.StepType);
                    SetValues(sp);

                    // AddSourcePoint saves the workflow step to database
                    CurrentStepInfo.AddSourcePoint(sp);
                    SourcePointGuid = sp.Guid;
                    if (String.IsNullOrEmpty(AfterCreateRedirectURL))
                    {
                        ShowChangesSaved();
                    }
                    else
                    {
                        URLHelper.Redirect(URLHelper.AppendQuery(AfterCreateRedirectURL, String.Format("?workflowstepid={0}&sourcepointguid={1}&saved=1", WorkflowStepId, SourcePointGuid)));
                    }
                }
                else
                {
                    // Edit existing source point
                    if (CurrentSourcePoint.Label != txtLabel.Text.Trim())
                    {
                        // Refresh header
                        ScriptHelper.RefreshTabHeader(Page, null);
                    }

                    SetValues(CurrentSourcePoint);
                }
            }
        }
    }