Пример #1
0
        public static string step_SFSystemCalculator_continue(HttpContext context)
        {
            WorkflowDefinition workflowDefinition = new WorkflowDefinition()
            {
                Workflow    = WorkflowDefinitions.workflow_SFSystemCalculator(),
                Correlation = new WorkflowCorrelation()
                {
                    CorrelationId = Guid.Parse(context.Request.Form["correlationid"])
                },
            };
            int numero = 0;

            int.TryParse(context.Request.Form["number"], out numero);

            var request = new SFSystemCalculatorOpRequest()
            {
                Number = numero,
                Op     = context.Request.Form["op"]
            };

            var response = manager.ContinueWorkflow <SFSystemCalculatorOpRequest, SFSystemCalculatorOpResponse>(workflowDefinition, request, "continue");

            StringBuilder sb = new StringBuilder();

            if (response != null && response.Risultato.Esito && response.Executed)
            {
                sb.Append("<script>");
                sb.Append("function setOpt(op){document.getElementById('op').value = op.value;}");
                sb.Append("</script>");

                sb.Append($"Workflow SFSystemCalculator calcolo eseguito</br></br>");
                sb.Append("<form action='/step' method='post'>");
                sb.Append($"<input type='hidden' name='correlationid' value='{workflowDefinition.Correlation.CorrelationId}' />");
                sb.Append("<input type='hidden' name='step' value='step_SFSystemCalculator_continue' />");
                sb.Append("<input type='hidden' name='op' id='op'/>");
                sb.Append("<div>");
                sb.Append("<div><input type='text' name='number' value='0'/></div>");
                sb.Append("<div><input onclick='setOpt(this);' type='submit' value='+' style='width:30px;' /> <input onclick='setOpt(this);' type='submit' value='-' style='width:30px;'/></div>");
                sb.Append("<div><input onclick='setOpt(this);' type='submit' value='*' style='width:30px;' /> <input onclick='setOpt(this);' type='submit' value=':' style='width:30px;'/></div>");
                sb.Append("</div>");
                sb.Append("</form>");
                sb.Append("<form action='/step' method='post'>");
                sb.Append($"<input type='hidden' name='correlationid' value='{workflowDefinition.Correlation.CorrelationId}' />");
                sb.Append("<input type='hidden' name='step' value='step_SFSystemCalculator_end' />");
                sb.Append("<input onclick='setOpt(this);' type='submit' value='Fine'/> ");
                sb.Append("</form>");
            }
            else if (response != null && !response.Risultato.Esito)
            {
                sb.Append($"<p style='color:red'>{response.Risultato.Message}</p>");
            }

            return(sb.ToString());
        }
Пример #2
0
        public static string sample_SFSystemCalculator(HttpContext context)
        {
            WorkflowDefinition workflowDefinition = new WorkflowDefinition()
            {
                Correlation = new WorkflowCorrelation()
                {
                    CorrelationId = Guid.NewGuid()
                },
                Workflow = WorkflowDefinitions.workflow_SFSystemCalculator(),
            };

            var response = manager.StartWorkflow <SFSystemCalculatorStartRequest, SFSystemCalculatorStartResponse>(workflowDefinition, null, "Start");

            StringBuilder sb = new StringBuilder();

            if (response != null && response.Started)
            {
                sb.Append("<script>");
                sb.Append("function setOpt(op){document.getElementById('op').value = op.value;}");
                sb.Append("</script>");

                sb.Append($"Workflow SFSystemCalculator partito</br></br>");
                sb.Append("<form action='/step' method='post'>");
                sb.Append($"<input type='hidden' name='correlationid' value='{workflowDefinition.Correlation.CorrelationId}' />");
                sb.Append("<input type='hidden' name='step' value='step_SFSystemCalculator_continue' />");
                sb.Append("<input type='hidden' name='op' id='op'/>");

                sb.Append("<div>");
                sb.Append("<div><input type='text' name='number' value='0'/></div>");
                sb.Append("<div><input onclick='setOpt(this);' type='submit' value='+' style='width:30px;' /> <input onclick='setOpt(this);' type='submit' value='-' style='width:30px;'/></div>");
                sb.Append("<div><input onclick='setOpt(this);' type='submit' value='*' style='width:30px;' /> <input onclick='setOpt(this);' type='submit' value=':' style='width:30px;'/></div>");
                sb.Append("</div>");

                sb.Append("</form>");
            }

            return(sb.ToString());
        }
Пример #3
0
        public static string step_SFSystemCalculator_end(HttpContext context)
        {
            WorkflowDefinition workflowDefinition = new WorkflowDefinition()
            {
                Workflow    = WorkflowDefinitions.workflow_SFSystemCalculator(),
                Correlation = new WorkflowCorrelation()
                {
                    CorrelationId = Guid.Parse(context.Request.Form["correlationid"])
                },
            };

            var request  = new SFSystemCalculatorEndRequest();
            var response = manager.ContinueWorkflow <SFSystemCalculatorEndRequest, SFSystemCalculatorEndResponse>(workflowDefinition, request, "end");

            StringBuilder sb = new StringBuilder();

            if (response != null)
            {
                sb.Append($"Il risultato e': { response.Result}");
            }

            return(sb.ToString());
        }