/// <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); }
/// <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); }
/// <summary> /// Handles the AddActionTypeClick event of the workflowActivityTypeEditor control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> /// <exception cref="System.NotImplementedException"></exception> protected void workflowActivityTypeEditor_AddActionTypeClick( object sender, EventArgs e ) { ParseControls(); var workflowActivityTypeEditor = sender as WorkflowActivityTypeEditor; if ( workflowActivityTypeEditor != null ) { var activityType = ActivityTypesState.Where( a => a.Guid == workflowActivityTypeEditor.ActivityTypeGuid ).FirstOrDefault(); var actionType = new WorkflowActionType(); actionType.Guid = Guid.NewGuid(); actionType.IsActionCompletedOnSuccess = true; actionType.Order = activityType.ActionTypes.Any() ? activityType.ActionTypes.Max( a => a.Order ) + 1 : 0; activityType.ActionTypes.Add( actionType ); var action = EntityTypeCache.Read( actionType.EntityTypeId ); if ( action != null ) { var rockContext = new RockContext(); Rock.Attribute.Helper.UpdateAttributes( action.GetEntityType(), actionType.TypeId, "EntityTypeId", actionType.EntityTypeId.ToString(), rockContext ); actionType.LoadAttributes( rockContext ); } ExpandedActions.Add( actionType.Guid ); BuildControls( true, activityType.Guid, actionType.Guid ); } }
/// <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; }