Example #1
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;
            }
        }
    }
Example #2
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;
            }
        }
    }
Example #3
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;
            }
        }
    }
Example #4
0
    protected override object OnListControlExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLowerInvariant())
        {
        case "edit":
            var editButton = (CMSGridActionButton)sender;

            var url = URLHelper.AddParameterToUrl(UIContextHelper.GetElementUrl(ModuleName.ONLINEMARKETING, "EditStepProperties.Cases.EditCase", true), "workflowStepId", WorkflowStepID.ToString());
            url = URLHelper.AddParameterToUrl(url, "dialog", "True");
            url = AddHashAndGraphParametersToUrl(url, editButton.CommandArgument);

            editButton.OnClientClick = ScriptHelper.GetModalDialogScript(url, "StepSourcePointEdit", "90%", "85%");
            break;

        case "allowaction":
            // Default case can't be moved or deleted. The same goes for condition step type case
            var container       = (GridViewRow)parameter;
            var sourcePointType = (SourcePointTypeEnum)ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue((DataRowView)container.DataItem, "Type"), 0);
            if ((sourcePointType != SourcePointTypeEnum.SwitchCase) || (CurrentStepInfo.StepType == WorkflowStepTypeEnum.Condition))
            {
                var button = (CMSGridActionButton)sender;
                button.Enabled = false;
                button.RemoveCssClass("js-_move");
                container.AddCssClass("unsortable");
            }
            break;

        default:
            return(base.OnListControlExternalDataBound(sender, sourceName, parameter));
        }

        return(parameter);
    }