예제 #1
0
        /// <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>
        /// 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
            });
        }
예제 #3
0
        /// <summary>
        /// Gets or sets the group.
        /// </summary>
        /// <param name="group">The group.</param>
        /// <value>
        /// The group.
        /// </value>
        public void GetGroupValues(Group group)
        {
            group.Name     = _tbGroupName.Text;
            group.IsActive = _cbIsActive.Checked;

            var groupRequirementId = _ddlGroupRequirement.SelectedValueAsId();

            if (groupRequirementId.HasValue)
            {
                if (!group.GroupRequirements.Any(r => r.Id.Equals((int)groupRequirementId)))
                {
                    group.GroupRequirements.Add(new GroupRequirement {
                        GroupRequirementTypeId = (int)groupRequirementId, MustMeetRequirementToAddMember = true
                    });
                }
            }
            else
            {
                group.GroupRequirements.Clear();
            }

            Rock.Attribute.Helper.GetEditValues(_phGroupAttributes, group);
        }
예제 #4
0
        /// <summary>
        /// Handles the SelectedIndexChanged event of the ddlInteractionChannel 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 ddlInteractionChannel_SelectedIndexChanged(object sender, EventArgs e)
        {
            int?interactionChannelId = ddlInteractionChannel.SelectedValueAsId();

            PopulateInteractionComponent(interactionChannelId, ddlInteractionComponent);
        }
예제 #5
0
파일: Sms.cs 프로젝트: waldo2590/Rock
 /// <summary>
 /// Updates the a communication record from control values.
 /// </summary>
 /// <param name="communication">The communication.</param>
 public override void UpdateCommunication(CommunicationDetails communication)
 {
     EnsureChildControls();
     communication.SMSFromDefinedValueId = dvpFrom.SelectedValueAsId();
     communication.SMSMessage            = tbMessage.Text;
 }