Inheritance: System.Web.UI.WebControls.TextBox, IRockControl
Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewFamilyContactInfoRow" /> class.
 /// </summary>
 public NewFamilyContactInfoRow()
     : base()
 {
     _pnbHomePhone = new PhoneNumberBox();
     _pnbCellPhone = new PhoneNumberBox();
     _ebEmail = new EmailBox();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewFamilyContactInfoRow" /> class.
 /// </summary>
 public NewFamilyContactInfoRow()
     : base()
 {
     _pnbHomePhone = new PhoneNumberBox();
     _pnbCellPhone = new PhoneNumberBox();
     _cbIsMessagingEnabled = new RockCheckBox();
     _ebEmail = new EmailBox();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewGroupMembersRow" /> class.
 /// </summary>
 public PreRegistrationChildRow()
     : base()
 {
     _lNickName      = new RockLiteral();
     _lLastName      = new RockLiteral();
     _tbNickName     = new RockTextBox();
     _tbLastName     = new RockTextBox();
     _ddlSuffix      = new DefinedValuePicker();
     _ddlGender      = new RockDropDownList();
     _dpBirthdate    = new DatePicker();
     _ddlGradePicker = new GradePicker {
         UseAbbreviation = true, UseGradeOffsetAsValue = true
     };
     _ddlGradePicker.Label = string.Empty;
     _pnbMobile            = new PhoneNumberBox();
     _ddlRelationshipType  = new RockDropDownList();
     _phAttributes         = new PlaceHolder();
     _lbDelete             = new LinkButton();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates the person field.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="setValue">if set to <c>true</c> [set value].</param>
        /// <param name="fieldValue">The field value.</param>
        private void CreatePersonField( RegistrationTemplateFormField field, bool setValue, object fieldValue )
        {
            switch ( field.PersonFieldType )
            {
                case RegistrationPersonFieldType.FirstName:
                    {
                        var tbFirstName = new RockTextBox();
                        tbFirstName.ID = "tbFirstName";
                        tbFirstName.Label = "First Name";
                        tbFirstName.Required = field.IsRequired;
                        tbFirstName.ValidationGroup = BlockValidationGroup;
                        tbFirstName.AddCssClass( "js-first-name" );
                        phRegistrantControls.Controls.Add( tbFirstName );

                        if ( setValue && fieldValue != null )
                        {
                            tbFirstName.Text = fieldValue.ToString();
                        }

                        break;
                    }

                case RegistrationPersonFieldType.LastName:
                    {
                        var tbLastName = new RockTextBox();
                        tbLastName.ID = "tbLastName";
                        tbLastName.Label = "Last Name";
                        tbLastName.Required = field.IsRequired;
                        tbLastName.ValidationGroup = BlockValidationGroup;
                        phRegistrantControls.Controls.Add( tbLastName );

                        if ( setValue && fieldValue != null )
                        {
                            tbLastName.Text = fieldValue.ToString();
                        }

                        break;
                    }

                case RegistrationPersonFieldType.Campus:
                    {
                        var cpHomeCampus = new CampusPicker();
                        cpHomeCampus.ID = "cpHomeCampus";
                        cpHomeCampus.Label = "Campus";
                        cpHomeCampus.Required = field.IsRequired;
                        cpHomeCampus.ValidationGroup = BlockValidationGroup;
                        cpHomeCampus.Campuses = CampusCache.All();

                        phRegistrantControls.Controls.Add( cpHomeCampus );

                        if ( setValue && fieldValue != null )
                        {
                            cpHomeCampus.SelectedCampusId = fieldValue.ToString().AsIntegerOrNull();
                        }
                        break;
                    }

                case RegistrationPersonFieldType.Address:
                    {
                        var acAddress = new AddressControl();
                        acAddress.ID = "acAddress";
                        acAddress.Label = "Address";
                        acAddress.UseStateAbbreviation = true;
                        acAddress.UseCountryAbbreviation = false;
                        acAddress.Required = field.IsRequired;
                        acAddress.ValidationGroup = BlockValidationGroup;

                        phRegistrantControls.Controls.Add( acAddress );

                        if ( setValue && fieldValue != null )
                        {
                            var value = fieldValue.ToString().FromJsonOrNull<Location>();
                            acAddress.SetValues( value );
                        }

                        break;
                    }

                case RegistrationPersonFieldType.Email:
                    {
                        var tbEmail = new EmailBox();
                        tbEmail.ID = "tbEmail";
                        tbEmail.Label = "Email";
                        tbEmail.Required = field.IsRequired;
                        tbEmail.ValidationGroup = BlockValidationGroup;
                        phRegistrantControls.Controls.Add( tbEmail );

                        if ( setValue && fieldValue != null )
                        {
                            tbEmail.Text = fieldValue.ToString();
                        }

                        break;
                    }

                case RegistrationPersonFieldType.Birthdate:
                    {
                        var bpBirthday = new BirthdayPicker();
                        bpBirthday.ID = "bpBirthday";
                        bpBirthday.Label = "Birthday";
                        bpBirthday.Required = field.IsRequired;
                        bpBirthday.ValidationGroup = BlockValidationGroup;
                        phRegistrantControls.Controls.Add( bpBirthday );

                        if ( setValue && fieldValue != null )
                        {
                            var value = fieldValue as DateTime?;
                            bpBirthday.SelectedDate = value;
                        }

                        break;
                    }

                case RegistrationPersonFieldType.Gender:
                    {
                        var ddlGender = new RockDropDownList();
                        ddlGender.ID = "ddlGender";
                        ddlGender.Label = "Gender";
                        ddlGender.Required = field.IsRequired;
                        ddlGender.ValidationGroup = BlockValidationGroup;
                        ddlGender.BindToEnum<Gender>( false );

                        // change the 'Unknow' value to be blank instead
                        ddlGender.Items.FindByValue( "0" ).Text = string.Empty;

                        phRegistrantControls.Controls.Add( ddlGender );

                        if ( setValue && fieldValue != null )
                        {
                            var value = fieldValue.ToString().ConvertToEnumOrNull<Gender>() ?? Gender.Unknown;
                            ddlGender.SetValue( value.ConvertToInt() );
                        }

                        break;
                    }

                case RegistrationPersonFieldType.MaritalStatus:
                    {
                        var ddlMaritalStatus = new RockDropDownList();
                        ddlMaritalStatus.ID = "ddlMaritalStatus";
                        ddlMaritalStatus.Label = "Marital Status";
                        ddlMaritalStatus.Required = field.IsRequired;
                        ddlMaritalStatus.ValidationGroup = BlockValidationGroup;
                        ddlMaritalStatus.BindToDefinedType( DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.PERSON_MARITAL_STATUS.AsGuid() ), true );
                        phRegistrantControls.Controls.Add( ddlMaritalStatus );

                        if ( setValue && fieldValue != null )
                        {
                            var value = fieldValue.ToString().AsInteger();
                            ddlMaritalStatus.SetValue( value );
                        }

                        break;
                    }

                case RegistrationPersonFieldType.MobilePhone:
                    {
                        var dv = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_MOBILE );
                        if ( dv != null )
                        {
                            var ppMobile = new PhoneNumberBox();
                            ppMobile.ID = "ppMobile";
                            ppMobile.Label = dv.Value;
                            ppMobile.Required = field.IsRequired;
                            ppMobile.ValidationGroup = BlockValidationGroup;
                            ppMobile.CountryCode = PhoneNumber.DefaultCountryCode();

                            phRegistrantControls.Controls.Add( ppMobile );

                            if ( setValue && fieldValue != null )
                            {
                                var value = fieldValue as PhoneNumber;
                                if ( value != null )
                                {
                                    ppMobile.CountryCode = value.CountryCode;
                                    ppMobile.Number = value.ToString();
                                }
                            }
                        }

                        break;
                    }
                case RegistrationPersonFieldType.HomePhone:
                    {
                        var dv = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_HOME );
                        if ( dv != null )
                        {
                            var ppHome = new PhoneNumberBox();
                            ppHome.ID = "ppHome";
                            ppHome.Label = dv.Value;
                            ppHome.Required = field.IsRequired;
                            ppHome.ValidationGroup = BlockValidationGroup;
                            ppHome.CountryCode = PhoneNumber.DefaultCountryCode();

                            phRegistrantControls.Controls.Add( ppHome );

                            if ( setValue && fieldValue != null )
                            {
                                var value = fieldValue as PhoneNumber;
                                if ( value != null )
                                {
                                    ppHome.CountryCode = value.CountryCode;
                                    ppHome.Number = value.ToString();
                                }
                            }
                        }

                        break;
                    }

                case RegistrationPersonFieldType.WorkPhone:
                    {
                        var dv = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_WORK );
                        if ( dv != null )
                        {
                            var ppWork = new PhoneNumberBox();
                            ppWork.ID = "ppWork";
                            ppWork.Label = dv.Value;
                            ppWork.Required = field.IsRequired;
                            ppWork.ValidationGroup = BlockValidationGroup;
                            ppWork.CountryCode = PhoneNumber.DefaultCountryCode();

                            phRegistrantControls.Controls.Add( ppWork );

                            if ( setValue && fieldValue != null )
                            {
                                var value = fieldValue.ToString().FromJsonOrNull<PhoneNumber>();
                                if ( value != null )
                                {
                                    ppWork.CountryCode = value.CountryCode;
                                    ppWork.Number = value.ToString();
                                }
                            }
                        }

                        break;
                    }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_controlsLoaded)
            {
                Controls.Clear();

                _tbName          = new RockTextBox();
                _tbName.ID       = this.ID + "_tbName";
                _tbName.Label    = "Registration Instance Name";
                _tbName.Help     = "The name will be used to describe the registration on the registration screens and emails.";
                _tbName.Required = true;
                Controls.Add(_tbName);

                _cbIsActive       = new RockCheckBox();
                _cbIsActive.ID    = this.ID + "_cbIsActive";
                _cbIsActive.Label = "Active";
                _cbIsActive.Text  = "Yes";
                Controls.Add(_cbIsActive);

                _tbUrlSlug         = new RockTextBox();
                _tbUrlSlug.ID      = this.ID + "_tbUrlSlug";
                _tbUrlSlug.Label   = "URL Slug";
                _tbUrlSlug.Visible = false;
                Controls.Add(_tbUrlSlug);


                _ceDetails              = new CodeEditor();
                _ceDetails.ID           = this.ID + "_ceDetails";
                _ceDetails.Label        = "Details";
                _ceDetails.EditorMode   = CodeEditorMode.Html;
                _ceDetails.EditorTheme  = CodeEditorTheme.Rock;
                _ceDetails.EditorHeight = "100";
                _ceDetails.Visible      = false; // hiding this out for now. Struggling where we'd even use this, but instead of removing it we'll just comment it out for now.
                Controls.Add(_ceDetails);


                _dtpStart       = new DateTimePicker();
                _dtpStart.ID    = this.ID + "_dtpStart";
                _dtpStart.Label = "Registration Starts";
                Controls.Add(_dtpStart);

                _dtpEnd       = new DateTimePicker();
                _dtpEnd.ID    = this.ID + "_dtpEnd";
                _dtpEnd.Label = "Registration Ends";
                Controls.Add(_dtpEnd);

                _nbMaxAttendees            = new NumberBox();
                _nbMaxAttendees.ID         = this.ID + "_nbMaxAttendees";
                _nbMaxAttendees.Label      = "Maximum Attendees";
                _nbMaxAttendees.NumberType = ValidationDataType.Integer;
                Controls.Add(_nbMaxAttendees);

                _wtpRegistrationWorkflow       = new WorkflowTypePicker();
                _wtpRegistrationWorkflow.ID    = this.ID + "_wtpRegistrationWorkflow";
                _wtpRegistrationWorkflow.Label = "Registration Workflow";
                _wtpRegistrationWorkflow.Help  = "An optional workflow type to launch when a new registration is completed.";
                Controls.Add(_wtpRegistrationWorkflow);

                _cbCost       = new CurrencyBox();
                _cbCost.ID    = this.ID + "_cbCost";
                _cbCost.Label = "Cost";
                _cbCost.Help  = "The cost per registrant";
                Controls.Add(_cbCost);

                _cbMinimumInitialPayment       = new CurrencyBox();
                _cbMinimumInitialPayment.ID    = this.ID + "_cbMinimumInitialPayment";
                _cbMinimumInitialPayment.Label = "Minimum Initial Payment";
                _cbMinimumInitialPayment.Help  = "The minimum amount required per registrant. Leave value blank if full amount is required.";
                Controls.Add(_cbMinimumInitialPayment);

                _cbDefaultPaymentAmount       = new CurrencyBox();
                _cbDefaultPaymentAmount.ID    = this.ID + "_cbDefaultPaymentAmount";
                _cbDefaultPaymentAmount.Label = "Default Payment Amount";
                _cbDefaultPaymentAmount.Help  = "The default payment amount per registrant. Leave value blank to default to the full amount. NOTE: This requires that a Minimum Initial Payment is defined.";
                Controls.Add(_cbDefaultPaymentAmount);

                _apAccount          = new AccountPicker();
                _apAccount.ID       = this.ID + "_apAccount";
                _apAccount.Label    = "Account";
                _apAccount.Required = true;
                Controls.Add(_apAccount);

                _ppContact                     = new PersonPicker();
                _ppContact.ID                  = this.ID + "_ppContact";
                _ppContact.Label               = "Contact";
                _ppContact.SelectPerson       += _ppContact_SelectPerson;
                _ppContact.EnableSelfSelection = true;
                Controls.Add(_ppContact);

                _pnContactPhone       = new PhoneNumberBox();
                _pnContactPhone.ID    = this.ID + "_pnContactPhone";
                _pnContactPhone.Label = "Contact Phone";
                Controls.Add(_pnContactPhone);

                _ebContactEmail       = new EmailBox();
                _ebContactEmail.ID    = this.ID + "_ebContactEmail";
                _ebContactEmail.Label = "Contact Email";
                Controls.Add(_ebContactEmail);

                _dtpSendReminder       = new DateTimePicker();
                _dtpSendReminder.ID    = this.ID + "_dtpSendReminder";
                _dtpSendReminder.Label = "Send Reminder Date";
                Controls.Add(_dtpSendReminder);

                _cbReminderSent       = new RockCheckBox();
                _cbReminderSent.ID    = this.ID + "_cbReminderSent";
                _cbReminderSent.Label = "Reminder Sent";
                _cbReminderSent.Text  = "Yes";
                Controls.Add(_cbReminderSent);

                _htmlRegistrationInstructions         = new HtmlEditor();
                _htmlRegistrationInstructions.ID      = this.ID + "_htmlRegistrationInstructions";
                _htmlRegistrationInstructions.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlRegistrationInstructions.Label   = "Registration Instructions";
                _htmlRegistrationInstructions.Help    = "These instructions will appear at the beginning of the registration process when selecting how many registrants for the registration. These instructions can be provided on the registration template also. Any instructions here will override the instructions on the template.";
                _htmlRegistrationInstructions.Height  = 200;
                Controls.Add(_htmlRegistrationInstructions);

                _htmlAdditionalReminderDetails         = new HtmlEditor();
                _htmlAdditionalReminderDetails.ID      = this.ID + "_htmlAdditionalReminderDetails";
                _htmlAdditionalReminderDetails.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlAdditionalReminderDetails.Label   = "Additional Reminder Details";
                _htmlAdditionalReminderDetails.Help    = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _htmlAdditionalReminderDetails.Height  = 200;
                Controls.Add(_htmlAdditionalReminderDetails);

                _htmlAdditionalConfirmationDetails         = new HtmlEditor();
                _htmlAdditionalConfirmationDetails.ID      = this.ID + "_htmlAdditionalConfirmationDetails";
                _htmlAdditionalConfirmationDetails.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlAdditionalConfirmationDetails.Label   = "Additional Confirmation Details";
                _htmlAdditionalConfirmationDetails.Help    = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _htmlAdditionalConfirmationDetails.Height  = 200;
                Controls.Add(_htmlAdditionalConfirmationDetails);

                _controlsLoaded = true;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Sets the phone number.
        /// </summary>
        /// <param name="rockContext">The rock context.</param>
        /// <param name="person">The person.</param>
        /// <param name="pnbNumber">The PNB number.</param>
        /// <param name="cbSms">The cb SMS.</param>
        /// <param name="phoneTypeGuid">The phone type unique identifier.</param>
        /// <param name="changes">The changes.</param>
        private void SetPhoneNumber( RockContext rockContext, Person person, PhoneNumberBox pnbNumber, RockCheckBox cbSms, Guid phoneTypeGuid, List<string> changes )
        {
            var phoneType = DefinedValueCache.Read( phoneTypeGuid );
            if ( phoneType != null )
            {
                var phoneNumber = person.PhoneNumbers.FirstOrDefault( n => n.NumberTypeValueId == phoneType.Id );
                string oldPhoneNumber = string.Empty;
                if ( phoneNumber == null )
                {
                    phoneNumber = new PhoneNumber { NumberTypeValueId = phoneType.Id };
                }
                else
                {
                    oldPhoneNumber = phoneNumber.NumberFormattedWithCountryCode;
                }

                phoneNumber.CountryCode = PhoneNumber.CleanNumber( pnbNumber.CountryCode );
                phoneNumber.Number = PhoneNumber.CleanNumber( pnbNumber.Number );

                if ( string.IsNullOrWhiteSpace( phoneNumber.Number ) )
                {
                    if ( phoneNumber.Id > 0 )
                    {
                        new PhoneNumberService( rockContext ).Delete( phoneNumber );
                        person.PhoneNumbers.Remove( phoneNumber );
                    }
                }
                else
                {
                    if ( phoneNumber.Id <= 0)
                    {
                        person.PhoneNumbers.Add( phoneNumber );
                    }
                    if ( cbSms != null && cbSms.Checked )
                    {
                        phoneNumber.IsMessagingEnabled = true;
                        person.PhoneNumbers
                            .Where( n => n.NumberTypeValueId != phoneType.Id )
                            .ToList()
                            .ForEach( n => n.IsMessagingEnabled = false );
                    }
                }

                History.EvaluateChange( changes,
                    string.Format( "{0} Phone", phoneType.Value ),
                    oldPhoneNumber, phoneNumber.NumberFormattedWithCountryCode );
            }
        }
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_controlsLoaded)
            {
                Controls.Clear();

                _tbName          = new RockTextBox();
                _tbName.ID       = this.ID + "_tbName";
                _tbName.Label    = "Registration Instance Name";
                _tbName.Help     = "The name will be used to describe the registration on the registration screens and emails.";
                _tbName.Required = true;
                Controls.Add(_tbName);

                _cbIsActive       = new RockCheckBox();
                _cbIsActive.ID    = this.ID + "_cbIsActive";
                _cbIsActive.Label = "Active";
                _cbIsActive.Text  = "Yes";
                Controls.Add(_cbIsActive);

                _tbUrlSlug         = new RockTextBox();
                _tbUrlSlug.ID      = this.ID + "_tbUrlSlug";
                _tbUrlSlug.Label   = "URL Slug";
                _tbUrlSlug.Visible = false;
                Controls.Add(_tbUrlSlug);


                _ceDetails              = new CodeEditor();
                _ceDetails.ID           = this.ID + "_ceDetails";
                _ceDetails.Label        = "Details";
                _ceDetails.EditorMode   = CodeEditorMode.Html;
                _ceDetails.EditorTheme  = CodeEditorTheme.Rock;
                _ceDetails.EditorHeight = "100";
                _ceDetails.Visible      = false; // hiding this out for now. Struggling where we'd even use this, but instead of removing it we'll just comment it out for now.
                Controls.Add(_ceDetails);


                _dtpStart       = new DateTimePicker();
                _dtpStart.ID    = this.ID + "_dtpStart";
                _dtpStart.Label = "Registration Starts";
                Controls.Add(_dtpStart);

                _dtpEnd       = new DateTimePicker();
                _dtpEnd.ID    = this.ID + "_dtpEnd";
                _dtpEnd.Label = "Registration Ends";
                Controls.Add(_dtpEnd);

                _nbMaxAttendees            = new NumberBox();
                _nbMaxAttendees.ID         = this.ID + "_nbMaxAttendees";
                _nbMaxAttendees.Label      = "Maximum Attendees";
                _nbMaxAttendees.NumberType = ValidationDataType.Integer;
                Controls.Add(_nbMaxAttendees);

                _apAccount          = new AccountPicker();
                _apAccount.ID       = this.ID + "_apAccount";
                _apAccount.Label    = "Account";
                _apAccount.Required = true;
                Controls.Add(_apAccount);

                _ppContact                     = new PersonPicker();
                _ppContact.ID                  = this.ID + "_ppContact";
                _ppContact.Label               = "Contact";
                _ppContact.SelectPerson       += _ppContact_SelectPerson;
                _ppContact.EnableSelfSelection = true;
                Controls.Add(_ppContact);

                _pnContactPhone       = new PhoneNumberBox();
                _pnContactPhone.ID    = this.ID + "_pnContactPhone";
                _pnContactPhone.Label = "Contact Phone";
                Controls.Add(_pnContactPhone);

                _ebContactEmail       = new EmailBox();
                _ebContactEmail.ID    = this.ID + "_ebContactEmail";
                _ebContactEmail.Label = "Contact Email";
                Controls.Add(_ebContactEmail);

                _dtpSendReminder       = new DateTimePicker();
                _dtpSendReminder.ID    = this.ID + "_dtpSendReminder";
                _dtpSendReminder.Label = "Send Reminder Date";
                Controls.Add(_dtpSendReminder);

                _cbReminderSent       = new RockCheckBox();
                _cbReminderSent.ID    = this.ID + "_cbReminderSent";
                _cbReminderSent.Label = "Reminder Sent";
                _cbReminderSent.Text  = "Yes";
                Controls.Add(_cbReminderSent);

                _htmlAdditionalReminderDetails         = new HtmlEditor();
                _htmlAdditionalReminderDetails.ID      = this.ID + "_htmlAdditionalReminderDetails";
                _htmlAdditionalReminderDetails.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlAdditionalReminderDetails.Label   = "Additional Reminder Details";
                _htmlAdditionalReminderDetails.Help    = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _htmlAdditionalReminderDetails.Height  = 200;
                Controls.Add(_htmlAdditionalReminderDetails);

                _htmlAdditionalConfirmationDetails         = new HtmlEditor();
                _htmlAdditionalConfirmationDetails.ID      = this.ID + "_htmlAdditionalConfirmationDetails";
                _htmlAdditionalConfirmationDetails.Toolbar = HtmlEditor.ToolbarConfig.Light;
                _htmlAdditionalConfirmationDetails.Label   = "Additional Confirmation Details";
                _htmlAdditionalConfirmationDetails.Help    = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _htmlAdditionalConfirmationDetails.Height  = 200;
                Controls.Add(_htmlAdditionalConfirmationDetails);

                _controlsLoaded = true;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            _phControls = new DynamicPlaceholder {
                ID = "phControls"
            };
            this.Controls.Add(_phControls);

            _pnlRow = new DynamicControlsPanel {
                ID = "pnlRow", CssClass = "row"
            };
            _pnlCol1 = new DynamicControlsPanel {
                ID = "pnlCol1", CssClass = "col-sm-4"
            };
            _pnlCol2 = new DynamicControlsPanel {
                ID = "pnlCol2", CssClass = "col-sm-4"
            };
            _pnlCol3 = new DynamicControlsPanel {
                ID = "pnlCol3", CssClass = "col-sm-4"
            };
            _phControls.Controls.Add(_pnlRow);
            _pnlRow.Controls.Add(_pnlCol1);
            _pnlRow.Controls.Add(_pnlCol2);
            _pnlRow.Controls.Add(_pnlCol3);


            _hfPersonId = new HiddenField
            {
                ID = "_hfPersonId"
            };

            _phControls.Controls.Add(_hfPersonId);

            _dvpPersonTitle = new DefinedValuePicker
            {
                ID              = "_dvpPersonTitle",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_TITLE.AsGuid()),
                Label           = "Title",
                CssClass        = "input-width-md",
                ValidationGroup = ValidationGroup
            };

            _tbPersonFirstName = new RockTextBox
            {
                ID               = "tbPersonFirstName",
                Label            = "First Name",
                Required         = true,
                AutoCompleteType = AutoCompleteType.None,
                ValidationGroup  = ValidationGroup
            };

            _tbPersonLastName = new RockTextBox
            {
                ID               = "tbPersonLastName",
                Label            = "Last Name",
                Required         = true,
                AutoCompleteType = AutoCompleteType.None,
                ValidationGroup  = ValidationGroup
            };

            _dvpPersonSuffix = new DefinedValuePicker
            {
                ID              = "dvpPersonSuffix",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_SUFFIX.AsGuid()),
                Label           = "Suffix",
                CssClass        = "input-width-md",
                ValidationGroup = ValidationGroup
            };

            // Have Email and PhoneNumber hidden by default
            _ebPersonEmail = new EmailBox
            {
                ID              = "ebPersonEmail",
                Label           = "Email",
                ValidationGroup = ValidationGroup,
                Visible         = false
            };

            _pnbMobilePhoneNumber = new PhoneNumberBox
            {
                Label   = "Mobile Phone",
                ID      = "pnbMobilePhoneNumber",
                Visible = false
            };

            _dvpPersonConnectionStatus = new DefinedValuePicker
            {
                ID              = "dvpPersonConnectionStatus",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_CONNECTION_STATUS.AsGuid()),
                Label           = "Connection Status",
                Required        = true,
                ValidationGroup = ValidationGroup
            };

            _rblPersonRole = new RockRadioButtonList
            {
                ID              = "rblPersonRole",
                Label           = "Role",
                RepeatDirection = RepeatDirection.Horizontal,
                DataTextField   = "Name",
                DataValueField  = "Id",
                Required        = true,
                ValidationGroup = ValidationGroup
            };

            _rblPersonGender = new RockRadioButtonList
            {
                ID              = "rblPersonGender",
                Label           = "Gender",
                RepeatDirection = RepeatDirection.Horizontal,
                Required        = this.RequireGender,
                ValidationGroup = this.RequireGender == true ? ValidationGroup : string.Empty,
                ShowNoneOption  = false
            };

            _bdpPersonBirthDate = new BirthdayPicker
            {
                ID              = "bdpPersonBirthDate",
                Label           = "Birthdate",
                ValidationGroup = ValidationGroup
            };

            _ddlGradePicker = new GradePicker
            {
                ID                    = "ddlGradePicker",
                Label                 = "Grade",
                UseAbbreviation       = true,
                UseGradeOffsetAsValue = true,
                ValidationGroup       = ValidationGroup
            };

            _dvpPersonMaritalStatus = new DefinedValuePicker
            {
                ID              = "dvpPersonMaritalStatus",
                Label           = "Marital Status",
                DefinedTypeId   = DefinedTypeCache.GetId(Rock.SystemGuid.DefinedType.PERSON_MARITAL_STATUS.AsGuid()),
                ValidationGroup = ValidationGroup
            };

            var groupType = GroupTypeCache.GetFamilyGroupType();

            _rblPersonRole.DataSource = groupType.Roles.OrderBy(r => r.Order).ToList();
            _rblPersonRole.DataBind();

            _rblPersonGender.Items.Clear();
            _rblPersonGender.Items.Add(new ListItem(Gender.Male.ConvertToString(), Gender.Male.ConvertToInt().ToString()));
            _rblPersonGender.Items.Add(new ListItem(Gender.Female.ConvertToString(), Gender.Female.ConvertToInt().ToString()));

            ArrangePersonControls(this.ShowInColumns);
            UpdatePersonControlLabels();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if ( !_controlsLoaded )
            {
                Controls.Clear();

                _tbName = new RockTextBox();
                _tbName.ID = this.ID + "_tbName";
                _tbName.Label = "Registration Instance Name";
                _tbName.Help = "The name will be used to describe the registration on the registration screens and emails.";
                _tbName.Required = true;
                Controls.Add( _tbName );

                _cbIsActive = new RockCheckBox();
                _cbIsActive.ID = this.ID + "_cbIsActive";
                _cbIsActive.Label = "Active";
                _cbIsActive.Text = "Yes";
                Controls.Add( _cbIsActive );

                _tbUrlSlug = new RockTextBox();
                _tbUrlSlug.ID = this.ID + "_tbUrlSlug";
                _tbUrlSlug.Label = "URL Slug";
                _tbUrlSlug.Visible = false;
                Controls.Add( _tbUrlSlug );

                _ceDetails = new CodeEditor();
                _ceDetails.ID = this.ID + "_ceDetails";
                _ceDetails.Label = "Details";
                _ceDetails.EditorMode = CodeEditorMode.Html;
                _ceDetails.EditorTheme = CodeEditorTheme.Rock;
                _ceDetails.EditorHeight = "100";
                _ceDetails.Visible = false; // hiding this out for now. Struggling where we'd even use this, but instead of removing it we'll just comment it out for now.
                Controls.Add( _ceDetails );

                _dtpStart = new DateTimePicker();
                _dtpStart.ID = this.ID + "_dtpStart";
                _dtpStart.Label = "Registration Starts";
                Controls.Add( _dtpStart );

                _dtpEnd = new DateTimePicker();
                _dtpEnd.ID = this.ID + "_dtpEnd";
                _dtpEnd.Label = "Registration Ends";
                Controls.Add( _dtpEnd );

                _nbMaxAttendees = new NumberBox();
                _nbMaxAttendees.ID = this.ID + "_nbMaxAttendees";
                _nbMaxAttendees.Label = "Maximum Attendees";
                _nbMaxAttendees.NumberType = ValidationDataType.Integer;
                Controls.Add( _nbMaxAttendees );

                _apAccount = new AccountPicker();
                _apAccount.ID = this.ID + "_apAccount";
                _apAccount.Label = "Account";
                _apAccount.Required = true;
                Controls.Add( _apAccount );

                _ppContact = new PersonPicker();
                _ppContact.ID = this.ID + "_ppContact";
                _ppContact.Label = "Contact";
                _ppContact.SelectPerson += _ppContact_SelectPerson;
                _ppContact.EnableSelfSelection = true;
                Controls.Add( _ppContact );

                _pnContactPhone = new PhoneNumberBox();
                _pnContactPhone.ID = this.ID + "_pnContactPhone";
                _pnContactPhone.Label = "Contact Phone";
                Controls.Add( _pnContactPhone );

                _ebContactEmail = new EmailBox();
                _ebContactEmail.ID = this.ID + "_ebContactEmail";
                _ebContactEmail.Label = "Contact Email";
                Controls.Add( _ebContactEmail );

                _dtpSendReminder = new DateTimePicker();
                _dtpSendReminder.ID = this.ID + "_dtpSendReminder";
                _dtpSendReminder.Label = "Send Reminder Date";
                Controls.Add( _dtpSendReminder );

                _cbReminderSent = new RockCheckBox();
                _cbReminderSent.ID = this.ID + "_cbReminderSent";
                _cbReminderSent.Label = "Reminder Sent";
                _cbReminderSent.Text = "Yes";
                Controls.Add( _cbReminderSent );

                _ceAdditionalReminderDetails = new CodeEditor();
                _ceAdditionalReminderDetails.ID = this.ID + "_ceAdditionalReminderDetails";
                _ceAdditionalReminderDetails.Label = "Additional Reminder Details";
                _ceAdditionalReminderDetails.Help = "These reminder details will be appended to those in the registration template when sending the reminder email.";
                _ceAdditionalReminderDetails.EditorMode = CodeEditorMode.Html;
                _ceAdditionalReminderDetails.EditorTheme = CodeEditorTheme.Rock;
                _ceAdditionalReminderDetails.EditorHeight = "100";
                Controls.Add( _ceAdditionalReminderDetails );

                _ceAdditionalConfirmationDetails = new CodeEditor();
                _ceAdditionalConfirmationDetails.ID = this.ID + "_ceAdditionalConfirmationDetails";
                _ceAdditionalConfirmationDetails.Label = "Additional Confirmation Details";
                _ceAdditionalConfirmationDetails.Help = "These confirmation details will be appended to those from the registration template when displayed at the end of the registration process.";
                _ceAdditionalConfirmationDetails.EditorMode = CodeEditorMode.Html;
                _ceAdditionalConfirmationDetails.EditorTheme = CodeEditorTheme.Rock;
                _ceAdditionalConfirmationDetails.EditorHeight = "100";
                Controls.Add( _ceAdditionalConfirmationDetails );

                _controlsLoaded = true;
            }
        }
Ejemplo n.º 10
0
        private void SavePhone( PhoneNumberBox phoneNumberBox, Person person, Guid phoneTypeGuid, List<string> changes )
        {
            var numberType = DefinedValueCache.Read( phoneTypeGuid );
            if ( numberType != null )
            {
                var phone = person.PhoneNumbers.FirstOrDefault( p => p.NumberTypeValueId == numberType.Id );
                string oldPhoneNumber = phone != null ? phone.NumberFormattedWithCountryCode : string.Empty;
                string newPhoneNumber = PhoneNumber.CleanNumber( phoneNumberBox.Number );

                if ( newPhoneNumber != string.Empty )
                {
                    if ( phone == null )
                    {
                        phone = new PhoneNumber();
                        person.PhoneNumbers.Add( phone );
                        phone.NumberTypeValueId = numberType.Id;
                    }
                    else
                    {
                        oldPhoneNumber = phone.NumberFormattedWithCountryCode;
                    }
                    phone.CountryCode = PhoneNumber.CleanNumber( phoneNumberBox.CountryCode );
                    phone.Number = newPhoneNumber;

                    History.EvaluateChange(
                        changes,
                        string.Format( "{0} Phone", numberType.Value ),
                        oldPhoneNumber,
                        phone.NumberFormattedWithCountryCode );
                }

            }
        }