/// <summary>
        /// To the model.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public static WorkflowActionType ToModel(this WorkflowActionTypeDto value)
        {
            WorkflowActionType result = new WorkflowActionType();

            value.CopyToModel(result);
            return(result);
        }
Beispiel #2
0
 internal static WorkflowAction Activate(WorkflowActionType actionType, WorkflowActivity activity)
 {
     using (var rockContext = new RockContext())
     {
         return(Activate(actionType, activity, rockContext));
     }
 }
        /// <summary>
        /// Deletes the specified item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        public override bool Delete(WorkflowActionType item)
        {
            var actionService = new WorkflowActionService((RockContext)this.Context);

            foreach (var action in actionService.Queryable().Where(a => a.ActionTypeId == item.Id))
            {
                actionService.Delete(action);
            }
            return(base.Delete(item));
        }
Beispiel #4
0
        /// <summary>
        /// Activates the specified action type.
        /// </summary>
        /// <param name="actionType">Type of the action.</param>
        /// <param name="activity">The activity.</param>
        /// <returns></returns>
        internal static WorkflowAction Activate(WorkflowActionType actionType, WorkflowActivity activity)
        {
            var action = new WorkflowAction();

            action.Activity   = activity;
            action.ActionType = actionType;

            action.AddSystemLogEntry("Activated");

            return(action);
        }
Beispiel #5
0
 /// <summary>
 /// Copies the properties from another WorkflowActionType object to this WorkflowActionType object
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="source">The source.</param>
 public static void CopyPropertiesFrom(this WorkflowActionType target, WorkflowActionType source)
 {
     target.ActivityTypeId               = source.ActivityTypeId;
     target.Name                         = source.Name;
     target.Order                        = source.Order;
     target.EntityTypeId                 = source.EntityTypeId;
     target.IsActionCompletedOnSuccess   = source.IsActionCompletedOnSuccess;
     target.IsActivityCompletedOnSuccess = source.IsActivityCompletedOnSuccess;
     target.Id   = source.Id;
     target.Guid = source.Guid;
 }
Beispiel #6
0
        /// <summary>
        /// Activates the specified <see cref="Rock.Model.WorkflowAction" />.
        /// </summary>
        /// <param name="actionType">The <see cref="Rock.Model.WorkflowActionType" /> to be activated.</param>
        /// <param name="activity">The <see cref="Rock.Model.WorkflowActivity" /> that this WorkflowAction belongs to..</param>
        /// <param name="rockContext">The rock context.</param>
        /// <returns>
        /// The <see cref="Rock.Model.WorkflowAction" />
        /// </returns>
        internal static WorkflowAction Activate(WorkflowActionType actionType, WorkflowActivity activity, RockContext rockContext)
        {
            var action = new WorkflowAction();

            action.Activity   = activity;
            action.ActionType = actionType;
            action.LoadAttributes(rockContext);

            action.AddLogEntry("Activated");

            return(action);
        }
Beispiel #7
0
 /// <summary>
 /// Clones this WorkflowActionType object to a new WorkflowActionType object
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="deepCopy">if set to <c>true</c> a deep copy is made. If false, only the basic entity properties are copied.</param>
 /// <returns></returns>
 public static WorkflowActionType Clone(this WorkflowActionType source, bool deepCopy)
 {
     if (deepCopy)
     {
         return(source.Clone() as WorkflowActionType);
     }
     else
     {
         var target = new WorkflowActionType();
         target.CopyPropertiesFrom(source);
         return(target);
     }
 }
Beispiel #8
0
        internal static WorkflowAction Activate(WorkflowActionType actionType, WorkflowActivity activity, RockContext rockContext)
        {
            if (actionType != null)
            {
                var actionTypeCache = WorkflowActionTypeCache.Get(actionType.Id);
                var action          = Activate(actionTypeCache, activity, rockContext);
                if (action != null)
                {
                    action.ActionType = actionType;
                }
                return(action);
            }

            return(null);
        }
 /// <summary>
 /// Copies the properties from another WorkflowActionType object to this WorkflowActionType object
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="source">The source.</param>
 public static void CopyPropertiesFrom(this WorkflowActionType target, WorkflowActionType source)
 {
     target.Id                           = source.Id;
     target.ActivityTypeId               = source.ActivityTypeId;
     target.CriteriaAttributeGuid        = source.CriteriaAttributeGuid;
     target.CriteriaComparisonType       = source.CriteriaComparisonType;
     target.CriteriaValue                = source.CriteriaValue;
     target.EntityTypeId                 = source.EntityTypeId;
     target.IsActionCompletedOnSuccess   = source.IsActionCompletedOnSuccess;
     target.IsActivityCompletedOnSuccess = source.IsActivityCompletedOnSuccess;
     target.Name                         = source.Name;
     target.Order                        = source.Order;
     target.WorkflowFormId               = source.WorkflowFormId;
     target.CreatedDateTime              = source.CreatedDateTime;
     target.ModifiedDateTime             = source.ModifiedDateTime;
     target.CreatedByPersonAliasId       = source.CreatedByPersonAliasId;
     target.ModifiedByPersonAliasId      = source.ModifiedByPersonAliasId;
     target.Guid                         = source.Guid;
     target.ForeignId                    = source.ForeignId;
 }
 /// <summary>
 /// Instantiates a new DTO object from the entity
 /// </summary>
 /// <param name="workflowActionType"></param>
 public WorkflowActionTypeDto(WorkflowActionType workflowActionType)
 {
     CopyFromModel(workflowActionType);
 }
 /// <summary>
 /// To the dto.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public static WorkflowActionTypeDto ToDto(this WorkflowActionType value)
 {
     return(new WorkflowActionTypeDto(value));
 }