/// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override System.Collections.Generic.List <System.Web.UI.Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            _tbDateFormat = new RockTextBox();
            controls.Add(_tbDateFormat);
            _tbDateFormat.Label = "Date Format";
            _tbDateFormat.Help  = "The format string to use for date (default is system short date).";

            _cbDisplayDiff = new RockCheckBox();
            controls.Add(_cbDisplayDiff);
            _cbDisplayDiff.Label = "Display as Elapsed Time";
            _cbDisplayDiff.Text  = "Yes";
            _cbDisplayDiff.Help  = "Display value as an elapsed time.";

            _ddlDatePickerMode = new RockDropDownList();
            controls.Add(_ddlDatePickerMode);
            _ddlDatePickerMode.Items.Clear();
            _ddlDatePickerMode.Items.Add(new ListItem("Date Picker", DatePickerControlType.DatePicker.ConvertToString()));
            _ddlDatePickerMode.Items.Add(new ListItem("Date Parts Picker", DatePickerControlType.DatePartsPicker.ConvertToString()));
            _ddlDatePickerMode.Label                 = "Control Type";
            _ddlDatePickerMode.Help                  = "Select 'Date Picker' to use a DatePicker, or 'Date Parts Picker' to select Month, Day and Year individually";
            _ddlDatePickerMode.AutoPostBack          = true;
            _ddlDatePickerMode.SelectedIndexChanged += OnQualifierUpdated;

            _cbDisplayCurrent = new RockCheckBox();
            controls.Add(_cbDisplayCurrent);
            _cbDisplayCurrent.AutoPostBack    = true;
            _cbDisplayCurrent.CheckedChanged += OnQualifierUpdated;
            _cbDisplayCurrent.Label           = "Display Current Option";
            _cbDisplayCurrent.Text            = "Yes";
            _cbDisplayCurrent.Help            = "Include option to specify value as the current date.";

            _nbFutureYearCount = new NumberBox();
            controls.Add(_nbFutureYearCount);
            _nbFutureYearCount.Label = "Future Years";
            _nbFutureYearCount.Text  = "";
            _nbFutureYearCount.Help  = "The number of years in the future in include the year picker. Set to 0 to limit to current year. Leaving it blank will default to 50.";

            return(controls);
        }
Пример #2
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();
            Controls.Clear();

            tbTitle           = new RockTextBox();
            tbTitle.ID        = string.Format("tbTextTitle_{0}", this.ID);
            tbTitle.TextMode  = TextBoxMode.SingleLine;
            tbTitle.Required  = false;
            tbTitle.Label     = "Title";
            tbTitle.MaxLength = 100;
            Controls.Add(tbTitle);


            cbSound       = new RockCheckBox();
            cbSound.ID    = string.Format("cbSound_{0}", this.ID);
            cbSound.Label = "Should make sound?";
            Controls.Add(cbSound);

            rcwMessage       = new RockControlWrapper();
            rcwMessage.ID    = string.Format("rcwMessage_{0}", this.ID);
            rcwMessage.Label = "Message";
            rcwMessage.Help  = "<span class='tip tip-lava'></span>";
            Controls.Add(rcwMessage);

            mfpMessage    = new MergeFieldPicker();
            mfpMessage.ID = string.Format("mfpMergeFields_{0}", this.ID);
            mfpMessage.MergeFields.Clear();
            mfpMessage.MergeFields.Add("GlobalAttribute");
            mfpMessage.MergeFields.Add("Rock.Model.Person");
            mfpMessage.CssClass   += " pull-right margin-b-sm";
            mfpMessage.SelectItem += mfpMergeFields_SelectItem;
            rcwMessage.Controls.Add(mfpMessage);

            tbMessage          = new RockTextBox();
            tbMessage.ID       = string.Format("tbTextMessage_{0}", this.ID);
            tbMessage.TextMode = TextBoxMode.MultiLine;
            tbMessage.Rows     = 3;
            tbMessage.Required = true;
            rcwMessage.Controls.Add(tbMessage);
        }
        /// <summary>
        /// Gets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <returns></returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            var    accountIdList = (controls[0] as AccountPicker).SelectedValuesAsInt().ToList();
            string accountGuids  = string.Empty;
            var    accounts      = new FinancialAccountService(new RockContext()).GetByIds(accountIdList);

            if (accounts != null && accounts.Any())
            {
                accountGuids = accounts.Select(a => a.Guid).ToList().AsDelimited(",");
            }

            SlidingDateRangePicker slidingDateRangePicker = controls[1] as SlidingDateRangePicker;

            // convert pipe to comma delimited
            var delimitedValues = slidingDateRangePicker.DelimitedValues.Replace("|", ",");

            RockCheckBox cbCombineGiving = controls[2] as RockCheckBox;

            // {1} and {2} used to store the DateRange before, but now we using the SlidingDateRangePicker
            return(string.Format("{0}|{1}|{2}|{3}|{4}", string.Empty, string.Empty, accountGuids, cbCombineGiving.Checked, delimitedValues));
        }
Пример #4
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="parentControl"></param>
        /// <returns></returns>
        public override System.Web.UI.Control[] CreateChildControls(System.Web.UI.Control parentControl)
        {
            AccountPicker accountPicker = new AccountPicker();

            accountPicker.AllowMultiSelect = true;
            accountPicker.ID    = parentControl.ID + "_accountPicker";
            accountPicker.Label = "Account";
            accountPicker.Help  = string.Format(
                "Pick accounts to show the {0} time the person made a contribution into any of those accounts. Leave blank if you don't want to limit it to specific accounts.",
                FirstOrLast.ConvertToString().ToLower());
            parentControl.Controls.Add(accountPicker);

            RockCheckBox cbUseSundayDate = new RockCheckBox();

            cbUseSundayDate.ID    = parentControl.ID + "_cbUseSundayDate";
            cbUseSundayDate.Label = "Use Sunday Date";
            cbUseSundayDate.Help  = "Use the Sunday Date instead of the actual transaction date.";
            parentControl.Controls.Add(cbUseSundayDate);

            return(new System.Web.UI.Control[] { accountPicker, cbUseSundayDate });
        }
Пример #5
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var ddl = new RockDropDownList();

            controls.Add(ddl);
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Toolbar Type";
            ddl.Help  = "The type of toolbar to display on editor.";
            ddl.Items.Add("Light");
            ddl.Items.Add("Full");

            var tbDocumentRoot = new RockTextBox();

            controls.Add(tbDocumentRoot);
            tbDocumentRoot.AutoPostBack = true;
            tbDocumentRoot.TextChanged += OnQualifierUpdated;
            tbDocumentRoot.Label        = "Document Root Folder";
            tbDocumentRoot.Help         = "The folder to use as the root when browsing or uploading documents ( e.g. ~/Content ).";

            var tbImageRoot = new RockTextBox();

            controls.Add(tbImageRoot);
            tbImageRoot.AutoPostBack = true;
            tbImageRoot.TextChanged += OnQualifierUpdated;
            tbImageRoot.Label        = "Image Root Folder";
            tbImageRoot.Help         = "The folder to use as the root when browsing or uploading images ( e.g. ~/Content ).";

            var cbUserSpecificFolder = new RockCheckBox();

            controls.Add(cbUserSpecificFolder);
            cbUserSpecificFolder.AutoPostBack    = true;
            cbUserSpecificFolder.CheckedChanged += OnQualifierUpdated;
            cbUserSpecificFolder.Label           = "User Specific Folders";
            cbUserSpecificFolder.Text            = "Yes";
            cbUserSpecificFolder.Help            = "Should the root folders be specific to current user?";
            return(controls);
        }
Пример #6
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            List <Control> controls = base.ConfigurationControls();

            var cbFormatAsLink = new RockCheckBox();

            cbFormatAsLink.Label = "Format as Link";
            cbFormatAsLink.Help  = "Enable this to navigate to a full size image when the image is clicked";
            cbFormatAsLink.Text  = "Yes";
            controls.Add(cbFormatAsLink);

            var codeEditorImageTabTemplate = new CodeEditor();

            codeEditorImageTabTemplate.Label        = "Image Tag Template";
            codeEditorImageTabTemplate.Help         = "The Lava template to use when rendering as an html img tag.";
            codeEditorImageTabTemplate.EditorHeight = "100";
            codeEditorImageTabTemplate.EditorMode   = CodeEditorMode.Lava;
            codeEditorImageTabTemplate.EditorTheme  = CodeEditorTheme.Rock;
            controls.Add(codeEditorImageTabTemplate);

            return(controls);
        }
Пример #7
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="parentControl"></param>
        /// <returns></returns>
        public override System.Web.UI.Control[] CreateChildControls(System.Web.UI.Control parentControl)
        {
            RockCheckBox cbIncludeGender = new RockCheckBox();

            cbIncludeGender.ID   = parentControl.ID + "_cbIncludeGender";
            cbIncludeGender.Text = "Include Gender";
            parentControl.Controls.Add(cbIncludeGender);

            RockCheckBox cbIncludeAge = new RockCheckBox();

            cbIncludeAge.ID   = parentControl.ID + "_cbIncludeAge";
            cbIncludeAge.Text = "Include Age";
            parentControl.Controls.Add(cbIncludeAge);

            RockCheckBox cbIncludeGrade = new RockCheckBox();

            cbIncludeGrade.ID   = parentControl.ID + "_cbIncludeGrade";
            cbIncludeGrade.Text = "Include Grade";
            parentControl.Controls.Add(cbIncludeGrade);

            return(new System.Web.UI.Control[] { cbIncludeGender, cbIncludeAge, cbIncludeGrade });
        }
Пример #8
0
        /// <summary>
        /// Builds the single option single quantity checkbox
        /// </summary>
        /// <param name="setValues">if set to <c>true</c> [set values].</param>
        /// <param name="controlLabel">The control label.</param>
        /// <param name="feeValues">The fee values.</param>
        /// <param name="usageCountRemaining">The usage count remaining.</param>
        /// <returns></returns>
        private Control GetFeeSingleOptionSingleQuantityControl(bool setValues, string controlLabel, List <FeeInfo> feeValues, int?usageCountRemaining)
        {
            var fee = this;
            var cb  = new RockCheckBox();

            cb.ID = "fee_" + fee.Id.ToString();
            cb.SelectedIconCssClass   = "fa fa-check-square-o fa-lg";
            cb.UnSelectedIconCssClass = "fa fa-square-o fa-lg";
            cb.Required = fee.IsRequired;
            cb.Label    = controlLabel;

            var currentValue = feeValues?.FirstOrDefault()?.Quantity ?? 0;

            if (fee.IsRequired)
            {
                cb.Checked = true;
                cb.Enabled = false;
            }
            else
            {
                if (usageCountRemaining <= 0)
                {
                    // if there aren't any remaining, and the currentValue isn't counted in the used counts, disable the option
                    if (currentValue == 0)
                    {
                        cb.Enabled = false;
                    }

                    cb.Label += " (none remaining)";
                }

                if (setValues)
                {
                    cb.Checked = currentValue > 0;
                }
            }

            return(cb);
        }
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var rp = new RegistrationTemplatePicker();

            rp.ID               = filterControl.ID + "_rp";
            rp.Label            = "RegistrationTemplate(s)";
            rp.CssClass         = "js-group-picker";
            rp.AllowMultiSelect = true;
            rp.Help             = "Select the registration templates that you want the registrants for. Leaving this blank will not restrict results to a registration template.";
            filterControl.Controls.Add(rp);

            var cbIncludeInactiveRegistrationInstances = new RockCheckBox();

            cbIncludeInactiveRegistrationInstances.ID           = filterControl.ID + "_cbIncludeInactiveRegistrationInstances";
            cbIncludeInactiveRegistrationInstances.Text         = "Include Inactive Registration Instances";
            cbIncludeInactiveRegistrationInstances.CssClass     = "js-include-inactive-groups";
            cbIncludeInactiveRegistrationInstances.AutoPostBack = true;
            filterControl.Controls.Add(cbIncludeInactiveRegistrationInstances);

            PanelWidget pwAdvanced = new PanelWidget();

            filterControl.Controls.Add(pwAdvanced);
            pwAdvanced.ID       = filterControl.ID + "_pwAttributes";
            pwAdvanced.Title    = "Advanced Filters";
            pwAdvanced.CssClass = "advanced-panel";

            SlidingDateRangePicker registeredOnDateRangePicker = new SlidingDateRangePicker();

            registeredOnDateRangePicker.ID = pwAdvanced.ID + "_addedOnDateRangePicker";
            registeredOnDateRangePicker.AddCssClass("js-sliding-date-range");
            registeredOnDateRangePicker.Label = "Date Registered:";
            registeredOnDateRangePicker.Help  = "Select the date range that the person was registered. Leaving this blank will not restrict results to a date range.";
            pwAdvanced.Controls.Add(registeredOnDateRangePicker);

            return(new Control[4] {
                rp, cbIncludeInactiveRegistrationInstances, registeredOnDateRangePicker, pwAdvanced
            });
        }
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(Type entityType, Control[] controls, string selection)
        {
            if (controls.Count() < 3)
            {
                return;
            }

            RegistrationTemplatePicker registrationTemplatePicker = controls[0] as RegistrationTemplatePicker;
            RockCheckBox           cbIncludeInactive           = controls[1] as RockCheckBox;
            SlidingDateRangePicker registeredOnDateRangePicker = controls[2] as SlidingDateRangePicker;

            string[] selectionValues = selection.Split('|');
            if (selectionValues.Length >= 1)
            {
                List <Guid> registrationTemplateGuids = selectionValues[0].Split(',').AsGuidList();
                var         registrationTemplates     = new RegistrationTemplateService(new RockContext()).GetByGuids(registrationTemplateGuids);
                if (registrationTemplates != null)
                {
                    registrationTemplatePicker.SetValues(registrationTemplates);
                }

                if (selectionValues.Length >= 2)
                {
                    cbIncludeInactive.Checked = selectionValues[1].AsBooleanOrNull() ?? false;
                }
                else
                {
                    // if options where saved before this option was added, set to false, even though it would have included inactive before
                    cbIncludeInactive.Checked = false;
                }

                if (selectionValues.Length >= 3)
                {
                    // convert comma delimited to pipe
                    registeredOnDateRangePicker.DelimitedValues = selectionValues[2].Replace(',', '|');
                }
            }
        }
        /// <summary>
        /// Gets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <returns></returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            if (controls.Count() < 3)
            {
                return(null);
            }

            RegistrationTemplatePicker registrationTemplatePicker  = controls[0] as RegistrationTemplatePicker;
            RockCheckBox           cbInactiveRegistrationInstances = controls[1] as RockCheckBox;
            SlidingDateRangePicker registeredOnDateRangePicker     = controls[2] as SlidingDateRangePicker;

            List <int> registrationTemplateIdList = registrationTemplatePicker.SelectedValues.AsIntegerList();
            var        registrationTemplateGuids  = new RegistrationTemplateService(new RockContext()).GetByIds(registrationTemplateIdList).Select(a => a.Guid).Distinct().ToList();

            // convert pipe to comma delimited
            var delimitedValues = registeredOnDateRangePicker.DelimitedValues.Replace("|", ",");

            return(string.Format(
                       "{0}|{1}|{2}",
                       registrationTemplateGuids.AsDelimited(","),
                       cbInactiveRegistrationInstances.Checked.ToString(),
                       delimitedValues));
        }
Пример #12
0
        /// <summary>
        /// Gets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <returns></returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            string  comparisonType = (( DropDownList )controls[0]).SelectedValue;
            decimal?amount         = (controls[1] as NumberBox).Text.AsDecimal();

            var    accountIdList = (controls[2] as AccountPicker).SelectedValuesAsInt().ToList();
            string accountGuids  = string.Empty;
            var    accounts      = new FinancialAccountService(new RockContext()).GetByIds(accountIdList);

            if (accounts != null && accounts.Any())
            {
                accountGuids = accounts.Select(a => a.Guid).ToList().AsDelimited(",");
            }

            SlidingDateRangePicker slidingDateRangePicker = controls[3] as SlidingDateRangePicker;

            // convert pipe to comma delimited
            var delimitedValues = slidingDateRangePicker.DelimitedValues.Replace("|", ",");

            RockCheckBox cbCombineGiving = controls[4] as RockCheckBox;

            return(string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}", comparisonType, amount, string.Empty, string.Empty, accountGuids, cbCombineGiving.Checked, delimitedValues));
        }
Пример #13
0
        /// <summary>
        /// Builds the single option single quantity checkbox
        /// </summary>
        /// <param name="setValues">if set to <c>true</c> [set values].</param>
        /// <param name="feeValues">The fee values.</param>
        /// <returns></returns>
        private Control GetFeeSingleOptionSingleQuantityControl(bool setValues, List <FeeInfo> feeValues)
        {
            var fee = this;
            var cb  = new RockCheckBox();

            cb.ID = "fee_" + fee.Id.ToString();


            cb.SelectedIconCssClass   = "fa fa-check-square-o fa-lg";
            cb.UnSelectedIconCssClass = "fa fa-square-o fa-lg";
            cb.Required = fee.IsRequired;

            if (fee.IsRequired)
            {
                cb.Checked = true;
                cb.Enabled = false;
            }
            else if (setValues && feeValues != null && feeValues.Any())
            {
                cb.Checked = feeValues.First().Quantity > 0;
            }

            return(cb);
        }
Пример #14
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            int entityTypeId = EntityTypeCache.Get(entityType).Id;

            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID          = filterControl.ID + "_dvpDataView";
            dvpDataView.CssClass    = "js-dataview";
            dvpDataView.SelectItem += DvpDataView_SelectItem;
            filterControl.Controls.Add(dvpDataView);
            dvpDataView.EntityTypeId = entityTypeId;

            var cbUsePersisted = new RockCheckBox();

            cbUsePersisted.Text     = "Use Persisted";
            cbUsePersisted.ID       = filterControl.ID + "_cbUsePersisted";
            cbUsePersisted.CssClass = "js-usepersisted";
            cbUsePersisted.Checked  = true;
            filterControl.Controls.Add(cbUsePersisted);

            return(new Control[2] {
                dvpDataView, cbUsePersisted
            });
        }
Пример #15
0
        /// <summary>
        /// Renders the controls.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="filterControl">The filter control.</param>
        /// <param name="writer">The writer.</param>
        /// <param name="controls">The controls.</param>
        public override void RenderControls(Type entityType, FilterField filterControl, HtmlTextWriter writer, Control[] controls)
        {
            if (controls.Count() >= 3)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                GroupPicker groupPicker = controls[0] as GroupPicker;
                groupPicker.RenderControl(writer);
                RockCheckBox cbChildGroups = controls[1] as RockCheckBox;
                cbChildGroups.RenderControl(writer);
                writer.RenderEndTag();

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                RockCheckBoxList cblRoles = controls[2] as RockCheckBoxList;
                cblRoles.RenderControl(writer);
                writer.RenderEndTag();

                writer.RenderEndTag();
            }
        }
Пример #16
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field.
        /// IMPORTANT! The order of the controls must match the order/index usage
        /// in the ConfigurationValues and SetConfigurationValues methods.
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a group picker (the one that gets selected is
            // used to build a list of groupmember values)
            var gpGroupPicker = new GroupPicker();

            gpGroupPicker.Label       = "Group";
            gpGroupPicker.Help        = "The Group to select the member(s) from.";
            gpGroupPicker.SelectItem += OnQualifierUpdated;
            controls.Add(gpGroupPicker);

            // Add checkbox for deciding if the group member picker list is rendered as a drop
            // down list or a checkbox list.
            var cb = new RockCheckBox();

            controls.Add(cb);
            cb.AutoPostBack    = true;
            cb.CheckedChanged += OnQualifierUpdated;
            cb.Label           = "Allow Multiple Values";
            cb.Text            = "Yes";
            cb.Help            = "When set, allows multiple group members to be selected.";

            // option for Displaying an enhanced 'chosen' value picker
            var cbEnanced = new RockCheckBox();

            controls.Add(cbEnanced);
            cbEnanced.AutoPostBack    = true;
            cbEnanced.CheckedChanged += OnQualifierUpdated;
            cbEnanced.Label           = "Enhance For Long Lists";
            cbEnanced.Text            = "Yes";
            cbEnanced.Help            = "When set, will render a searchable selection of options.";

            return(controls);
        }
Пример #17
0
        /// <summary>
        /// Gets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <returns></returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            if (controls.Count() < 8)
            {
                return(null);
            }

            GroupPicker            groupPicker                  = controls[0] as GroupPicker;
            RockCheckBox           cbChildGroups                = controls[1] as RockCheckBox;
            RockCheckBox           cbIncludeSelectedGroup       = controls[2] as RockCheckBox;
            RockCheckBox           cbChildGroupsPlusDescendants = controls[3] as RockCheckBox;
            RockCheckBoxList       cblRoles                       = controls[4] as RockCheckBoxList;
            RockDropDownList       ddlGroupMemberStatus           = controls[5] as RockDropDownList;
            RockCheckBox           cbIncludeInactiveGroups        = controls[6] as RockCheckBox;
            SlidingDateRangePicker addedOnDateRangePicker         = controls[7] as SlidingDateRangePicker;
            SlidingDateRangePicker firstAttendanceDateRangePicker = controls[9] as SlidingDateRangePicker;
            SlidingDateRangePicker lastAttendanceDateRangePicker  = controls[10] as SlidingDateRangePicker;

            List <int> groupIdList = groupPicker.SelectedValues.AsIntegerList();
            var        groupGuids  = new GroupService(new RockContext()).GetByIds(groupIdList).Select(a => a.Guid).Distinct().ToList();

            //// NOTE: convert slidingdaterange delimitedvalues from pipe to comma delimited

            return(string.Format(
                       "{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}",
                       groupGuids.AsDelimited(","),
                       cblRoles.SelectedValues.AsDelimited(","),
                       cbChildGroups.Checked.ToString(),
                       ddlGroupMemberStatus.SelectedValue,
                       cbIncludeSelectedGroup.Checked.ToString(),
                       cbChildGroupsPlusDescendants.Checked.ToString(),
                       cbIncludeInactiveGroups.Checked.ToString(),
                       addedOnDateRangePicker.DelimitedValues.Replace("|", ","),
                       firstAttendanceDateRangePicker.DelimitedValues.Replace("|", ","),
                       lastAttendanceDateRangePicker.DelimitedValues.Replace("|", ",")));
        }
Пример #18
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // Add checkbox for deciding if the textbox is used for storing a password
            var cbIsPasswordField = new RockCheckBox();

            controls.Add(cbIsPasswordField);
            cbIsPasswordField.AutoPostBack    = true;
            cbIsPasswordField.CheckedChanged += OnQualifierUpdated;
            cbIsPasswordField.Label           = "Password Field";
            cbIsPasswordField.Text            = "Yes";
            cbIsPasswordField.Help            = "When set, edit field will be masked.";

            // Add number box for selecting the maximum number of characters
            var nbMaxCharacters = new NumberBox();

            controls.Add(nbMaxCharacters);
            nbMaxCharacters.AutoPostBack = true;
            nbMaxCharacters.TextChanged += OnQualifierUpdated;
            nbMaxCharacters.NumberType   = ValidationDataType.Integer;
            nbMaxCharacters.Label        = "Max Characters";
            nbMaxCharacters.Help         = "The maximum number of characters to allow. Leave this field empty to allow for an unlimited amount of text.";

            // Add checkbox indicating whether to show the count down.
            var cbShowCountDown = new RockCheckBox();

            controls.Add(cbShowCountDown);
            cbShowCountDown.AutoPostBack    = true;
            cbShowCountDown.CheckedChanged += OnQualifierUpdated;
            cbShowCountDown.Label           = "Show Character Limit Countdown";
            cbShowCountDown.Text            = "Yes";
            cbShowCountDown.Help            = "When set, displays a countdown showing how many characters remain (for the Max Characters setting).";

            return(controls);
        }
Пример #19
0
        /// <summary>
        /// Handles the SelectItem event of the gp 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 gp_SelectItem(object sender, EventArgs e)
        {
            FilterField filterField = (sender as Control).FirstParentControlOfType <FilterField>();

            GroupPicker      groupPicker   = filterField.ControlsOfTypeRecursive <GroupPicker>().FirstOrDefault(a => a.HasCssClass("js-group-picker"));
            RockCheckBox     cbChildGroups = filterField.ControlsOfTypeRecursive <RockCheckBox>().FirstOrDefault(a => a.HasCssClass("js-include-child-groups"));
            RockCheckBox     cbChildGroupsPlusDescendants = filterField.ControlsOfTypeRecursive <RockCheckBox>().FirstOrDefault(a => a.HasCssClass("js-include-child-groups-descendants"));
            RockCheckBox     cbIncludeInactiveGroups      = filterField.ControlsOfTypeRecursive <RockCheckBox>().FirstOrDefault(a => a.HasCssClass("js-include-inactive-groups"));
            RockCheckBox     cbIncludeSelectedGroup       = filterField.ControlsOfTypeRecursive <RockCheckBox>().FirstOrDefault(a => a.HasCssClass("js-include-selected-groups"));
            RockCheckBoxList cblRoles = filterField.ControlsOfTypeRecursive <RockCheckBoxList>().FirstOrDefault(a => a.HasCssClass("js-roles"));

            var rockContext = new RockContext();

            var groupIdList  = groupPicker.SelectedValues.AsIntegerList();
            var groupService = new GroupService(rockContext);

            var selectedGroups = groupService.GetByIds(groupIdList).Select(s => new { s.Id, s.GroupTypeId }).ToList();

            if (selectedGroups.Any())
            {
                var        groupTypeRoleService = new GroupTypeRoleService(rockContext);
                var        qryGroupTypeRoles    = groupTypeRoleService.Queryable();
                List <int> selectedGroupTypeIds = selectedGroups.Select(a => a.GroupTypeId).Distinct().ToList();

                if (cbChildGroups.Checked)
                {
                    List <int> childGroupTypeIds = new List <int>();
                    foreach (var groupId in selectedGroups.Select(a => a.Id).ToList())
                    {
                        if (cbChildGroupsPlusDescendants.Checked)
                        {
                            // get all children and descendants of the selected group(s)
                            var descendantGroupTypes = groupService.GetAllDescendentsGroupTypes(groupId, cbIncludeInactiveGroups.Checked);

                            childGroupTypeIds.AddRange(descendantGroupTypes.Select(a => a.Id).ToList());
                        }
                        else
                        {
                            // get only immediate children of the selected group(s)
                            var childGroups = groupService.Queryable().Where(a => a.ParentGroupId == groupId);
                            if (!cbIncludeInactiveGroups.Checked)
                            {
                                childGroups = childGroups.Where(a => a.IsActive == true);
                            }

                            childGroupTypeIds.AddRange(childGroups.Select(a => a.GroupTypeId).Distinct().ToList());
                        }
                    }

                    childGroupTypeIds = childGroupTypeIds.Distinct().ToList();

                    if (cbIncludeSelectedGroup.Checked)
                    {
                        qryGroupTypeRoles = qryGroupTypeRoles.Where(a => a.GroupTypeId.HasValue && (selectedGroupTypeIds.Contains(a.GroupTypeId.Value) || childGroupTypeIds.Contains(a.GroupTypeId.Value)));
                    }
                    else
                    {
                        qryGroupTypeRoles = qryGroupTypeRoles.Where(a => a.GroupTypeId.HasValue && childGroupTypeIds.Contains(a.GroupTypeId.Value));
                    }
                }
                else
                {
                    qryGroupTypeRoles = qryGroupTypeRoles.Where(a => a.GroupTypeId.HasValue && selectedGroupTypeIds.Contains(a.GroupTypeId.Value));
                }

                var list = qryGroupTypeRoles.OrderBy(a => a.GroupType.Order).ThenBy(a => a.GroupType.Name).ThenBy(a => a.Order).ThenBy(a => a.Name).Select(a => new
                {
                    a.Name,
                    GroupTypeName = a.GroupType.Name,
                    a.Guid
                }).ToList();
                cblRoles.Items.Clear();
                foreach (var item in list)
                {
                    cblRoles.Items.Add(new ListItem(string.Format("{0} ({1})", item.Name, item.GroupTypeName), item.Guid.ToString()));
                }

                cblRoles.Visible = list.Count > 0;
            }
            else
            {
                cblRoles.Visible = false;
            }
        }
        public void InstantiateIn(Control container)
        {
            switch (_type)
            {
            case ListItemType.Item:
            case ListItemType.AlternatingItem:
                HiddenField hfFilterId = new HiddenField();
                hfFilterId.ID = "hfFilterId";

                HiddenField hfSortOrder = new HiddenField();
                hfSortOrder.ID = "hfSortOrder";

                System.Web.UI.WebControls.Panel filterPanel = new Panel();
                filterPanel.ID = "pnlFilter";
                filterPanel.AddCssClass("sccDvvFilterSection");
                filterPanel.Attributes.Add("ondragover", "dragover_handler(event)");
                filterPanel.Attributes.Add("ondrop", "drop_handler(event)");

                filterPanel.Controls.Add(hfFilterId);
                filterPanel.Controls.Add(hfSortOrder);

                // Title Bar
                filterPanel.Controls.Add(new LiteralControl(@"<div class='sccDvvFilterSection_title'>
                        <div class='reorder' draggable='true' ondragstart='dragstart_handler(event)' style='padding-right: 15px;'>
                            <i class='fa fa-bars'></i>
                        </div>
                        <svg style='width: 30px; height: 30px; margin-right: 5px; '>
                                       <circle r='10' cy='15' cx='15' class='dot red'></circle>
                        </svg>"));
                Literal lFilterName = new Literal();
                lFilterName.ID = "lFilterName";
                filterPanel.Controls.Add(lFilterName);

                // Enabled by Default Checkbox
                filterPanel.Controls.Add(new LiteralControl(@"</div>
                            <div class='row enabledByDefault'>
                                <div class='col-xs-12 col-sm-4 col-md-4'>"));
                RockCheckBox cbActiveByDefault = new RockCheckBox();
                cbActiveByDefault.ID      = "cbActiveByDefault";
                cbActiveByDefault.Label   = "Visible by Default";
                cbActiveByDefault.Checked = true;
                filterPanel.Controls.Add(cbActiveByDefault);
                filterPanel.Controls.Add(new LiteralControl("</div></div>"));

                // START Filter options
                filterPanel.Controls.Add(new LiteralControl(@"<div class='row js-filterconfig-row'>
                        <div class='col-md-4'>"));

                // Display As text field
                RockTextBox tbDisplayName = new RockTextBox();
                tbDisplayName.ID                  = "tbDisplayName";
                tbDisplayName.Label               = "DisplayAs";
                tbDisplayName.CssClass            = "js-settings-pre-html";
                tbDisplayName.Help                = "The name to show for the filter";
                tbDisplayName.ValidateRequestMode = ValidateRequestMode.Disabled;
                filterPanel.Controls.Add(tbDisplayName);
                filterPanel.Controls.Add(new LiteralControl("</div>"));

                // Color Picker
                filterPanel.Controls.Add(new LiteralControl("<div class='col-md-3 sccDvvFilterColorPicker'>"));
                RockDropDownList ddlDisplayStyle = new RockDropDownList();
                ddlDisplayStyle.Label = "Style";
                ddlDisplayStyle.ID    = "ddlDisplayStyle";
                ddlDisplayStyle.Help  = "The style to use when displaying people who match this filter";
                ddlDisplayStyle.Attributes.Add("onchange", "displayOptionChosen(this)");
                ddlDisplayStyle.Items.Add(new ListItem("Red", "red"));
                ddlDisplayStyle.Items.Add(new ListItem("Orange", "orange"));
                ddlDisplayStyle.Items.Add(new ListItem("Yellow", "yellow"));
                ddlDisplayStyle.Items.Add(new ListItem("Green", "green"));
                ddlDisplayStyle.Items.Add(new ListItem("Blue", "blue"));
                ddlDisplayStyle.Items.Add(new ListItem("Purple", "purple"));
                ddlDisplayStyle.Items.Add(new ListItem("Outline", "outline"));
                ddlDisplayStyle.Items.Add(new ListItem("Custom", "custom"));
                filterPanel.Controls.Add(ddlDisplayStyle);

                // Custom CSS
                filterPanel.Controls.Add(new LiteralControl("</div><div class='col-md-4 custom-css'>"));
                RockTextBox tbCSS = new RockTextBox();
                tbCSS.ID                  = "tbCSS";
                tbCSS.Label               = "CSS";
                tbCSS.Help                = "Custom CSS properties to apply. NOTE: These must be for SVG elements, not HTML elements.";
                tbCSS.CssClass            = "js-settings-pre-html";
                tbCSS.ValidateRequestMode = ValidateRequestMode.Disabled;
                tbCSS.TextMode            = TextBoxMode.MultiLine;
                tbCSS.Rows                = 5;
                tbCSS.Attributes.Add("onchange", "updateCustomStyles(this)");
                filterPanel.Controls.Add(tbCSS);
                filterPanel.Controls.Add(new LiteralControl("</div></div>"));

                // END Filter options


                container.Controls.Add(filterPanel);
                break;
            }
        }
Пример #21
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var gp = new GroupPicker();

            gp.ID               = filterControl.ID + "_gp";
            gp.Label            = "Group(s)";
            gp.SelectItem      += gp_SelectItem;
            gp.CssClass         = "js-group-picker";
            gp.AllowMultiSelect = true;
            filterControl.Controls.Add(gp);

            var cbChildGroups = new RockCheckBox();

            cbChildGroups.ID              = filterControl.ID + "_cbChildsGroups";
            cbChildGroups.Text            = "Include Child Group(s)";
            cbChildGroups.CssClass        = "js-include-child-groups";
            cbChildGroups.AutoPostBack    = true;
            cbChildGroups.CheckedChanged += gp_SelectItem;
            filterControl.Controls.Add(cbChildGroups);

            var cbIncludeSelectedGroup = new RockCheckBox();

            cbIncludeSelectedGroup.ID              = filterControl.ID + "_cbIncludeSelectedGroup";
            cbIncludeSelectedGroup.Text            = "Include Selected Group(s)";
            cbIncludeSelectedGroup.CssClass        = "js-include-selected-groups";
            cbIncludeSelectedGroup.AutoPostBack    = true;
            cbIncludeSelectedGroup.CheckedChanged += gp_SelectItem;
            filterControl.Controls.Add(cbIncludeSelectedGroup);

            var cbChildGroupsPlusDescendants = new RockCheckBox();

            cbChildGroupsPlusDescendants.ID              = filterControl.ID + "_cbChildGroupsPlusDescendants";
            cbChildGroupsPlusDescendants.Text            = "Include All Descendants(s)";
            cbChildGroupsPlusDescendants.CssClass        = "js-include-child-groups-descendants";
            cbChildGroupsPlusDescendants.AutoPostBack    = true;
            cbChildGroupsPlusDescendants.CheckedChanged += gp_SelectItem;
            filterControl.Controls.Add(cbChildGroupsPlusDescendants);

            var cbIncludeInactiveGroups = new RockCheckBox();

            cbIncludeInactiveGroups.ID              = filterControl.ID + "_cbIncludeInactiveGroups";
            cbIncludeInactiveGroups.Text            = "Include Inactive Groups";
            cbIncludeInactiveGroups.CssClass        = "js-include-inactive-groups";
            cbIncludeInactiveGroups.AutoPostBack    = true;
            cbIncludeInactiveGroups.CheckedChanged += gp_SelectItem;
            filterControl.Controls.Add(cbIncludeInactiveGroups);

            var cblRole = new RockCheckBoxList();

            cblRole.Label    = "with Group Member Role(s) (optional)";
            cblRole.ID       = filterControl.ID + "_cblRole";
            cblRole.CssClass = "js-roles";
            cblRole.Visible  = false;
            filterControl.Controls.Add(cblRole);

            RockDropDownList ddlGroupMemberStatus = new RockDropDownList();

            ddlGroupMemberStatus.CssClass = "js-group-member-status";
            ddlGroupMemberStatus.ID       = filterControl.ID + "_ddlGroupMemberStatus";
            ddlGroupMemberStatus.Label    = "with Group Member Status";
            ddlGroupMemberStatus.Help     = "Select a specific group member status to only include group members with that status. Leaving this blank will return all members.";
            ddlGroupMemberStatus.BindToEnum <GroupMemberStatus>(true);
            ddlGroupMemberStatus.SetValue(GroupMemberStatus.Active.ConvertToInt());
            filterControl.Controls.Add(ddlGroupMemberStatus);

            PanelWidget pwAdvanced = new PanelWidget();

            filterControl.Controls.Add(pwAdvanced);
            pwAdvanced.ID       = filterControl.ID + "_pwAttributes";
            pwAdvanced.Title    = "Advanced Filters";
            pwAdvanced.CssClass = "advanced-panel";

            SlidingDateRangePicker addedOnDateRangePicker = new SlidingDateRangePicker();

            addedOnDateRangePicker.ID = pwAdvanced.ID + "_addedOnDateRangePicker";
            addedOnDateRangePicker.AddCssClass("js-dateadded-sliding-date-range");
            addedOnDateRangePicker.Label = "Date Added:";
            addedOnDateRangePicker.Help  = "Select the date range that the person was added to the group. Leaving this blank will not restrict results to a date range.";
            pwAdvanced.Controls.Add(addedOnDateRangePicker);

            SlidingDateRangePicker firstAttendanceDateRangePicker = new SlidingDateRangePicker();

            firstAttendanceDateRangePicker.ID = filterControl.ID + "_firstAttendanceDateRangePicker";
            firstAttendanceDateRangePicker.AddCssClass("js-firstattendance-sliding-date-range");
            firstAttendanceDateRangePicker.Label = "First Attendance";
            firstAttendanceDateRangePicker.Help  = "The date range of the first attendance using the 'Sunday Date' of each attendance";
            pwAdvanced.Controls.Add(firstAttendanceDateRangePicker);

            SlidingDateRangePicker lastAttendanceDateRangePicker = new SlidingDateRangePicker();

            lastAttendanceDateRangePicker.ID = filterControl.ID + "_lastAttendanceDateRangePicker";
            lastAttendanceDateRangePicker.AddCssClass("js-lastattendance-sliding-date-range");
            lastAttendanceDateRangePicker.Label = "Last Attendance";
            lastAttendanceDateRangePicker.Help  = "The date range of the last attendance using the 'Sunday Date' of each attendance";
            pwAdvanced.Controls.Add(lastAttendanceDateRangePicker);

            return(new Control[11] {
                gp, cbChildGroups, cbIncludeSelectedGroup, cbChildGroupsPlusDescendants, cblRole, ddlGroupMemberStatus, cbIncludeInactiveGroups, addedOnDateRangePicker, pwAdvanced, firstAttendanceDateRangePicker, lastAttendanceDateRangePicker
            });
        }
Пример #22
0
        /// <summary>
        /// Handles the ItemDataBound event of the rptDataFilters control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RepeaterItemEventArgs"/> instance containing the event data.</param>
        protected void rptDataFilters_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var filterInfo = e.Item.DataItem as ReportingHelper.FilterInfo;

            if (filterInfo != null)
            {
                var showInputs = true;
                if (filterInfo.FilterExpressionType != FilterExpressionType.Filter)
                {
                    // Don't show Checkboxes or PrePostHtml for any of the Grouped Filter types
                    showInputs = false;
                }
                else
                {
                    var otherDataViewFilter = filterInfo.Component as Rock.Reporting.DataFilter.OtherDataViewFilter;
                    if (otherDataViewFilter != null && otherDataViewFilter.GetSelectedDataView(filterInfo.Selection) != null)
                    {
                        // Don't show the Row (or Checkboxes) for any of the OtherDataView filters
                        e.Item.Visible = false;
                        showInputs     = false;
                    }
                }

                HiddenField  hfDataFilterGuid = e.Item.FindControl("hfDataFilterGuid") as HiddenField;
                RockCheckBox cbIsVisible      = e.Item.FindControl("cbIsVisible") as RockCheckBox;
                RockCheckBox cbIsConfigurable = e.Item.FindControl("cbIsConfigurable") as RockCheckBox;
                RockCheckBox cbIsTogglable    = e.Item.FindControl("cbIsTogglable") as RockCheckBox;
                RockTextBox  tbLabelHtml      = e.Item.FindControl("tbLabelHtml") as RockTextBox;
                RockTextBox  tbPreHtml        = e.Item.FindControl("tbPreHtml") as RockTextBox;
                RockTextBox  tbPostHtml       = e.Item.FindControl("tbPostHtml") as RockTextBox;
                Literal      lFilterDetails   = e.Item.FindControl("lFilterDetails") as Literal;

                cbIsVisible.Visible      = showInputs;
                cbIsConfigurable.Visible = showInputs;
                cbIsTogglable.Visible    = showInputs;
                tbLabelHtml.Visible      = showInputs;
                tbPreHtml.Visible        = showInputs;
                tbPostHtml.Visible       = showInputs;

                hfDataFilterGuid.Value = filterInfo.Guid.ToString();
                if (_selectedDataFilterGuids != null)
                {
                    cbIsVisible.Checked = _selectedDataFilterGuids.Contains(filterInfo.Guid);
                }
                else
                {
                    cbIsVisible.Checked = true;
                }

                if (_configurableDataFilterGuids != null)
                {
                    cbIsConfigurable.Checked = _configurableDataFilterGuids.Contains(filterInfo.Guid);
                }
                else
                {
                    cbIsConfigurable.Checked = true;
                }

                if (_togglableDataFilterGuids != null)
                {
                    cbIsTogglable.Checked = _togglableDataFilterGuids.Contains(filterInfo.Guid);
                }
                else
                {
                    cbIsTogglable.Checked = true;
                }

                var dataFilterPrePostHtmlConfig = _dataFiltersPrePostHtmlConfig.GetValueOrNull(filterInfo.Guid);
                if (dataFilterPrePostHtmlConfig != null)
                {
                    tbLabelHtml.Text = dataFilterPrePostHtmlConfig.LabelHtml;
                    tbPreHtml.Text   = dataFilterPrePostHtmlConfig.PreHtml;
                    tbPostHtml.Text  = dataFilterPrePostHtmlConfig.PostHtml;
                }
                else
                {
                    tbLabelHtml.Text = "{{ Label }}";
                }

                lFilterDetails.Text = new DescriptionList()
                                      .Add("Filter", filterInfo.TitlePath)
                                      .Add("Summary", filterInfo.Summary)
                                      .Add("Parent Data View", filterInfo.FromOtherDataView)
                                      .Html;
            }
        }
Пример #23
0
        /// <summary>
        /// Handles the SaveClick event of the mdConfigure 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 mdConfigure_SaveClick(object sender, EventArgs e)
        {
            if (rptDataFilters.Visible)
            {
                _selectedDataFilterGuids      = new List <Guid>();
                _configurableDataFilterGuids  = new List <Guid>();
                _togglableDataFilterGuids     = new List <Guid>();
                _dataFiltersPrePostHtmlConfig = new Dictionary <Guid, DataFilterPrePostHtmlConfig>();
                foreach (var item in rptDataFilters.Items.OfType <RepeaterItem>())
                {
                    HiddenField  hfDataFilterGuid = item.FindControl("hfDataFilterGuid") as HiddenField;
                    RockCheckBox cbIsVisible      = item.FindControl("cbIsVisible") as RockCheckBox;
                    RockCheckBox cbIsConfigurable = item.FindControl("cbIsConfigurable") as RockCheckBox;
                    RockCheckBox cbIsTogglable    = item.FindControl("cbIsTogglable") as RockCheckBox;
                    RockTextBox  tbLabelHtml      = item.FindControl("tbLabelHtml") as RockTextBox;
                    RockTextBox  tbPreHtml        = item.FindControl("tbPreHtml") as RockTextBox;
                    RockTextBox  tbPostHtml       = item.FindControl("tbPostHtml") as RockTextBox;

                    Guid dataFilterGuid = hfDataFilterGuid.Value.AsGuid();
                    if (cbIsVisible.Checked)
                    {
                        _selectedDataFilterGuids.Add(dataFilterGuid);
                    }

                    if (cbIsConfigurable.Checked)
                    {
                        _configurableDataFilterGuids.Add(dataFilterGuid);
                    }

                    if (cbIsTogglable.Checked)
                    {
                        _togglableDataFilterGuids.Add(dataFilterGuid);
                    }

                    _dataFiltersPrePostHtmlConfig.Add(
                        dataFilterGuid,
                        new DataFilterPrePostHtmlConfig
                    {
                        LabelHtml = tbLabelHtml.Text,
                        PreHtml   = tbPreHtml.Text,
                        PostHtml  = tbPostHtml.Text
                    });
                }

                this.SetAttributeValue("SelectedDataFieldGuids", _selectedDataFilterGuids.Select(a => a.ToString()).ToList().AsDelimited("|"));
                this.SetAttributeValue("ConfigurableDataFieldGuids", _configurableDataFilterGuids.Select(a => a.ToString()).ToList().AsDelimited("|"));
                this.SetAttributeValue("TogglableDataFieldGuids", _togglableDataFilterGuids.Select(a => a.ToString()).ToList().AsDelimited("|"));
                this.SetAttributeValue("DataFiltersPrePostHtmlConfig", _dataFiltersPrePostHtmlConfig.ToJson());
            }

            mdConfigure.Hide();
            pnlConfigure.Visible = false;

            this.SetAttributeValue("ResultsTitle", txtResultsTitle.Text);
            this.SetAttributeValue("ResultsIconCssClass", txtResultsIconCssClass.Text);
            this.SetAttributeValue("FilterTitle", txtFilterTitle.Text);
            this.SetAttributeValue("FilterIconCssClass", txtFilterIconCssClass.Text);

            Guid?reportGuid = rpReport.SelectedValueAsId().HasValue ? new ReportService(new RockContext()).GetGuid(rpReport.SelectedValueAsId().Value) : null;

            this.SetAttributeValue("Report", reportGuid.ToString());
            this.SetAttributeValue("PersonIdField", ddlPersonIdField.SelectedValue);
            SaveAttributeValues();

            this.Block_BlockUpdated(sender, e);
        }
Пример #24
0
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of defined types (the one that gets selected is
            // used to build a list of defined values)
            var ddlDefinedType = new RockDropDownList();

            controls.Add(ddlDefinedType);
            ddlDefinedType.AutoPostBack          = true;
            ddlDefinedType.SelectedIndexChanged += OnQualifierUpdated;
            ddlDefinedType.Label = "Defined Type";
            ddlDefinedType.Help  = "The Defined Type to select values from.";

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService(new RockContext());
            foreach (var definedType in definedTypeService.Queryable().OrderBy(d => d.Name))
            {
                ddlDefinedType.Items.Add(new ListItem(definedType.Name, definedType.Id.ToString()));
            }

            // Add checkbox for deciding if the defined values list is rendered as a drop
            // down list or a checkbox list.
            var cbAllowMultipleValues = new RockCheckBox();

            controls.Add(cbAllowMultipleValues);
            cbAllowMultipleValues.AutoPostBack    = true;
            cbAllowMultipleValues.CheckedChanged += OnQualifierUpdated;
            cbAllowMultipleValues.Label           = "Allow Multiple Values";
            cbAllowMultipleValues.Text            = "Yes";
            cbAllowMultipleValues.Help            = "When set, allows multiple defined type values to be selected.";

            // option for Display Descriptions
            var cbDescription = new RockCheckBox();

            controls.Add(cbDescription);
            cbDescription.AutoPostBack    = true;
            cbDescription.CheckedChanged += OnQualifierUpdated;
            cbDescription.Label           = "Display Descriptions";
            cbDescription.Text            = "Yes";
            cbDescription.Help            = "When set, the defined value descriptions will be displayed instead of the values.";

            // option for Displaying an enhanced 'chosen' value picker
            var cbEnhanced = new RockCheckBox();

            controls.Add(cbEnhanced);
            cbEnhanced.AutoPostBack    = true;
            cbEnhanced.CheckedChanged += OnQualifierUpdated;
            cbEnhanced.Label           = "Enhance For Long Lists";
            cbEnhanced.Text            = "Yes";
            cbEnhanced.Help            = "When set, will render a searchable selection of options.";

            // Add checkbox for deciding if the list should include inactive items
            var cbIncludeInactive = new RockCheckBox();

            controls.Add(cbIncludeInactive);
            cbIncludeInactive.AutoPostBack    = true;
            cbIncludeInactive.CheckedChanged += OnQualifierUpdated;
            cbIncludeInactive.Label           = "Include Inactive";
            cbIncludeInactive.Text            = "Yes";
            cbIncludeInactive.Help            = "When set, inactive defined values will be included in the list.";

            // Checkbox to indicate if new defined types can be added via the field type.
            var cbAllowAddingNewValues = new RockCheckBox
            {
                AutoPostBack = true,
                Label        = "Allow Adding New Values",
                Text         = "Yes",
                Help         = "When set the defined type picker can be used to add new defined types."
            };

            cbAllowAddingNewValues.CheckedChanged += OnQualifierUpdated;
            controls.Add(cbAllowAddingNewValues);

            var tbRepeatColumns = new NumberBox
            {
                AutoPostBack = true,
                Label        = "Repeat Columns",
                Help         = "Select how many columns the list should use before going to the next row. If 0 then the options are put next to each other and wrap around. If blank then 4 columns will be displayed. There is no upper limit enforced here however the block this is used in might add contraints due to available space.",
                MinimumValue = "0"
            };

            tbRepeatColumns.TextChanged += OnQualifierUpdated;
            controls.Add(tbRepeatColumns);

            return(controls);
        }
Пример #25
0
        /// <summary>
        /// Save RSVP response data from grid (to Attendance records).
        /// </summary>
        protected bool SaveRSVPData()
        {
            var attendees = new List <RSVPAttendee>();

            foreach (GridViewRow row in gAttendees.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    RockCheckBox     rcbAccept         = row.FindControl("rcbAccept") as RockCheckBox;
                    RockCheckBox     rcbDecline        = row.FindControl("rcbDecline") as RockCheckBox;
                    DataDropDownList rddlDeclineReason = row.FindControl("rddlDeclineReason") as DataDropDownList;
                    RockTextBox      tbDeclineNote     = row.FindControl("tbDeclineNote") as RockTextBox;
                    int    declineReason = int.Parse(rddlDeclineReason.SelectedValue);
                    string declineNote   = tbDeclineNote.Text;

                    attendees.Add(
                        new RSVPAttendee()
                    {
                        Accept        = rcbAccept.Checked,
                        Decline       = rcbDecline.Checked,
                        DeclineNote   = declineNote,
                        DeclineReason = declineReason,
                        PersonId      = ( int )gAttendees.DataKeys[row.RowIndex].Value
                    }
                        );
                }
            }
            using (var rockContext = new RockContext())
            {
                var occurrenceService  = new AttendanceOccurrenceService(rockContext);
                var attendanceService  = new AttendanceService(rockContext);
                var personAliasService = new PersonAliasService(rockContext);

                AttendanceOccurrence occurrence = null;

                int?groupId      = PageParameter(PageParameterKey.GroupId).AsIntegerOrNull();
                int?occurrenceId = PageParameter(PageParameterKey.OccurrenceId).AsIntegerOrNull();

                if ((occurrenceId == null) || (occurrenceId == 0))
                {
                    occurrenceId = hfNewOccurrenceId.Value.AsIntegerOrNull();
                    if ((occurrenceId == null) || (occurrenceId == 0))
                    {
                        throw new Exception("The AttendanceOccurrence does not exist.");
                    }
                }

                occurrence = occurrenceService.Get(occurrenceId.Value);

                var existingAttendees = occurrence.Attendees.ToList();

                foreach (var attendee in attendees)
                {
                    var attendance = existingAttendees
                                     .Where(a => a.PersonAlias.PersonId == attendee.PersonId)
                                     .FirstOrDefault();

                    if (attendance == null)
                    {
                        int?personAliasId = personAliasService.GetPrimaryAliasId(attendee.PersonId);
                        if (personAliasId.HasValue)
                        {
                            attendance = new Attendance();
                            attendance.PersonAliasId = personAliasId;
                            attendance.StartDateTime = occurrence.Schedule != null && occurrence.Schedule.HasSchedule() ? occurrence.OccurrenceDate.Date.Add(occurrence.Schedule.StartTimeOfDay) : occurrence.OccurrenceDate;
                            occurrence.Attendees.Add(attendance);
                        }
                    }

                    if (attendance != null)
                    {
                        if (attendee.Accept)
                        {
                            var groupMember = occurrence.Group.Members.Where(gm => gm.PersonId == attendee.PersonId).FirstOrDefault();
                            if (groupMember == null)
                            {
                                groupMember             = new GroupMember();
                                groupMember.PersonId    = attendee.PersonId;
                                groupMember.GroupId     = occurrence.Group.Id;
                                groupMember.GroupRoleId = occurrence.Group.GroupType.DefaultGroupRoleId ?? 0;

                                new GroupMemberService(rockContext).Add(groupMember);
                                rockContext.SaveChanges();
                            }

                            // only set the RSVP and Date if the value is changing
                            if (attendance.RSVP != Rock.Model.RSVP.Yes)
                            {
                                attendance.RSVPDateTime = DateTime.Now;
                                attendance.RSVP         = Rock.Model.RSVP.Yes;
                            }
                            attendance.Note = string.Empty;
                            attendance.DeclineReasonValueId = null;
                        }
                        else if (attendee.Decline)
                        {
                            // only set the RSVP and Date if the value is changing
                            if (attendance.RSVP != Rock.Model.RSVP.No)
                            {
                                attendance.RSVPDateTime = DateTime.Now;
                                attendance.RSVP         = Rock.Model.RSVP.No;
                            }

                            attendance.Note = attendee.DeclineNote;
                            if (attendee.DeclineReason != 0)
                            {
                                attendance.DeclineReasonValueId = attendee.DeclineReason;
                            }
                        }
                        else
                        {
                            attendance.RSVPDateTime         = null;
                            attendance.RSVP                 = Rock.Model.RSVP.Unknown;
                            attendance.Note                 = string.Empty;
                            attendance.DeclineReasonValueId = null;
                        }
                    }
                }

                rockContext.SaveChanges();

                if (occurrence.LocationId.HasValue)
                {
                    Rock.CheckIn.KioskLocationAttendance.Remove(occurrence.LocationId.Value);
                }
            }

            return(true);
        }
Пример #26
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            gp                  = new GroupPicker();
            gp.ID               = filterControl.ID + "_gp";
            gp.Label            = "Group(s)";
            gp.SelectItem      += gp_SelectItem;
            gp.CssClass         = "js-group-picker";
            gp.AllowMultiSelect = true;
            filterControl.Controls.Add(gp);

            cbChildGroups                 = new RockCheckBox();
            cbChildGroups.ID              = filterControl.ID + "_cbChildsGroups";
            cbChildGroups.Text            = "Include Child Group(s)";
            cbChildGroups.CssClass        = "js-include-child-groups";
            cbChildGroups.AutoPostBack    = true;
            cbChildGroups.CheckedChanged += gp_SelectItem;
            filterControl.Controls.Add(cbChildGroups);

            cbIncludeSelectedGroup                 = new RockCheckBox();
            cbIncludeSelectedGroup.ID              = filterControl.ID + "_cbIncludeSelectedGroup";
            cbIncludeSelectedGroup.Text            = "Include Selected Group(s)";
            cbIncludeSelectedGroup.CssClass        = "js-include-selected-groups";
            cbIncludeSelectedGroup.AutoPostBack    = true;
            cbIncludeSelectedGroup.CheckedChanged += gp_SelectItem;
            filterControl.Controls.Add(cbIncludeSelectedGroup);

            cbChildGroupsPlusDescendants                 = new RockCheckBox();
            cbChildGroupsPlusDescendants.ID              = filterControl.ID + "_cbChildGroupsPlusDescendants";
            cbChildGroupsPlusDescendants.Text            = "Include All Descendants(s)";
            cbChildGroupsPlusDescendants.CssClass        = "js-include-child-groups-descendants";
            cbChildGroupsPlusDescendants.AutoPostBack    = true;
            cbChildGroupsPlusDescendants.CheckedChanged += gp_SelectItem;
            filterControl.Controls.Add(cbChildGroupsPlusDescendants);

            cbIncludeInactiveGroups                 = new RockCheckBox();
            cbIncludeInactiveGroups.ID              = filterControl.ID + "_cbIncludeInactiveGroups";
            cbIncludeInactiveGroups.Text            = "Include Inactive Groups";
            cbIncludeInactiveGroups.CssClass        = "js-include-inactive-groups";
            cbIncludeInactiveGroups.AutoPostBack    = true;
            cbIncludeInactiveGroups.CheckedChanged += gp_SelectItem;
            filterControl.Controls.Add(cbIncludeInactiveGroups);

            cblRole          = new RockCheckBoxList();
            cblRole.Label    = "with Group Member Role(s) (optional)";
            cblRole.ID       = filterControl.ID + "_cblRole";
            cblRole.CssClass = "js-roles";
            cblRole.Visible  = false;
            filterControl.Controls.Add(cblRole);

            RockDropDownList ddlGroupMemberStatus = new RockDropDownList();

            ddlGroupMemberStatus.CssClass = "js-group-member-status";
            ddlGroupMemberStatus.ID       = filterControl.ID + "_ddlGroupMemberStatus";
            ddlGroupMemberStatus.Label    = "with Group Member Status";
            ddlGroupMemberStatus.Help     = "Select a specific group member status to only include group members with that status. Leaving this blank will return all members.";
            ddlGroupMemberStatus.BindToEnum <GroupMemberStatus>(true);
            ddlGroupMemberStatus.SetValue(GroupMemberStatus.Active.ConvertToInt());
            filterControl.Controls.Add(ddlGroupMemberStatus);

            return(new Control[7] {
                gp, cbChildGroups, cbIncludeSelectedGroup, cbChildGroupsPlusDescendants, cblRole, ddlGroupMemberStatus, cbIncludeInactiveGroups
            });
        }
        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List <Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of defined types (the one that gets selected is
            // used to build a list of defined values)
            var ddlDefinedType = new RockDropDownList();

            controls.Add(ddlDefinedType);
            ddlDefinedType.AutoPostBack          = true;
            ddlDefinedType.SelectedIndexChanged += OnQualifierUpdated;
            ddlDefinedType.Label = "Defined Type";
            ddlDefinedType.Help  = "The Defined Type to select values from.";

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService(new RockContext());
            foreach (var definedType in definedTypeService.Queryable().OrderBy(d => d.Name))
            {
                ddlDefinedType.Items.Add(new ListItem(definedType.Name, definedType.Id.ToString()));
            }

            // Add checkbox for deciding if the defined values list is rendered as a drop
            // down list or a checkbox list.
            var cbAllowMultipleValues = new RockCheckBox();

            controls.Add(cbAllowMultipleValues);
            cbAllowMultipleValues.AutoPostBack    = true;
            cbAllowMultipleValues.CheckedChanged += OnQualifierUpdated;
            cbAllowMultipleValues.Label           = "Allow Multiple Values";
            cbAllowMultipleValues.Text            = "Yes";
            cbAllowMultipleValues.Help            = "When set, allows multiple defined type values to be selected.";

            // option for Display Descriptions
            var cbDescription = new RockCheckBox();

            controls.Add(cbDescription);
            cbDescription.AutoPostBack    = true;
            cbDescription.CheckedChanged += OnQualifierUpdated;
            cbDescription.Label           = "Display Descriptions";
            cbDescription.Text            = "Yes";
            cbDescription.Help            = "When set, the defined value descriptions will be displayed instead of the values.";

            // option for Displaying an enhanced 'chosen' value picker
            var cbEnhanced = new RockCheckBox();

            controls.Add(cbEnhanced);
            cbEnhanced.AutoPostBack    = true;
            cbEnhanced.CheckedChanged += OnQualifierUpdated;
            cbEnhanced.Label           = "Enhance For Long Lists";
            cbEnhanced.Text            = "Yes";
            cbEnhanced.Help            = "When set, will render a searchable selection of options.";

            // Add checkbox for deciding if the list should include inactive items
            var cbIncludeInactive = new RockCheckBox();

            controls.Add(cbIncludeInactive);
            cbIncludeInactive.AutoPostBack    = true;
            cbIncludeInactive.CheckedChanged += OnQualifierUpdated;
            cbIncludeInactive.Label           = "Include Inactive";
            cbIncludeInactive.Text            = "Yes";
            cbIncludeInactive.Help            = "When set, inactive defined values will be included in the list.";

            return(controls);
        }
Пример #28
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);
            }
        }
Пример #29
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(Type entityType, Control[] controls, string selection)
        {
            if (controls.Count() < 6)
            {
                return;
            }

            GroupPicker      groupPicker                  = controls[0] as GroupPicker;
            RockCheckBox     cbChildGroups                = controls[1] as RockCheckBox;
            RockCheckBox     cbIncludeSelectedGroup       = controls[2] as RockCheckBox;
            RockCheckBox     cbChildGroupsPlusDescendants = controls[3] as RockCheckBox;
            RockCheckBoxList cblRoles             = controls[4] as RockCheckBoxList;
            RockDropDownList ddlGroupMemberStatus = controls[5] as RockDropDownList;
            RockCheckBox     cbIncludeInactive    = controls[6] as RockCheckBox;

            string[] selectionValues = selection.Split('|');
            if (selectionValues.Length >= 2)
            {
                List <Guid> groupGuids = selectionValues[0].Split(',').AsGuidList();
                var         groups     = new GroupService(new RockContext()).GetByGuids(groupGuids);
                if (groups != null)
                {
                    groupPicker.SetValues(groups);
                }

                if (selectionValues.Length >= 3)
                {
                    cbChildGroups.Checked = selectionValues[2].AsBooleanOrNull() ?? false;
                }

                if (selectionValues.Length >= 6)
                {
                    cbIncludeSelectedGroup.Checked       = selectionValues[4].AsBooleanOrNull() ?? false;
                    cbChildGroupsPlusDescendants.Checked = selectionValues[5].AsBooleanOrNull() ?? false;
                }
                else
                {
                    cbIncludeSelectedGroup.Checked       = true;
                    cbChildGroupsPlusDescendants.Checked = true;
                }

                if (selectionValues.Length >= 7)
                {
                    cbIncludeInactiveGroups.Checked = selectionValues[6].AsBooleanOrNull() ?? false;
                }
                else
                {
                    // if options where saved before this option was added, set to false, even though it would have included inactive before
                    cbIncludeInactiveGroups.Checked = false;
                }

                gp_SelectItem(this, new EventArgs());

                string[] selectedRoleGuids = selectionValues[1].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var item in cblRoles.Items.OfType <ListItem>())
                {
                    item.Selected = selectedRoleGuids.Contains(item.Value);
                }

                if (selectionValues.Length >= 4)
                {
                    ddlGroupMemberStatus.SetValue(selectionValues[3]);
                }
                else
                {
                    ddlGroupMemberStatus.SetValue(string.Empty);
                }
            }
        }
Пример #30
0
        /// <summary>
        /// Saves the settings.
        /// </summary>
        private void SaveSettings()
        {
            // Save General
            Rock.Web.SystemSettings.SetValue(SystemSetting.GENDER_AUTO_FILL_CONFIDENCE, nbGenderAutoFill.Text);

            // Save Data Automation
            _reactivateSettings = new ReactivatePeople();
            _inactivateSettings = new InactivatePeople();
            _campusSettings     = new UpdateFamilyCampus();

            // Reactivate
            _reactivateSettings.IsEnabled = cbReactivatePeople.Checked;

            _reactivateSettings.IsLastContributionEnabled = cbLastContribution.Checked;
            _reactivateSettings.LastContributionPeriod    = nbLastContribution.Text.AsInteger();

            _reactivateSettings.IsAttendanceInServiceGroupEnabled = cbAttendanceInServiceGroup.Checked;
            _reactivateSettings.AttendanceInServiceGroupPeriod    = nbAttendanceInServiceGroup.Text.AsInteger();

            _reactivateSettings.IsRegisteredInAnyEventEnabled = cbRegisteredInAnyEvent.Checked;
            _reactivateSettings.RegisteredInAnyEventPeriod    = nbRegisteredInAnyEvent.Text.AsInteger();

            _reactivateSettings.IsAttendanceInGroupTypeEnabled = cbAttendanceInGroupType.Checked;
            _reactivateSettings.AttendanceInGroupType          = rlbAttendanceInGroupType.SelectedValues.AsIntegerList();
            _reactivateSettings.AttendanceInGroupTypeDays      = nbAttendanceInGroupType.Text.AsInteger();

            _reactivateSettings.IsSiteLoginEnabled = cbSiteLogin.Checked;
            _reactivateSettings.SiteLoginPeriod    = nbSiteLogin.Text.AsInteger();

            _reactivateSettings.IsPrayerRequestEnabled = cbPrayerRequest.Checked;
            _reactivateSettings.PrayerRequestPeriod    = nbPrayerRequest.Text.AsInteger();

            _reactivateSettings.IsPersonAttributesEnabled = cbPersonAttributes.Checked;
            _reactivateSettings.PersonAttributes          = rlbPersonAttributes.SelectedValues.AsIntegerList();
            _reactivateSettings.PersonAttributesDays      = nbPersonAttributes.Text.AsInteger();

            _reactivateSettings.IsIncludeDataViewEnabled = cbIncludeDataView.Checked;
            _reactivateSettings.IncludeDataView          = dvIncludeDataView.SelectedValueAsInt();

            _reactivateSettings.IsExcludeDataViewEnabled = cbExcludeDataView.Checked;
            _reactivateSettings.ExcludeDataView          = dvExcludeDataView.SelectedValueAsInt();

            _reactivateSettings.IsInteractionsEnabled = cbInteractions.Checked;

            foreach (RepeaterItem rItem in rInteractions.Items)
            {
                RockCheckBox isInterationTypeEnabled = rItem.FindControl("cbInterationType") as RockCheckBox;
                _reactivateSettings.Interactions = _reactivateSettings.Interactions ?? new List <InteractionItem>();
                HiddenField interactionTypeId   = rItem.FindControl("hfInteractionTypeId") as HiddenField;
                NumberBox   lastInteractionDays = rItem.FindControl("nbInteractionDays") as NumberBox;
                var         item = new InteractionItem(interactionTypeId.Value.AsGuid(), string.Empty)
                {
                    IsInteractionTypeEnabled = isInterationTypeEnabled.Checked,
                    LastInteractionDays      = lastInteractionDays.Text.AsInteger()
                };
                _reactivateSettings.Interactions.Add(item);
            }

            // Inactivate
            _inactivateSettings.IsEnabled = cbInactivatePeople.Checked;

            _inactivateSettings.IsNoLastContributionEnabled = cbNoLastContribution.Checked;
            _inactivateSettings.NoLastContributionPeriod    = nbNoLastContribution.Text.AsInteger();

            _inactivateSettings.IsNoAttendanceInGroupTypeEnabled = cbNoAttendanceInGroupType.Checked;
            _inactivateSettings.AttendanceInGroupType            = rlbNoAttendanceInGroupType.SelectedValues.AsIntegerList();
            _inactivateSettings.NoAttendanceInGroupTypeDays      = nbNoAttendanceInGroupType.Text.AsInteger();

            _inactivateSettings.IsNotRegisteredInAnyEventEnabled = cbNoRegistrationInAnyEvent.Checked;
            _inactivateSettings.NotRegisteredInAnyEventDays      = nbNoRegistrationInAnyEvent.Text.AsInteger();

            _inactivateSettings.IsNoSiteLoginEnabled = cbNoSiteLogin.Checked;
            _inactivateSettings.NoSiteLoginPeriod    = nbNoSiteLogin.Text.AsInteger();

            _inactivateSettings.IsNoPrayerRequestEnabled = cbNoPrayerRequest.Checked;
            _inactivateSettings.NoPrayerRequestPeriod    = nbNoPrayerRequest.Text.AsInteger();

            _inactivateSettings.IsNoPersonAttributesEnabled = cbNoPersonAttributes.Checked;
            _inactivateSettings.PersonAttributes            = rlbNoPersonAttributes.SelectedValues.AsIntegerList();
            _inactivateSettings.NoPersonAttributesDays      = nbNoPersonAttributes.Text.AsInteger();

            _inactivateSettings.IsNotInDataviewEnabled = cbNotInDataView.Checked;
            _inactivateSettings.NotInDataview          = dvNotInDataView.SelectedValueAsInt();

            _inactivateSettings.IsNoInteractionsEnabled = cbNoInteractions.Checked;

            _inactivateSettings.RecordsOlderThan = nbRecordsOlderThan.Text.AsInteger();

            foreach (RepeaterItem rItem in rNoInteractions.Items)
            {
                RockCheckBox isInterationTypeEnabled = rItem.FindControl("cbInterationType") as RockCheckBox;
                _inactivateSettings.NoInteractions = _inactivateSettings.NoInteractions ?? new List <InteractionItem>();
                HiddenField interactionTypeId   = rItem.FindControl("hfInteractionTypeId") as HiddenField;
                NumberBox   lastInteractionDays = rItem.FindControl("nbNoInteractionDays") as NumberBox;
                var         item = new InteractionItem(interactionTypeId.Value.AsGuid(), string.Empty)
                {
                    IsInteractionTypeEnabled = isInterationTypeEnabled.Checked,
                    LastInteractionDays      = lastInteractionDays.Text.AsInteger()
                };

                _inactivateSettings.NoInteractions.Add(item);
            }

            // Campus Update
            _campusSettings.IsEnabled = cbCampusUpdate.Checked;

            _campusSettings.IsMostFamilyAttendanceEnabled = cbMostFamilyAttendance.Checked;
            _campusSettings.MostFamilyAttendancePeriod    = nbMostFamilyAttendance.Text.AsInteger();

            _campusSettings.IsMostFamilyGivingEnabled = cbMostFamilyGiving.Checked;
            _campusSettings.MostFamilyGivingPeriod    = nbMostFamilyGiving.Text.AsInteger();

            _campusSettings.MostAttendanceOrGiving = ddlAttendanceOrGiving.SelectedValueAsEnum <CampusCriteria>();

            _campusSettings.IsIgnoreIfManualUpdateEnabled = cbIgnoreIfManualUpdate.Checked;
            _campusSettings.IgnoreIfManualUpdatePeriod    = nbIgnoreIfManualUpdate.Text.AsInteger();

            _campusSettings.IsIgnoreCampusChangesEnabled = cbIgnoreCampusChanges.Checked;
            _campusSettings.IgnoreCampusChanges          =
                _ignoreCampusChangeRows
                .Where(a => a.FromCampusId.HasValue && a.ToCampusId.HasValue)
                .Select(a => new IgnoreCampusChangeItem
            {
                FromCampus = a.FromCampusId.Value,
                ToCampus   = a.ToCampusId.Value,
                BasedOn    = a.CampusCriteria
            })
                .ToList();

            // Adult Children
            _adultChildrenSettings.IsEnabled             = cbAdultChildren.Checked;
            _adultChildrenSettings.IsOnlyMoveGraduated   = cbisMoveGraduated.Checked;
            _adultChildrenSettings.AdultAge              = nbAdultAge.Text.AsIntegerOrNull() ?? 18;
            _adultChildrenSettings.ParentRelationshipId  = rpParentRelationship.GroupRoleId;
            _adultChildrenSettings.SiblingRelationshipId = rpSiblingRelationship.GroupRoleId;
            _adultChildrenSettings.UseSameHomeAddress    = cbSameAddress.Checked;
            _adultChildrenSettings.UseSameHomePhone      = cbSamePhone.Checked;
            _adultChildrenSettings.WorkflowTypeIds       = wfWorkflows.SelectedValuesAsInt().ToList();
            _adultChildrenSettings.MaximumRecords        = nbMaxRecords.Text.AsIntegerOrNull() ?? 200;

            // Update Connection Status
            _updatePersonConnectionStatus.IsEnabled = cbUpdatePersonConnectionStatus.Checked;
            _updatePersonConnectionStatus.ConnectionStatusValueIdDataviewIdMapping.Clear();
            foreach (var item in rptPersonConnectionStatusDataView.Items.OfType <RepeaterItem>())
            {
                HiddenField        hfPersonConnectionStatusValueId   = item.FindControl("hfPersonConnectionStatusValueId") as HiddenField;
                DataViewItemPicker dvpPersonConnectionStatusDataView = item.FindControl("dvpPersonConnectionStatusDataView") as DataViewItemPicker;
                _updatePersonConnectionStatus.ConnectionStatusValueIdDataviewIdMapping.AddOrReplace(hfPersonConnectionStatusValueId.Value.AsInteger(), dvpPersonConnectionStatusDataView.SelectedValueAsId());
            }

            // Update Family Status
            _updateFamilyStatus.IsEnabled = cbUpdateFamilyStatus.Checked;
            _updateFamilyStatus.GroupStatusValueIdDataviewIdMapping.Clear();
            foreach (var item in rptFamilyStatusDataView.Items.OfType <RepeaterItem>())
            {
                HiddenField        hfGroupStatusValueId   = item.FindControl("hfGroupStatusValueId") as HiddenField;
                DataViewItemPicker dvpGroupStatusDataView = item.FindControl("dvpGroupStatusDataView") as DataViewItemPicker;
                _updateFamilyStatus.GroupStatusValueIdDataviewIdMapping.AddOrReplace(hfGroupStatusValueId.Value.AsInteger(), dvpGroupStatusDataView.SelectedValueAsId());
            }

            Rock.Web.SystemSettings.SetValue(SystemSetting.DATA_AUTOMATION_REACTIVATE_PEOPLE, _reactivateSettings.ToJson());
            Rock.Web.SystemSettings.SetValue(SystemSetting.DATA_AUTOMATION_INACTIVATE_PEOPLE, _inactivateSettings.ToJson());
            Rock.Web.SystemSettings.SetValue(SystemSetting.DATA_AUTOMATION_CAMPUS_UPDATE, _campusSettings.ToJson());
            Rock.Web.SystemSettings.SetValue(SystemSetting.DATA_AUTOMATION_ADULT_CHILDREN, _adultChildrenSettings.ToJson());
            Rock.Web.SystemSettings.SetValue(SystemSetting.DATA_AUTOMATION_UPDATE_PERSON_CONNECTION_STATUS, _updatePersonConnectionStatus.ToJson());
            Rock.Web.SystemSettings.SetValue(SystemSetting.DATA_AUTOMATION_UPDATE_FAMILY_STATUS, _updateFamilyStatus.ToJson());
        }