/// <summary> /// Gets or sets the workflow activity. /// </summary> /// <param name="activity">The activity.</param> /// <param name="expandInvalid">if set to <c>true</c> [expand invalid].</param> /// <value> /// The workflow activity. /// </value> public void GetWorkflowActivity(WorkflowActivity activity, bool expandInvalid) { EnsureChildControls(); if (!activity.CompletedDateTime.HasValue && _cbActivityIsComplete.Checked) { activity.CompletedDateTime = RockDateTime.Now; } else if (activity.CompletedDateTime.HasValue && !_cbActivityIsComplete.Checked) { activity.CompletedDateTime = null; } if (_ppAssignedToPerson.SelectedValue.HasValue) { activity.AssignedPersonAliasId = _ppAssignedToPerson.PersonAliasId; } else { activity.AssignedPersonAliasId = null; } if (_gpAssignedToGroup.SelectedValueAsInt().HasValue) { activity.AssignedGroupId = _gpAssignedToGroup.SelectedValueAsInt(); } else if (_ddlAssignedToRole.SelectedValueAsInt().HasValue) { activity.AssignedGroupId = _ddlAssignedToRole.SelectedValueAsInt(); } else { activity.AssignedGroupId = null; } Attribute.Helper.GetEditValues(_phAttributes, activity); foreach (WorkflowActionEditor actionEditor in this.Controls.OfType <WorkflowActionEditor>()) { var action = activity.Actions.Where(a => a.Guid.Equals(actionEditor.ActionGuid)).FirstOrDefault(); if (action != null) { actionEditor.GetWorkflowAction(action); } } if (expandInvalid && !Expanded && !activity.IsValid) { Expanded = true; } }
/// <summary> /// Gets the type of the workflow action. /// </summary> /// <returns></returns> public WorkflowActionType GetWorkflowActionType(bool expandInvalid) { EnsureChildControls(); WorkflowActionType result = new WorkflowActionType(); result.Guid = new Guid(_hfActionTypeGuid.Value); result.CriteriaAttributeGuid = _ddlCriteriaAttribute.SelectedValueAsGuid(); result.CriteriaComparisonType = _ddlCriteriaComparisonType.SelectedValueAsEnum <ComparisonType>(); result.CriteriaValue = _tbddlCriteriaValue.SelectedValue; result.Name = _tbActionTypeName.Text; result.EntityTypeId = _ddlEntityType.SelectedValueAsInt() ?? 0; result.IsActionCompletedOnSuccess = _cbIsActionCompletedOnSuccess.Checked; result.IsActivityCompletedOnSuccess = _cbIsActivityCompletedOnSuccess.Checked; var entityType = EntityTypeCache.Read(result.EntityTypeId); if (entityType != null && entityType.Name == typeof(Rock.Workflow.Action.UserEntryForm).FullName) { result.WorkflowForm = _formEditor.GetForm(); if (result.WorkflowForm == null) { result.WorkflowForm = new WorkflowActionForm(); result.WorkflowForm.Actions = "Submit^^^Your information has been submitted successfully."; var systemEmail = new SystemEmailService(new RockContext()).Get(SystemGuid.SystemEmail.WORKFLOW_FORM_NOTIFICATION.AsGuid()); if (systemEmail != null) { result.WorkflowForm.NotificationSystemEmailId = systemEmail.Id; } } } else { result.WorkflowForm = null; } result.LoadAttributes(); Rock.Attribute.Helper.GetEditValues(_phActionAttributes, result); if (expandInvalid && !result.IsValid) { Expanded = true; } return(result); }
/// <summary> /// Handles the SelectedIndexChanged event of the ddlEntityType control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void ddlEntityType_SelectedIndexChanged(object sender, EventArgs e) { WorkflowActionType workflowActionType = WorkflowActionType; workflowActionType.EntityTypeId = _ddlEntityType.SelectedValueAsInt() ?? 0; WorkflowActionType = workflowActionType; this.ForceContentVisible = true; }