/// <summary> /// Processes this instance. /// </summary> /// <param name="dto">The dto.</param> /// <param name="errorMessages">The error messages.</param> /// <returns></returns> /// <exception cref="System.SystemException"></exception> internal virtual bool Process(IDto dto, out List <string> errorMessages) { AddSystemLogEntry("Processing..."); ActionComponent workflowAction = this.ActionType.WorkflowAction; if (workflowAction == null) { throw new SystemException(string.Format("The '{0}' component does not exist, or is not active", workflowAction)); } this.ActionType.LoadAttributes(); bool success = workflowAction.Execute(this, dto, out errorMessages); AddSystemLogEntry(string.Format("Processing Complete (Success:{0})", success.ToString())); if (success) { if (this.ActionType.IsActionCompletedOnSuccess) { this.MarkComplete(); } if (this.ActionType.IsActivityCompletedOnSuccess) { this.Activity.MarkComplete(); } } return(success); }
/// <summary> /// Processes this WorkflowAction. /// </summary> /// <param name="rockContext">The rock context.</param> /// <param name="entity">The entity that the WorkflowAction is operating against.</param> /// <param name="errorMessages">A <see cref="System.Collections.Generic.List{String}" /> that will contain any error messages that occur while processing the WorkflowAction.</param> /// <returns> /// A <see cref="System.Boolean" /> value that is <c>true</c> if the process completed successfully; otherwise <c>false</c>. /// </returns> /// <exception cref="System.SystemException"></exception> internal virtual bool Process(RockContext rockContext, Object entity, out List <string> errorMessages) { AddLogEntry("Processing..."); var actionType = this.ActionTypeCache; if (actionType == null) { throw new SystemException(string.Format("ActionTypeId: {0} could not be loaded.", this.ActionTypeId)); } ActionComponent workflowAction = actionType.WorkflowAction; if (workflowAction == null) { throw new SystemException(string.Format("The '{0}' component does not exist, or is not active", actionType.EntityType)); } if (IsCriteriaValid) { bool success = workflowAction.Execute(rockContext, this, entity, out errorMessages); this.LastProcessedDateTime = RockDateTime.Now; if (errorMessages.Any()) { foreach (string errorMsg in errorMessages) { AddLogEntry("Error Occurred: " + errorMsg, true); } } AddLogEntry(string.Format("Processing Complete (Success:{0})", success.ToString())); if (success) { if (actionType.IsActionCompletedOnSuccess) { this.MarkComplete(); } if (actionType.IsActivityCompletedOnSuccess) { this.Activity.MarkComplete(); } } return(success); } else { errorMessages = new List <string>(); AddLogEntry("Criteria test failed. Action was not processed. Processing continued."); return(true); } }
/// <summary> /// Processes this WorkflowAction. /// </summary> /// <param name="rockContext">The rock context.</param> /// <param name="entity">The entity that the WorkflowAction is operating against.</param> /// <param name="errorMessages">A <see cref="System.Collections.Generic.List{String}" /> that will contain any error messages that occur while processing the WorkflowAction.</param> /// <returns> /// A <see cref="System.Boolean" /> value that is <c>true</c> if the process completed successfully; otherwise <c>false</c>. /// </returns> /// <exception cref="System.SystemException"></exception> internal virtual bool Process(RockContext rockContext, Object entity, out List <string> errorMessages) { AddLogEntry("Processing..."); ActionComponent workflowAction = this.ActionType.WorkflowAction; if (workflowAction == null) { throw new SystemException(string.Format("The '{0}' component does not exist, or is not active", workflowAction)); } this.ActionType.LoadAttributes(rockContext); if (IsCriteriaValid) { bool success = workflowAction.Execute(rockContext, this, entity, out errorMessages); this.LastProcessedDateTime = RockDateTime.Now; AddLogEntry(string.Format("Processing Complete (Success:{0})", success.ToString())); if (success && this.ActionType != null) { if (this.ActionType.IsActionCompletedOnSuccess) { this.MarkComplete(); } if (this.ActionType.IsActivityCompletedOnSuccess) { this.Activity.MarkComplete(); } } return(success); } else { errorMessages = new List <string>(); AddLogEntry("Criteria test failed. Action was not processed. Processing continued."); return(true); } }