Example #1
0
 /// <summary>
 /// Clones this WorkflowType object to a new WorkflowType 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 WorkflowType Clone(this WorkflowType source, bool deepCopy)
 {
     if (deepCopy)
     {
         return(source.Clone() as WorkflowType);
     }
     else
     {
         var target = new WorkflowType();
         target.CopyPropertiesFrom(source);
         return(target);
     }
 }
Example #2
0
 /// <summary>
 /// Copies the properties from another WorkflowType object to this WorkflowType object
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="source">The source.</param>
 public static void CopyPropertiesFrom(this WorkflowType target, WorkflowType source)
 {
     target.IsSystem    = source.IsSystem;
     target.IsActive    = source.IsActive;
     target.Name        = source.Name;
     target.Description = source.Description;
     target.CategoryId  = source.CategoryId;
     target.Order       = source.Order;
     target.WorkTerm    = source.WorkTerm;
     target.ProcessingIntervalSeconds = source.ProcessingIntervalSeconds;
     target.IsPersisted  = source.IsPersisted;
     target.LoggingLevel = source.LoggingLevel;
     target.Id           = source.Id;
     target.Guid         = source.Guid;
 }
Example #3
0
        public static Workflow Activate(WorkflowType workflowType, string name, RockContext rockContext)
        {
            if (workflowType != null)
            {
                var workflowTypeCache = WorkflowTypeCache.Get(workflowType.Id);
                var workflow          = Activate(workflowTypeCache, name, rockContext);
                if (workflow != null)
                {
                    workflow.WorkflowType = workflowType;
                }
                return(workflow);
            }

            return(null);
        }
 /// <summary>
 /// Copies the properties from another WorkflowType object to this WorkflowType object
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="source">The source.</param>
 public static void CopyPropertiesFrom(this WorkflowType target, WorkflowType source)
 {
     target.Id           = source.Id;
     target.CategoryId   = source.CategoryId;
     target.Description  = source.Description;
     target.IconCssClass = source.IconCssClass;
     target.IsActive     = source.IsActive;
     target.IsPersisted  = source.IsPersisted;
     target.IsSystem     = source.IsSystem;
     target.LoggingLevel = source.LoggingLevel;
     target.Name         = source.Name;
     target.Order        = source.Order;
     target.ProcessingIntervalSeconds = source.ProcessingIntervalSeconds;
     target.WorkTerm                = source.WorkTerm;
     target.CreatedDateTime         = source.CreatedDateTime;
     target.ModifiedDateTime        = source.ModifiedDateTime;
     target.CreatedByPersonAliasId  = source.CreatedByPersonAliasId;
     target.ModifiedByPersonAliasId = source.ModifiedByPersonAliasId;
     target.Guid      = source.Guid;
     target.ForeignId = source.ForeignId;
 }
Example #5
0
        /// <summary>
        /// Activates the specified workflow type.
        /// </summary>
        /// <param name="workflowType">Type of the workflow.</param>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        internal static Workflow Activate(WorkflowType workflowType, string name)
        {
            var workflow = new Workflow();

            workflow.WorkflowTypeId    = workflowType.Id;
            workflow.Name              = name;
            workflow.Status            = "Activated";
            workflow.IsProcessing      = false;
            workflow.ActivatedDateTime = DateTime.Now;

            workflow.AddSystemLogEntry("Activated");

            foreach (var activityType in workflowType.ActivityTypes.OrderBy(a => a.Order))
            {
                if (activityType.IsActivatedWithWorkflow)
                {
                    workflow.Activities.Add(WorkflowActivity.Activate(activityType, workflow));
                }
            }

            return(workflow);
        }
Example #6
0
 /// <summary>
 /// To the dto.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public static WorkflowTypeDto ToDto(this WorkflowType value)
 {
     return(new WorkflowTypeDto(value));
 }
Example #7
0
 /// <summary>
 /// Instantiates a new DTO object from the entity
 /// </summary>
 /// <param name="workflowType"></param>
 public WorkflowTypeDto(WorkflowType workflowType)
 {
     CopyFromModel(workflowType);
 }