SetForm() public method

Sets the form.
public SetForm ( WorkflowActionForm value, Rock.Model.Attribute>.Dictionary workflowTypeAttributes ) : void
value WorkflowActionForm The value.
workflowTypeAttributes Rock.Model.Attribute>.Dictionary The workflow type attributes.
return void
Esempio n. 1
0
        /// <summary>
        /// Sets the type of the workflow action.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="workflowTypeAttributes">The workflow type attributes.</param>
        public void SetWorkflowActionType(WorkflowActionType value, Dictionary <Guid, Rock.Model.Attribute> workflowTypeAttributes)
        {
            EnsureChildControls();
            _hfActionTypeGuid.Value = value.Guid.ToString();

            _ddlCriteriaAttribute.Items.Clear();
            _ddlCriteriaAttribute.Items.Add(new ListItem());

            _tbddlCriteriaValue.DropDownList.Items.Clear();
            _tbddlCriteriaValue.DropDownList.Items.Add(new ListItem());
            foreach (var attribute in workflowTypeAttributes)
            {
                var li = new ListItem(attribute.Value.Name, attribute.Key.ToString());
                li.Selected = value.CriteriaAttributeGuid.HasValue && value.CriteriaAttributeGuid.Value.ToString() == li.Value;
                _ddlCriteriaAttribute.Items.Add(li);

                _tbddlCriteriaValue.DropDownList.Items.Add(new ListItem(attribute.Value.Name, attribute.Key.ToString()));
            }

            _ddlCriteriaComparisonType.SetValue(value.CriteriaComparisonType.ConvertToInt());
            _tbddlCriteriaValue.SelectedValue = value.CriteriaValue;

            _tbActionTypeName.Text = value.Name;
            _wfatpEntityType.SetValue(EntityTypeCache.Get(value.EntityTypeId));
            _cbIsActivityCompletedOnSuccess.Checked = value.IsActivityCompletedOnSuccess;

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

            if (entityType != null && entityType.Name == typeof(Rock.Workflow.Action.UserEntryForm).FullName)
            {
                if (value.WorkflowForm == null)
                {
                    value.WorkflowForm         = new WorkflowActionForm();
                    value.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)
                    {
                        value.WorkflowForm.NotificationSystemEmailId = systemEmail.Id;
                    }
                }
                _formEditor.SetForm(value.WorkflowForm, workflowTypeAttributes);
                _cbIsActionCompletedOnSuccess.Checked = true;
                _cbIsActionCompletedOnSuccess.Enabled = false;
            }
            else
            {
                _formEditor.SetForm(null, workflowTypeAttributes);
                _cbIsActionCompletedOnSuccess.Checked = value.IsActionCompletedOnSuccess;
                _cbIsActionCompletedOnSuccess.Enabled = true;
            }

            _phActionAttributes.Controls.Clear();
            Rock.Attribute.Helper.AddEditControls(value, _phActionAttributes, true, ValidationGroup, new List <string>()
            {
                "Active", "Order"
            });
        }
Esempio n. 2
0
        /// <summary>
        /// Sets the type of the workflow action.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="workflowTypeAttributes">The workflow type attributes.</param>
        public void SetWorkflowActionType(WorkflowActionType value, Dictionary <Guid, Rock.Model.Attribute> workflowTypeAttributes)
        {
            EnsureChildControls();
            _hfActionTypeGuid.Value = value.Guid.ToString();

            _ddlCriteriaAttribute.Items.Clear();
            _ddlCriteriaAttribute.Items.Add(new ListItem());

            _tbddlCriteriaValue.DropDownList.Items.Clear();
            _tbddlCriteriaValue.DropDownList.Items.Add(new ListItem());
            foreach (var attribute in workflowTypeAttributes)
            {
                var li = new ListItem(attribute.Value.Name, attribute.Key.ToString());
                li.Selected = value.CriteriaAttributeGuid.HasValue && value.CriteriaAttributeGuid.Value.ToString() == li.Value;
                _ddlCriteriaAttribute.Items.Add(li);

                _tbddlCriteriaValue.DropDownList.Items.Add(new ListItem(attribute.Value.Name, attribute.Key.ToString()));
            }

            _ddlCriteriaComparisonType.SetValue(value.CriteriaComparisonType.ConvertToInt());
            _tbddlCriteriaValue.SelectedValue = value.CriteriaValue;

            _tbActionTypeName.Text = value.Name;
            _wfatpEntityType.SetValue(EntityTypeCache.Get(value.EntityTypeId));
            _cbIsActivityCompletedOnSuccess.Checked = value.IsActivityCompletedOnSuccess;

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

            if (entityType != null && entityType.Name == typeof(Rock.Workflow.Action.FormBuilder).FullName)
            {
                // Do nothing to the WorkflowForm property.
            }
            else if (entityType != null && entityType.Name == typeof(Rock.Workflow.Action.UserEntryForm).FullName)
            {
                if (value.WorkflowForm == null)
                {
                    value.WorkflowForm = CreateNewWorkflowForm();
                }
                _formEditor.SetForm(value.WorkflowForm, workflowTypeAttributes);
                _cbIsActionCompletedOnSuccess.Checked = true;
                _cbIsActionCompletedOnSuccess.Enabled = false;
            }
            else
            {
                _formEditor.SetForm(null, workflowTypeAttributes);
                _cbIsActionCompletedOnSuccess.Checked = value.IsActionCompletedOnSuccess;
                _cbIsActionCompletedOnSuccess.Enabled = true;
            }

            _phActionAttributes.Controls.Clear();
            Rock.Attribute.Helper.AddEditControls(value, _phActionAttributes, true, ValidationGroup, new List <string>()
            {
                "Active", "Order"
            });
        }