Esempio n. 1
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="parentControl"></param>
        /// <returns></returns>
        public override Control[] CreateChildControls(Control parentControl)
        {
            // Define Control: Output Format DropDown List
            var ddlFormat = new RockDropDownList();

            ddlFormat.ID    = parentControl.GetChildControlInstanceName(_CtlFormat);
            ddlFormat.Label = "Output Format";
            ddlFormat.Help  = "Specifies the content and format of the values in this field.";
            ddlFormat.Items.Add(new ListItem("Group List: Name And Role", ListFormatSpecifier.GroupAndRole.ToString()));
            ddlFormat.Items.Add(new ListItem("Group List: Group Name", ListFormatSpecifier.GroupOnly.ToString()));
            ddlFormat.Items.Add(new ListItem("Yes/No: Yes if any participation", ListFormatSpecifier.YesNo.ToString()));

            parentControl.Controls.Add(ddlFormat);

            // Define Control: Group Data View Picker
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID    = parentControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.Label = "Participates in Groups";
            dvpDataView.Help  = "A Data View that filters the Groups included in the result. If no value is selected, any Groups that would be visible in a Group List will be included.";
            parentControl.Controls.Add(dvpDataView);

            // Define Control: Role Type DropDown List
            var ddlRoleType = new RockDropDownList();

            ddlRoleType.ID    = parentControl.GetChildControlInstanceName(_CtlRoleType);
            ddlRoleType.Label = "with Group Member Type";
            ddlRoleType.Help  = "Specifies the type of Group Role the Member must have to be included in the result. If no value is selected, Members in any Role will be included.";
            ddlRoleType.Items.Add(new ListItem(string.Empty, RoleTypeSpecifier.Any.ToString()));
            ddlRoleType.Items.Add(new ListItem("Leader", RoleTypeSpecifier.Leader.ToString()));
            ddlRoleType.Items.Add(new ListItem("Member", RoleTypeSpecifier.Member.ToString()));
            parentControl.Controls.Add(ddlRoleType);

            // Define Control: Group Member Status DropDown List
            var ddlGroupMemberStatus = new RockDropDownList();

            ddlGroupMemberStatus.CssClass = "js-group-member-status";
            ddlGroupMemberStatus.ID       = parentControl.GetChildControlInstanceName(_CtlGroupStatus);
            ddlGroupMemberStatus.Label    = "with Group Member Status";
            ddlGroupMemberStatus.Help     = "Specifies the Status the Member must have to be included in the result. If no value is selected, Members of any Group Status will be shown.";
            ddlGroupMemberStatus.BindToEnum <GroupMemberStatus>(true);
            ddlGroupMemberStatus.SetValue(GroupMemberStatus.Active.ConvertToInt());
            parentControl.Controls.Add(ddlGroupMemberStatus);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(Model.Group)).Id;

            dvpDataView.EntityTypeId = entityTypeId;

            return(new Control[] { dvpDataView, ddlRoleType, ddlFormat, ddlGroupMemberStatus });
        }
Esempio n. 2
0
        /// <summary>
        /// Handles the ItemDataBound event of the rptFamilyStatusDataView 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 rptFamilyStatusDataView_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            FamilyStatusDataView groupStatusDataView    = e.Item.DataItem as FamilyStatusDataView;
            HiddenField          hfGroupStatusValueId   = e.Item.FindControl("hfGroupStatusValueId") as HiddenField;
            DataViewItemPicker   dvpGroupStatusDataView = e.Item.FindControl("dvpGroupStatusDataView") as DataViewItemPicker;

            if (groupStatusDataView != null)
            {
                hfGroupStatusValueId.Value          = groupStatusDataView.GroupStatusValue.Id.ToString();
                dvpGroupStatusDataView.EntityTypeId = EntityTypeCache.GetId <Rock.Model.Group>();
                dvpGroupStatusDataView.Label        = groupStatusDataView.GroupStatusValue.ToString();
                dvpGroupStatusDataView.SetValue(groupStatusDataView.DataViewId);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Handles the ItemDataBound event of the rptPersonConnectionStatusDataView 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 rptPersonConnectionStatusDataView_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            PersonConnectionStatusDataView personConnectionStatusDataView = e.Item.DataItem as PersonConnectionStatusDataView;
            HiddenField        hfPersonConnectionStatusValueId            = e.Item.FindControl("hfPersonConnectionStatusValueId") as HiddenField;
            DataViewItemPicker dvpPersonConnectionStatusDataView          = e.Item.FindControl("dvpPersonConnectionStatusDataView") as DataViewItemPicker;

            if (personConnectionStatusDataView != null)
            {
                hfPersonConnectionStatusValueId.Value          = personConnectionStatusDataView.PersonConnectionStatusValue.Id.ToString();
                dvpPersonConnectionStatusDataView.EntityTypeId = EntityTypeCache.GetId <Rock.Model.Person>();
                dvpPersonConnectionStatusDataView.Label        = personConnectionStatusDataView.PersonConnectionStatusValue.ToString();
                dvpPersonConnectionStatusDataView.SetValue(personConnectionStatusDataView.DataViewId);
            }
        }
        /// <summary>
        /// Creates the model representation of the child controls used to display and edit the filter settings.
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="filterControl">The control that serves as the container for the filter controls.</param>
        /// <returns>
        /// The array of new controls created to implement the filter.
        /// </returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            // Define Control: Person Data View Picker
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID    = filterControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.Label = "Represents People from this Data View";
            dvpDataView.Help  = "A Person Data View that represents the set of possible Prayer Requests.";
            filterControl.Controls.Add(dvpDataView);

            // Populate the Data View Picker
            dvpDataView.EntityTypeId = EntityTypeCache.Get(typeof(Rock.Model.Person)).Id;

            return(new Control[] { dvpDataView });
        }
        /// <summary>
        /// Creates the model representation of the child controls used to display and edit the filter settings.
        /// Implement this version of CreateChildControls if your DataFilterComponent works the same in all filter modes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="filterControl">The control that serves as the container for the filter controls.</param>
        /// <returns>
        /// The array of new controls created to implement the filter.
        /// </returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            // Define Control: Group Data View Picker
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID    = filterControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.Label = "Is Member of Group from Data View";
            dvpDataView.Help  = "A Data View that filters the Groups included in the result. If no value is selected, any Groups that would be visible in a Group List will be included.";
            filterControl.Controls.Add(dvpDataView);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(Model.Group)).Id;

            dvpDataView.EntityTypeId = entityTypeId;

            return(new Control[] { dvpDataView });
        }
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="filterControl">The control that serves as the container for the filter controls.</param>
        /// <returns>
        /// The array of new controls created to implement the filter.
        /// </returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID    = filterControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.Label = "Has a Person in this Data View";
            dvpDataView.Help  = "A Data View that provides the set of Person to match.";

            filterControl.Controls.Add(dvpDataView);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(Model.FinancialPledge)).Id;

            dvpDataView.EntityTypeId = entityTypeId;

            return(new Control[] { dvpDataView });
        }
Esempio n. 7
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="filterControl">The control that serves as the container for the filter controls.</param>
        /// <returns>
        /// The array of new controls created to implement the filter.
        /// </returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            // Define Control: History Data View Picker
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID    = filterControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.Label = "Has a Group Type in this Data View";
            dvpDataView.Help  = "A Data View that provides the set of Group Types to match.";

            filterControl.Controls.Add(dvpDataView);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(GroupType)).Id;

            dvpDataView.EntityTypeId = entityTypeId;

            return(new Control[] { dvpDataView });
        }
Esempio n. 8
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            // Define Control: Person Device Data View Picker
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID    = filterControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.Label = "In Personal Device Data View";
            dvpDataView.Help  = "A Personal Device Data View that provides the set of possible people with personal devices.";

            filterControl.Controls.Add(dvpDataView);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(Model.PersonalDevice)).Id;

            dvpDataView.EntityTypeId = entityTypeId;

            return(new Control[] { dvpDataView });
        }
        /// <summary>
        /// Creates the model representation of the child controls used to display and edit the filter settings.
        /// Implement this version of CreateChildControls if your DataFilterComponent works the same in all filter modes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="filterControl">The control that serves as the container for the filter controls.</param>
        /// <returns>
        /// The array of new controls created to implement the filter.
        /// </returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            // Define Control: History Data View Picker
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID    = filterControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.Label = "Connected to History Records";
            dvpDataView.Help  = "A Data View that provides the set of History items to which the Person may be connected, either because the history is attached to their record or it affected them in some way.";

            filterControl.Controls.Add(dvpDataView);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(History)).Id;

            dvpDataView.EntityTypeId = entityTypeId;

            return(new Control[] { dvpDataView });
        }
Esempio n. 10
0
        /// <summary>
        /// Creates the model representation of the child controls used to display and edit the filter settings.
        /// Implement this version of CreateChildControls if your DataFilterComponent works the same in all filter modes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="filterControl">The control that serves as the container for the filter controls.</param>
        /// <returns>
        /// The array of new controls created to implement the filter.
        /// </returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            // Define Control: Person Data View Picker
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID       = filterControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.CssClass = "js-data-view-picker";
            dvpDataView.Label    = "People from Data View";
            dvpDataView.Help     = "A Data View that filters the People included in the result.";
            filterControl.Controls.Add(dvpDataView);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(Model.Person)).Id;

            dvpDataView.EntityTypeId = entityTypeId;

            return(new Control[] { dvpDataView });
        }
Esempio n. 11
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="parentControl">The parent control.</param>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField parentControl)
        {
            var ddlDataView = new DataViewItemPicker();

            ddlDataView.ID       = parentControl.GetChildControlInstanceName(_CtlDataView);
            ddlDataView.CssClass = "js-data-view-picker";

            parentControl.Controls.Add(ddlDataView);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(TRelatedEntity)).Id;

            ddlDataView.EntityTypeId = entityTypeId;

            this.OnConfigureDataViewItemPicker(ddlDataView);

            return(new Control[] { ddlDataView });
        }
Esempio n. 12
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            // Define Control: Data View Picker
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID    = filterControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.Label = "In Step Data View";
            dvpDataView.Help  = "A Step Data View that provides the set of possible step participants.";

            filterControl.Controls.Add(dvpDataView);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(Model.Step)).Id;

            dvpDataView.EntityTypeId = entityTypeId;

            return(new Control[] { dvpDataView });
        }
Esempio n. 13
0
        /// <summary>
        /// Creates the model representation of the child controls used to display and edit the filter settings.
        /// Implement this version of CreateChildControls if your DataFilterComponent works the same in all filter modes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="filterControl">The control that serves as the container for the filter controls.</param>
        /// <returns>
        /// The array of new controls created to implement the filter.
        /// </returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            // Define Control: Group Data View Picker
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID       = filterControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.CssClass = "js-data-view-picker";
            dvpDataView.Label    = "Is Member of Group from Data View";
            dvpDataView.Help     = "A Data View that filters the Groups included in the result. If no value is selected, any Groups that would be visible in a Group List will be included.";
            filterControl.Controls.Add(dvpDataView);

            // Define Control: Group Member Status DropDown List
            var ddlGroupMemberStatus = new RockDropDownList();

            ddlGroupMemberStatus.ID       = filterControl.GetChildControlInstanceName(_CtlGroupStatus);
            ddlGroupMemberStatus.CssClass = "js-group-member-status";
            ddlGroupMemberStatus.Label    = "with Group Member Status";
            ddlGroupMemberStatus.Help     = "Specifies the Status the Member must have to be included in the result. If no value is selected, Members of every Group Status will be shown.";
            ddlGroupMemberStatus.BindToEnum <GroupMemberStatus>(true);
            ddlGroupMemberStatus.SetValue(GroupMemberStatus.Active.ConvertToInt());
            filterControl.Controls.Add(ddlGroupMemberStatus);

            // Define Control: Role Type DropDown List
            var ddlRoleType = new RockDropDownList();

            ddlRoleType.ID       = filterControl.GetChildControlInstanceName(_CtlRoleType);
            ddlRoleType.CssClass = "js-group-member-role";
            ddlRoleType.Label    = "with Group Role Type";
            ddlRoleType.Help     = "Specifies the type of Group Role the Member must have to be included in the result. If no value is selected, Members in every Role will be shown.";
            ddlRoleType.Items.Add(new ListItem(string.Empty, RoleTypeSpecifier.Any.ToString()));
            ddlRoleType.Items.Add(new ListItem("Leader", RoleTypeSpecifier.Leader.ToString()));
            ddlRoleType.Items.Add(new ListItem("Member", RoleTypeSpecifier.Member.ToString()));
            filterControl.Controls.Add(ddlRoleType);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(Model.Group)).Id;

            dvpDataView.EntityTypeId = entityTypeId;

            return(new Control[] { dvpDataView, ddlGroupMemberStatus, ddlRoleType });
        }
Esempio n. 14
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="parentControl">The parent control.</param>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField parentControl)
        {
            // Define Control: Location Data View Picker
            var dvpDataView = new DataViewItemPicker();

            dvpDataView.ID       = parentControl.GetChildControlInstanceName(_CtlDataView);
            dvpDataView.CssClass = "js-data-view-picker";
            dvpDataView.Label    = "Connected to Locations";
            dvpDataView.Help     = "A Data View that provides the list of Locations to which the Person may be connected.";

            parentControl.Controls.Add(dvpDataView);

            // Define Control: Location Type DropDown List
            var ddlLocationType = new RockDropDownList();

            ddlLocationType.ID       = parentControl.GetChildControlInstanceName(_CtlLocationType);
            ddlLocationType.CssClass = "js-location-type-picker";
            ddlLocationType.Label    = "Address Type";
            ddlLocationType.Help     = "Specifies the type of Address the filter will be applied to. If no value is selected, all of the Person's Addresses will be considered.";

            var familyLocations = GroupTypeCache.GetFamilyGroupType().LocationTypeValues.OrderBy(a => a.Order).ThenBy(a => a.Value);

            foreach (var value in familyLocations)
            {
                ddlLocationType.Items.Add(new ListItem(value.Value, value.Guid.ToString()));
            }

            ddlLocationType.Items.Insert(0, None.ListItem);

            parentControl.Controls.Add(ddlLocationType);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(Location)).Id;

            dvpDataView.EntityTypeId = entityTypeId;

            return(new Control[] { dvpDataView, ddlLocationType });
        }
Esempio n. 15
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="parentControl">The parent control.</param>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField parentControl)
        {
            var ddlDataView = new DataViewItemPicker();

            ddlDataView.ID       = parentControl.GetChildControlInstanceName(_CtlDataView);
            ddlDataView.CssClass = "js-data-view-picker";

            // Set placeholder values for Label and Help text.
            // These properties should be customised by overriding the OnConfigureDataViewItemPicker method in the derived class.
            ddlDataView.Label = "Is related to one of the items in this Data View";
            ddlDataView.Help  = "A Data View that provides the list of related items to which an item in the result set may be connected.";

            parentControl.Controls.Add(ddlDataView);

            // Populate the Data View Picker
            int entityTypeId = EntityTypeCache.Get(typeof(TRelatedEntity)).Id;

            ddlDataView.EntityTypeId = entityTypeId;

            this.OnConfigureDataViewItemPicker(ddlDataView);

            return(new Control[] { ddlDataView });
        }
Esempio n. 16
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
            });
        }
Esempio n. 17
0
 /// <summary>
 /// Override this method to customise the DataViewItemPicker displayed for this filter by setting the Label text, Help text and other properties as necessary.
 /// </summary>
 /// <param name="picker"></param>
 protected virtual void OnConfigureDataViewItemPicker(DataViewItemPicker picker)
 {
     picker.Label = string.Format("Is associated with any {0} in this Data View", GetRelatedEntityName());
     picker.Help  = string.Format("A Data View that provides the set of {0} with which the {1} may be connected.", GetRelatedEntityName().Pluralize(), GetTargetEntityName());
 }
Esempio n. 18
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());
        }
Esempio n. 19
0
 /// <summary>
 /// Override this method to customise the DataViewItemPicker displayed for this filter by setting the Label text, Help text and other properties as necessary.
 /// </summary>
 /// <param name="picker"></param>
 protected abstract void OnConfigureDataViewItemPicker(DataViewItemPicker picker);
Esempio n. 20
0
 /// <summary>
 /// Override this method to customise the DataViewItemPicker displayed for this filter by setting the Label text, Help text and other properties as necessary.
 /// </summary>
 /// <param name="picker"></param>
 protected override void OnConfigureDataViewItemPicker(DataViewItemPicker picker)
 {
     picker.Label = "Is Connected to a Location in this Data View";
     picker.Help  = "A Data View that provides the list of Locations to which the Group may be connected.";
 }