Пример #1
0
        private bool CheckCondition(ExecutionRequestParameters parameters)
        {
            if (parameters.ConditionType != ConditionType.Action || parameters.ConditionMethod == null ||
                parameters.ConditionMethod.OutputParameters.Count() != 1)
            {
                throw new InvalidOperationException();
            }

            if (ConsiderResultOnPreExecution && parameters.ConditionResultOnPreExecution.HasValue)
            {
                return(parameters.ConditionResultOnPreExecution.Value);
            }

            var response = ExecutionResponseParameters.Create(parameters.ProcessId, parameters.ActivityName, parameters.ParameterContainer);

            ExecuteMethod(parameters.ConditionMethod, response, parameters.ParameterContainer);
            var result = response.ParameterContainer.SingleOrDefault(p => p.Name == DefaultDefinitions.ParameterConditionResult.Name);

            if (result == null || result.Value == null || !(result.Value  is bool))
            {
                throw new InvalidOperationException();
            }

            return((bool)result.Value);
        }
Пример #2
0
        private static ExecutionResponseParameters GetExecutionResponseErrorParameters(ExecutionRequestParameters always,
                                                                                       Exception ex)
        {
            var errorResponse = string.IsNullOrEmpty(always.TransitionName)
                                    ? ExecutionResponseParameters.Create(always.ProcessId, always.ActivityName, ex)
                                    : ExecutionResponseParameters.Create(always.ProcessId, always.ActivityName,
                                                                         always.TransitionName, ex);

            return(errorResponse);
        }
Пример #3
0
        private ExecutionResponseParameters ExecuteMethod(ExecutionRequestParameters parameters)
        {
            var response = string.IsNullOrEmpty(parameters.TransitionName)
                               ? ExecutionResponseParameters.Create(parameters.ProcessId, parameters.ActivityName, parameters.ParameterContainer)
                               : ExecutionResponseParameters.Create(parameters.ProcessId, parameters.ActivityName, parameters.TransitionName, parameters.ParameterContainer);



            foreach (var method in parameters.Methods.OrderBy(m => m.Order))
            {
                ExecuteMethod(method, response, response.ParameterContainer);
            }


            return(response);
        }
Пример #4
0
 public ExecutionResponseEventArgs(ExecutionResponseParameters parameters)
 {
     Parameters = parameters;
 }
Пример #5
0
		public ExecutionResponseEventArgs(ExecutionResponseParameters parameters)
		{
			this.Parameters = parameters;
		}
Пример #6
0
        private bool PreExecuteProcessResponse(ProcessInstance processInstance, ExecutionResponseParameters response)
        {
            if (response.IsEmplty)
                return true;

            if (!response.IsError)
                FillParameters(processInstance, response as ExecutionResponseParametersComplete);
            else
            {
                throw (response as ExecutionResponseParametersError).Exception;
            }
            return false;
        }
Пример #7
0
 private bool PreExecuteProcessResponse(ExecutionResponseParameters response)
 {
     if (response.IsEmplty)
     {
         return true;
     }
     if (response.IsError)
     {
         throw (response as ExecutionResponseParametersError).Exception;
     }
     return false;
 }