/// <summary> /// Saves any state that was modified after the <see cref="M:System.Web.UI.WebControls.Style.TrackViewState" /> method was invoked. /// </summary> /// <returns> /// An object that contains the current view state of the control; otherwise, if there is no view state associated with the control, null. /// </returns> protected override object SaveViewState() { EnsureChildControls(); ViewState["GroupTypeGuid"] = GroupTypeGuid; ViewState["InheritedGroupTypeId"] = _ddlGroupTypeInheritFrom.SelectedValueAsId(); return(base.SaveViewState()); }
/// <summary> /// Gets the type of the checkin group. /// </summary> /// <param name="rockContext">The rock context.</param> /// <returns></returns> public GroupType GetCheckinGroupType(RockContext rockContext) { EnsureChildControls(); GroupType result = new GroupType(); //// NOTE: A GroupType that was added will have an Id of 0 since it hasn't been saved to the database. //// So, we'll use Guid to uniquely identify in this Control since that'll work in both Saved and Unsaved cases. //// If it is saved, we do need the Id so that Attributes will work result.Id = _hfGroupTypeId.ValueAsInt(); result.Guid = new Guid(_hfGroupTypeGuid.Value); result.Name = _tbGroupTypeName.Text; result.InheritedGroupTypeId = _ddlGroupTypeInheritFrom.SelectedValueAsId(); result.LoadAttributes(rockContext); Rock.Attribute.Helper.GetEditValues(_phGroupTypeAttributes, result); result.ChildGroupTypes = new List <GroupType>(); int childGroupTypeOrder = 0; foreach (CheckinGroupTypeEditor checkinGroupTypeEditor in this.Controls.OfType <CheckinGroupTypeEditor>()) { GroupType childGroupType = checkinGroupTypeEditor.GetCheckinGroupType(rockContext); childGroupType.Order = childGroupTypeOrder++; result.ChildGroupTypes.Add(childGroupType); } result.Groups = new List <Group>(); int childGroupOrder = 0; foreach (CheckinGroupEditor checkinGroupEditor in this.Controls.OfType <CheckinGroupEditor>()) { Group childGroup = checkinGroupEditor.GetGroup(rockContext); childGroup.Order = childGroupOrder++; result.Groups.Add(childGroup); } return(result); }
/// <summary> /// Gets or sets the form. /// </summary> /// <value> /// The form. /// </value> public WorkflowActionForm GetForm() { EnsureChildControls(); var form = new WorkflowActionForm(); form.Guid = _hfFormGuid.Value.AsGuid(); if (form.Guid != Guid.Empty) { form.NotificationSystemEmailId = _ddlNotificationSystemEmail.SelectedValueAsId(); form.IncludeActionsInNotification = _cbIncludeActions.Checked; form.Header = _ceHeaderText.Text; form.Footer = _ceFooterText.Text; form.Actions = _falActions.Value; form.AllowNotes = _cbAllowNotes.Checked; foreach (var row in AttributeRows) { var formAttribute = new WorkflowActionFormAttribute(); formAttribute.Attribute = new Rock.Model.Attribute { Guid = row.AttributeGuid, Name = row.AttributeName }; formAttribute.Guid = row.Guid; formAttribute.Order = row.Order; formAttribute.IsVisible = row.IsVisible; formAttribute.IsReadOnly = !row.IsEditable; formAttribute.IsRequired = row.IsRequired; formAttribute.HideLabel = row.HideLabel; formAttribute.PreHtml = row.PreHtml; formAttribute.PostHtml = row.PostHtml; form.FormAttributes.Add(formAttribute); } form.ActionAttributeGuid = _ddlActionAttribute.SelectedValueAsGuid(); return(form); } return(null); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls( Type entityType, FilterField filterControl ) { var controls = new List<Control>(); // Add the registration template picker int? selectedTemplateId = null; if ( _ddlRegistrationTemplate != null ) { selectedTemplateId = _ddlRegistrationTemplate.SelectedValueAsId(); } _ddlRegistrationTemplate = new RockDropDownList(); _ddlRegistrationTemplate.CssClass = "js-registration-template"; _ddlRegistrationTemplate.ID = filterControl.ID + "_ddlRegistrationTemplate"; _ddlRegistrationTemplate.Label = "Registration Template"; _ddlRegistrationTemplate.DataTextField = "Name"; _ddlRegistrationTemplate.DataValueField = "Id"; _ddlRegistrationTemplate.DataSource = new RegistrationTemplateService( new RockContext() ).Queryable() .OrderBy( a => a.Name ) .Select( d => new { d.Id, d.Name } ) .ToList(); _ddlRegistrationTemplate.DataBind(); _ddlRegistrationTemplate.SelectedIndexChanged += ddlRegistrationTemplate_SelectedIndexChanged; _ddlRegistrationTemplate.AutoPostBack = true; _ddlRegistrationTemplate.SelectedValue = selectedTemplateId.ToStringSafe(); filterControl.Controls.Add( _ddlRegistrationTemplate ); // Now add the registration instance picker _ddlRegistrationInstance = new RockDropDownList(); _ddlRegistrationInstance.CssClass = "js-registration-instance"; _ddlRegistrationInstance.Label = "Registration Instance"; _ddlRegistrationInstance.ID = filterControl.ID + "_ddlRegistrationInstance"; filterControl.Controls.Add( _ddlRegistrationInstance ); PopulateRegistrationInstanceList( _ddlRegistrationTemplate.SelectedValueAsId () ?? 0 ); _rblRegistrationType = new RockRadioButtonList(); _rblRegistrationType.CssClass = "js-registration-type"; _rblRegistrationType.ID = filterControl.ID + "_registrationType"; _rblRegistrationType.RepeatDirection = RepeatDirection.Horizontal; _rblRegistrationType.Label = "Person"; _rblRegistrationType.Help = "Choose whether to filter by the person who did the registering (registrar) or the person who was registered (registrant)."; _rblRegistrationType.Items.Add( new ListItem( "Registrar", "1" ) ); _rblRegistrationType.Items.Add( new ListItem( "Registrant", "2" ) ); _rblRegistrationType.SelectedValue = "2"; filterControl.Controls.Add( _rblRegistrationType ); return new Control[3] { _ddlRegistrationTemplate, _ddlRegistrationInstance, _rblRegistrationType }; }