GetForm() public method

Gets or sets the form.
public GetForm ( ) : WorkflowActionForm
return WorkflowActionForm
Example #1
0
        /// <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 = _wfatpEntityType.SelectedValueAsInt() ?? 0;
            result.IsActionCompletedOnSuccess   = _cbIsActionCompletedOnSuccess.Checked;
            result.IsActivityCompletedOnSuccess = _cbIsActivityCompletedOnSuccess.Checked;

            var entityType = EntityTypeCache.Get(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);
        }
Example #2
0
        /// <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 = _wfatpEntityType.SelectedValueAsInt() ?? 0;
            result.IsActionCompletedOnSuccess   = _cbIsActionCompletedOnSuccess.Checked;
            result.IsActivityCompletedOnSuccess = _cbIsActivityCompletedOnSuccess.Checked;

            var entityType = EntityTypeCache.Get(result.EntityTypeId);

            if (entityType != null && entityType.Name == typeof(Rock.Workflow.Action.FormBuilder).FullName)
            {
                // Do nothing to the existing WorkflowForm property.
            }
            else if (entityType != null && entityType.Name == typeof(Rock.Workflow.Action.UserEntryForm).FullName)
            {
                result.WorkflowForm = _formEditor.GetForm();
                if (result.WorkflowForm == null)
                {
                    result.WorkflowForm = CreateNewWorkflowForm();
                }
            }
            else
            {
                result.WorkflowForm = null;
            }

            result.LoadAttributes();
            Rock.Attribute.Helper.GetEditValues(_phActionAttributes, result);

            if (expandInvalid && !result.IsValid)
            {
                Expanded = true;
            }

            return(result);
        }