コード例 #1
0
        private static bool Execute(Guid id, string name, string parameters, bool isSetState, out string message)
        {
            try
            {
                var commandParameters = GetParameters(parameters);

                if (commandParameters.Any(p => p.Key == "EntityRoute"))
                {
                    var routeParam = commandParameters.Single(c => c.Key == "EntityRoute");
                    WorkflowOperations.SetRoute(id, new Guid(routeParam.Value.ToString()));
                }

                message = null;
                bool result;

                if (isSetState)
                {
                    result = WorkflowOperations.SetState(id, name, commandParameters, out message);
                }
                else
                {
                    result = WorkflowOperations.Execute(id, name, commandParameters, out message);
                }

                if (!result)
                {
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                message = ex.Message;
                return(false);
            }
        }
コード例 #2
0
        private static ActionResult Execute(Guid id, string name, string parameters, bool isSetState)
        {
            try
            {
                var commandParameters = GetParameters(parameters);

                if (commandParameters.Any(p => p.Key == "EntityRoute"))
                {
                    var routeParam = commandParameters.Single(c => c.Key == "EntityRoute");
                    WorkflowOperations.SetRoute(id, new Guid(routeParam.Value.ToString()));
                }

                string message = null;
                var    result  = false;

                if (isSetState)
                {
                    result = WorkflowOperations.SetState(id, name, commandParameters, out message);
                }
                else
                {
                    result = WorkflowOperations.Execute(id, name, commandParameters, out message);
                }

                if (!result)
                {
                    return(GetErrorResult(message));
                }
                return(GetSuccessResult());
            }
            catch (Exception ex)
            {
                Logger.Log.Error(ex);
                return(GetErrorResult(ex));
            }
        }