/// <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()); }
private void SaveSettings() { // 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.IsAttendanceInGroupTypeEnabled = cbAttendanceInGroupType.Checked; _reactivateSettings.AttendanceInGroupType = rlbAttendanceInGroupType.SelectedValues.AsIntegerList(); _reactivateSettings.AttendanceInGroupTypeDays = nbAttendanceInGroupType.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; if (isInterationTypeEnabled.Checked) { _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 = true, 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.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; foreach (RepeaterItem rItem in rNoInteractions.Items) { RockCheckBox isInterationTypeEnabled = rItem.FindControl("cbInterationType") as RockCheckBox; if (isInterationTypeEnabled.Checked) { _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 = true, 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.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; 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()); }