/// <summary> /// Gets the filter value control. /// </summary> /// <param name="configurationValues">The configuration values.</param> /// <param name="id">The identifier.</param> /// <param name="required">if set to <c>true</c> [required].</param> /// <param name="filterMode">The filter mode.</param> /// <returns></returns> public override Control FilterValueControl(Dictionary <string, ConfigurationValue> configurationValues, string id, bool required, FilterMode filterMode) { var dateFiltersPanel = new Panel(); dateFiltersPanel.ID = string.Format("{0}_dtFilterControls", id); var datePickerPanel = new Panel(); dateFiltersPanel.Controls.Add(datePickerPanel); var datePicker = new DateTimePicker(); datePicker.ID = string.Format("{0}_dtPicker", id); datePicker.DisplayCurrentOption = true; datePickerPanel.AddCssClass("js-filter-control"); datePickerPanel.Controls.Add(datePicker); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = string.Format("{0}_dtSlidingDateRange", id); slidingDateRangePicker.AddCssClass("js-filter-control-between"); slidingDateRangePicker.Label = string.Empty; slidingDateRangePicker.PreviewLocation = SlidingDateRangePicker.DateRangePreviewLocation.Right; dateFiltersPanel.Controls.Add(slidingDateRangePicker); return(dateFiltersPanel); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { AccountPicker accountPicker = new AccountPicker(); accountPicker.AllowMultiSelect = true; accountPicker.ID = filterControl.ID + "_accountPicker"; accountPicker.AddCssClass("js-account-picker"); accountPicker.Label = "Accounts"; filterControl.Controls.Add(accountPicker); SlidingDateRangePicker slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.Help = "The date range of the transactions using the 'Sunday Date' of each transaction"; slidingDateRangePicker.Required = true; filterControl.Controls.Add(slidingDateRangePicker); RockCheckBox cbCombineGiving = new RockCheckBox(); cbCombineGiving.ID = filterControl.ID + "_cbCombineGiving"; cbCombineGiving.Label = "Combine Giving"; cbCombineGiving.CssClass = "js-combine-giving"; cbCombineGiving.Help = "Combine individuals in the same giving group when calculating first contribution date and reporting the list of individuals."; filterControl.Controls.Add(cbCombineGiving); var controls = new Control[3] { accountPicker, slidingDateRangePicker, cbCombineGiving }; return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { AccountPicker accountPicker = new AccountPicker(); accountPicker.AllowMultiSelect = true; accountPicker.ID = filterControl.ID + "_accountPicker"; accountPicker.Label = "Accounts"; filterControl.Controls.Add(accountPicker); SlidingDateRangePicker slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.Help = "The date range of the transactions using the 'Sunday Date' of each transaction"; slidingDateRangePicker.Required = true; filterControl.Controls.Add(slidingDateRangePicker); RockCheckBox cbUseSundayDate = new RockCheckBox(); cbUseSundayDate.ID = filterControl.ID + "_cbUseSundayDate"; cbUseSundayDate.Label = "Use Sunday Date"; cbUseSundayDate.Help = "Use the Sunday Date instead of the actual transaction date."; cbUseSundayDate.AddCssClass("js-use-sunday-date"); filterControl.Controls.Add(cbUseSundayDate); var controls = new Control[3] { accountPicker, slidingDateRangePicker, cbUseSundayDate }; return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { AccountPicker accountPicker = new AccountPicker(); accountPicker.AllowMultiSelect = true; accountPicker.ID = filterControl.ID + "_accountPicker"; accountPicker.AddCssClass("js-account-picker"); accountPicker.Label = "Accounts"; filterControl.Controls.Add(accountPicker); SlidingDateRangePicker slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.Help = "The date range of the transactions using the 'Sunday Date' of each transaction"; slidingDateRangePicker.Required = true; filterControl.Controls.Add(slidingDateRangePicker); var controls = new Control[2] { accountPicker, slidingDateRangePicker }; return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(System.Web.UI.Control parentControl) { var comparisonControl = ComparisonHelper.ComparisonControl(ComparisonType.LessThan | ComparisonType.GreaterThanOrEqualTo | ComparisonType.EqualTo); comparisonControl.ID = parentControl.ID + "_0"; parentControl.Controls.Add(comparisonControl); var globalAttributes = GlobalAttributesCache.Get(); NumberBox numberBoxAmount = new NumberBox(); numberBoxAmount.PrependText = globalAttributes.GetValue("CurrencySymbol") ?? "$"; numberBoxAmount.NumberType = ValidationDataType.Currency; numberBoxAmount.ID = parentControl.ID + "_1"; numberBoxAmount.Label = "Amount"; parentControl.Controls.Add(numberBoxAmount); AccountPicker accountPicker = new AccountPicker(); accountPicker.AllowMultiSelect = true; accountPicker.ID = parentControl.ID + "_accountPicker"; accountPicker.AddCssClass("js-account-picker"); accountPicker.Label = "Accounts"; parentControl.Controls.Add(accountPicker); SlidingDateRangePicker slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = parentControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.Help = "The date range of the transactions using the transaction date of each transaction"; slidingDateRangePicker.Required = true; parentControl.Controls.Add(slidingDateRangePicker); RockCheckBox cbCombineGiving = new RockCheckBox(); cbCombineGiving.ID = parentControl.ID + "_cbCombineGiving"; cbCombineGiving.Label = "Combine Giving"; cbCombineGiving.CssClass = "js-combine-giving"; cbCombineGiving.Help = "Combine individuals in the same giving group when calculating totals and reporting the list of individuals."; parentControl.Controls.Add(cbCombineGiving); RockCheckBox cbUseAnalytics = new RockCheckBox(); cbUseAnalytics.ID = parentControl.ID + "_cbUseAnalytics"; cbUseAnalytics.Label = "Use Analytics Models"; cbUseAnalytics.CssClass = "js-use-analytics"; cbUseAnalytics.Help = "Using Analytics Data is MUCH faster than querying real-time data, but it may not include data that has been added or updated in the last 24 hours."; parentControl.Controls.Add(cbUseAnalytics); var controls = new Control[6] { comparisonControl, numberBoxAmount, accountPicker, slidingDateRangePicker, cbCombineGiving, cbUseAnalytics }; SetSelection(controls, $"{ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString()}|||||||"); return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var ddlInteractionChannel = new RockDropDownList(); ddlInteractionChannel.ID = filterControl.ID + "_ddlInteractionChannel"; ddlInteractionChannel.Label = "Interaction Channel"; ddlInteractionChannel.CssClass = "js-interaction-channel"; ddlInteractionChannel.Required = true; ddlInteractionChannel.AutoPostBack = true; ddlInteractionChannel.EnhanceForLongLists = true; ddlInteractionChannel.SelectedIndexChanged += ddlInteractionChannel_SelectedIndexChanged; filterControl.Controls.Add(ddlInteractionChannel); var interactionChannelService = new InteractionChannelService(new RockContext()); var interactionChannels = interactionChannelService.Queryable().OrderBy(a => a.Name).Select(a => new { a.Id, a.Name }).ToList(); ddlInteractionChannel.Items.Clear(); ddlInteractionChannel.Items.Add(new ListItem()); ddlInteractionChannel.Items.AddRange(interactionChannels.Select(a => new ListItem(a.Name, a.Id.ToString())).ToArray()); int?selectedInteractionChannelId = filterControl.Page.Request.Params[ddlInteractionChannel.UniqueID].AsIntegerOrNull(); ddlInteractionChannel.SetValue(selectedInteractionChannelId); var ddlInteractionComponent = new RockDropDownList(); ddlInteractionComponent.ID = filterControl.ID + "_ddlInteractionComponent"; ddlInteractionComponent.Label = "Interaction Component"; ddlInteractionComponent.CssClass = "js-interaction-component"; ddlInteractionComponent.EnhanceForLongLists = true; filterControl.Controls.Add(ddlInteractionComponent); PopulateInteractionComponent(selectedInteractionChannelId, ddlInteractionComponent); RockTextBox tbOperation = new RockTextBox(); tbOperation.Label = "Operation"; tbOperation.ID = filterControl.ID + "_tbOperation"; tbOperation.CssClass = "js-tbOperation"; filterControl.Controls.Add(tbOperation); SlidingDateRangePicker slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.Help = "The date range of the interactions"; filterControl.Controls.Add(slidingDateRangePicker); return(new Control[4] { ddlInteractionChannel, ddlInteractionComponent, tbOperation, slidingDateRangePicker }); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var gtpGroupType = new GroupTypePicker(); gtpGroupType.ID = filterControl.ID + "_0"; gtpGroupType.AddCssClass("js-group-type"); filterControl.Controls.Add(gtpGroupType); gtpGroupType.UseGuidAsValue = true; gtpGroupType.IsSortedByName = true; gtpGroupType.GroupTypes = new GroupTypeService(new RockContext()).Queryable().ToList(); var cbChildGroupTypes = new RockCheckBox(); cbChildGroupTypes.ID = filterControl.ID + "_cbChildGroupTypes"; cbChildGroupTypes.AddCssClass("js-child-group-types"); cbChildGroupTypes.Text = "Include Child Group Types(s)"; filterControl.Controls.Add(cbChildGroupTypes); var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes); ddlIntegerCompare.Label = "Attendance Count"; ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare"; ddlIntegerCompare.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlIntegerCompare); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = filterControl.ID + "_2"; tbAttendedCount.Label = " "; // give it whitespace label so it lines up nicely tbAttendedCount.AddCssClass("js-attended-count"); filterControl.Controls.Add(tbAttendedCount); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); filterControl.Controls.Add(slidingDateRangePicker); var controls = new Control[5] { gtpGroupType, cbChildGroupTypes, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker }; // convert pipe to comma delimited var defaultDelimitedValues = slidingDateRangePicker.DelimitedValues.Replace("|", ","); var defaultCount = 4; // set the default values in case this is a newly added filter SetSelection( entityType, controls, string.Format("{0}|{1}|{2}|{3}|false", gtpGroupType.Items.Count > 0 ? gtpGroupType.Items[0].Value : "0", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), defaultCount, defaultDelimitedValues)); return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var pGroupPicker = new GroupPicker(); pGroupPicker.AllowMultiSelect = true; pGroupPicker.ID = filterControl.ID + "_pGroupPicker"; pGroupPicker.AddCssClass("js-group-picker"); filterControl.Controls.Add(pGroupPicker); var cbChildGroups = new RockCheckBox(); cbChildGroups.ID = filterControl.ID + "_cbChildGroups"; cbChildGroups.AddCssClass("js-child-groups"); cbChildGroups.Text = "Include Child Groups"; filterControl.Controls.Add(cbChildGroups); var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes); ddlIntegerCompare.Label = "Attendance Count"; ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare"; ddlIntegerCompare.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlIntegerCompare); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = filterControl.ID + "_2"; tbAttendedCount.Label = " "; // give it whitespace label so it lines up nicely tbAttendedCount.AddCssClass("js-attended-count"); filterControl.Controls.Add(tbAttendedCount); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); filterControl.Controls.Add(slidingDateRangePicker); var controls = new Control[5] { pGroupPicker, cbChildGroups, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker }; // convert pipe to comma delimited var defaultDelimitedValues = slidingDateRangePicker.DelimitedValues.Replace("|", ","); var defaultCount = 4; // set the default values in case this is a newly added filter SetSelection( entityType, controls, string.Format("{0}|{1}|{2}|{3}|false", string.Empty, ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), defaultCount, defaultDelimitedValues)); return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var comparisonControl = ComparisonHelper.ComparisonControl(ComparisonType.LessThan | ComparisonType.GreaterThanOrEqualTo | ComparisonType.EqualTo); comparisonControl.ID = filterControl.ID + "_comparisonControl"; filterControl.Controls.Add(comparisonControl); var globalAttributes = GlobalAttributesCache.Get(); NumberBox numberBoxAmount = new NumberBox(); numberBoxAmount.PrependText = globalAttributes.GetValue("CurrencySymbol") ?? "$"; numberBoxAmount.NumberType = ValidationDataType.Currency; numberBoxAmount.ID = filterControl.ID + "_numberBoxAmount"; numberBoxAmount.Label = "Amount"; filterControl.Controls.Add(numberBoxAmount); AccountPicker accountPicker = new AccountPicker(); accountPicker.AllowMultiSelect = true; accountPicker.ID = filterControl.ID + "_accountPicker"; accountPicker.AddCssClass("js-account-picker"); accountPicker.Label = "Accounts"; filterControl.Controls.Add(accountPicker); SlidingDateRangePicker slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.Help = "The date range of the transactions using the transaction date of each transaction"; slidingDateRangePicker.Required = true; filterControl.Controls.Add(slidingDateRangePicker); RockCheckBox cbCombineGiving = new RockCheckBox(); cbCombineGiving.ID = filterControl.ID + "_cbCombineGiving"; cbCombineGiving.Label = "Combine Giving"; cbCombineGiving.CssClass = "js-combine-giving"; cbCombineGiving.Help = "Combine individuals in the same giving group when calculating totals and reporting the list of individuals."; filterControl.Controls.Add(cbCombineGiving); var controls = new Control[5] { comparisonControl, numberBoxAmount, accountPicker, slidingDateRangePicker, cbCombineGiving }; SetSelection(entityType, controls, string.Format("{0}||||||", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString())); return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var cblNoteTypes = new RockListBox(); cblNoteTypes.ID = filterControl.GetChildControlInstanceName(_CtlNoteTypes); cblNoteTypes.CssClass = "js-notetypes"; cblNoteTypes.Label = "Note Types"; cblNoteTypes.Help = "The type of note to filter by. Leave blank to include all note types."; filterControl.Controls.Add(cblNoteTypes); var noteTypeService = new NoteTypeService(new RockContext()); var entityTypeIdPerson = EntityTypeCache.GetId <Rock.Model.Person>(); var noteTypes = noteTypeService.Queryable().Where(a => a.EntityTypeId == entityTypeIdPerson) .OrderBy(a => a.Order) .ThenBy(a => a.Name) .Select(a => new { a.Id, a.Name }).ToList(); cblNoteTypes.Items.Clear(); cblNoteTypes.Items.AddRange(noteTypes.Select(a => new ListItem(a.Name, a.Id.ToString())).ToArray()); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = filterControl.GetChildControlInstanceName(_CtlSlidingDateRangePicker); slidingDateRangePicker.AddCssClass("js-sliding-date-range"); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.Help = "The date range that the note was created during."; slidingDateRangePicker.Required = false; filterControl.Controls.Add(slidingDateRangePicker); var nbMinimumCount = new NumberBox(); nbMinimumCount.ID = filterControl.GetChildControlInstanceName(_CtlMinimumCount); nbMinimumCount.NumberType = ValidationDataType.Integer; nbMinimumCount.MinimumValue = "1"; nbMinimumCount.Label = "Minimum Count"; nbMinimumCount.Help = "The minimum number of notes created during the date range to be considered a match."; nbMinimumCount.Required = true; nbMinimumCount.AddCssClass("js-minimum-count"); filterControl.Controls.Add(nbMinimumCount); return(new System.Web.UI.Control[3] { cblNoteTypes, slidingDateRangePicker, nbMinimumCount }); }
/// <summary> /// Creates the child controls. /// </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) { var campusesPicker = new CampusesPicker(); campusesPicker.Label = "Campuses"; campusesPicker.ID = filterControl.ID + "_0"; campusesPicker.Label = string.Empty; campusesPicker.CssClass = "js-campuses-picker campuses-picker"; campusesPicker.Campuses = CampusCache.All(); filterControl.Controls.Add(campusesPicker); var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes); ddlIntegerCompare.Label = "Attendance Count"; ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare"; ddlIntegerCompare.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlIntegerCompare); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = filterControl.ID + "_2"; tbAttendedCount.Label = " "; // give it whitespace label so it lines up nicely tbAttendedCount.AddCssClass("js-attended-count"); filterControl.Controls.Add(tbAttendedCount); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); filterControl.Controls.Add(slidingDateRangePicker); var controls = new Control[4] { campusesPicker, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker }; // convert pipe to comma delimited var defaultDelimitedValues = slidingDateRangePicker.DelimitedValues.Replace("|", ","); var defaultCount = 4; // set the default values in case this is a newly added filter SetSelection( entityType, controls, string.Format("{0}|{1}|{2}|{3}|false", campusesPicker.Items.Count > 0 ? campusesPicker.Items[0].Value : "0", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), defaultCount, defaultDelimitedValues)); return(controls); }
/// <summary> /// Gets the filter value control. /// </summary> /// <param name="configurationValues">The configuration values.</param> /// <param name="id">The identifier.</param> /// <param name="required">if set to <c>true</c> [required].</param> /// <param name="filterMode">The filter mode.</param> /// <returns></returns> public override Control FilterValueControl(Dictionary <string, ConfigurationValue> configurationValues, string id, bool required, FilterMode filterMode) { var dateFiltersPanel = new Panel(); dateFiltersPanel.ID = string.Format("{0}_dtFilterControls", id); var datePickerPanel = new Panel(); dateFiltersPanel.Controls.Add(datePickerPanel); var datePickerControlType = configurationValues?.GetValueOrNull("datePickerControlType").ConvertToEnumOrNull <DatePickerControlType>() ?? DatePickerControlType.DatePicker; switch (datePickerControlType) { case DatePickerControlType.DatePartsPicker: var datePartsPicker = new DatePartsPicker { ID = id }; datePartsPicker.ID = string.Format("{0}_dtPicker", id); datePartsPicker.FutureYearCount = configurationValues?.GetValueOrNull("futureYearCount").AsIntegerOrNull(); datePickerPanel.AddCssClass("js-filter-control"); datePickerPanel.Controls.Add(datePartsPicker); break; case DatePickerControlType.DatePicker: default: var datePicker = new DatePicker(); datePicker.ID = string.Format("{0}_dtPicker", id); datePicker.DisplayCurrentOption = true; datePickerPanel.AddCssClass("js-filter-control"); datePickerPanel.Controls.Add(datePicker); break; } var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = string.Format("{0}_dtSlidingDateRange", id); slidingDateRangePicker.AddCssClass("js-filter-control-between"); slidingDateRangePicker.Label = string.Empty; slidingDateRangePicker.PreviewLocation = SlidingDateRangePicker.DateRangePreviewLocation.Right; dateFiltersPanel.Controls.Add(slidingDateRangePicker); return(dateFiltersPanel); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { RockDropDownList ddlNoteType = new RockDropDownList(); ddlNoteType.ID = filterControl.ID + "_ddlNoteType"; ddlNoteType.CssClass = "js-notetype"; ddlNoteType.Label = "Note Type"; filterControl.Controls.Add(ddlNoteType); var noteTypeService = new NoteTypeService(new RockContext()); var entityTypeIdPerson = EntityTypeCache.GetId <Rock.Model.Person>(); var noteTypes = noteTypeService.Queryable().Where(a => a.EntityTypeId == entityTypeIdPerson) .OrderBy(a => a.Order) .ThenBy(a => a.Name) .Select(a => new { a.Id, a.Name }).ToList(); ddlNoteType.Items.Clear(); ddlNoteType.Items.Add(new ListItem()); ddlNoteType.Items.AddRange(noteTypes.Select(a => new ListItem(a.Name, a.Id.ToString())).ToArray()); var tbContains = new RockTextBox(); tbContains.Label = "Contains"; tbContains.ID = filterControl.ID + "_tbContains"; tbContains.CssClass = "js-notecontains"; filterControl.Controls.Add(tbContains); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.Help = "The date range of the note's creation date"; slidingDateRangePicker.Required = false; filterControl.Controls.Add(slidingDateRangePicker); return(new System.Web.UI.Control[3] { ddlNoteType, tbContains, slidingDateRangePicker }); }
/// <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> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var ddlActivityType = new RockDropDownList(); ddlActivityType.ID = filterControl.ID + "_ddlActivityType"; ddlActivityType.AddCssClass("js-activity-type"); ddlActivityType.Label = "Activity Type"; filterControl.Controls.Add(ddlActivityType); var activityTypes = new ConnectionActivityTypeService(new RockContext()).Queryable("ConnectionType").AsNoTracking().Where(a => a.IsActive) .OrderBy(a => a.ConnectionTypeId.HasValue) .ThenBy(a => a.Name) .ToList(); ddlActivityType.Items.Clear(); ddlActivityType.Items.Insert(0, new ListItem()); foreach (var activityType in activityTypes) { var activityName = GetActivityName(activityType); ddlActivityType.Items.Add(new ListItem(activityName, activityType.Guid.ToString())); } var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes); ddlIntegerCompare.Label = "Count"; ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare"; ddlIntegerCompare.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlIntegerCompare); var nbCount = new NumberBox(); nbCount.ID = filterControl.ID + "_nbCount"; nbCount.Label = " "; // give it whitespace label so it lines up nicely nbCount.AddCssClass("js-count"); filterControl.Controls.Add(nbCount); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); filterControl.Controls.Add(slidingDateRangePicker); var controls = new Control[4] { ddlActivityType, ddlIntegerCompare, nbCount, slidingDateRangePicker }; // convert pipe to comma delimited var defaultDelimitedValues = slidingDateRangePicker.DelimitedValues.Replace("|", ","); var defaultCount = 1; // set the default values in case this is a newly added filter var selectionConfig = new SelectionConfig() { IntegerCompare = ComparisonType.GreaterThanOrEqualTo, MinimumCount = defaultCount, SlidingDateRangeDelimitedValues = defaultDelimitedValues }; SetSelection( entityType, controls, selectionConfig.ToJson()); return(controls); }
/// <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 }); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var dataContext = new RockContext(); // Step Program selection var stepProgramSingleEntityPicker = new SingleEntityPicker <StepProgram>(); stepProgramSingleEntityPicker.ID = filterControl.ID + "_StepProgramPicker"; stepProgramSingleEntityPicker.AddCssClass("js-step-program-picker"); stepProgramSingleEntityPicker.Label = "Step Program"; stepProgramSingleEntityPicker.Help = "The Program in which the Step was undertaken."; stepProgramSingleEntityPicker.Required = true; stepProgramSingleEntityPicker.SelectedIndexChanged += StepProgramSingleEntityPicker_SelectedIndexChanged; stepProgramSingleEntityPicker.AutoPostBack = true; var programService = new StepProgramService(dataContext); var availablePrograms = programService.Queryable() .Where(x => x.IsActive) .OrderBy(a => a.Order) .ThenBy(a => a.Name) .ToList(); stepProgramSingleEntityPicker.InitializeListItems(availablePrograms, x => x.Name, allowEmptySelection: true); filterControl.Controls.Add(stepProgramSingleEntityPicker); // Step Type selection var cblStepType = new RockCheckBoxList(); cblStepType.ID = filterControl.ID + "_cblStepType"; cblStepType.AddCssClass("js-step-type"); cblStepType.Label = "Steps"; cblStepType.Help = "If selected, specifies the required Steps that have been undertaken."; filterControl.Controls.Add(cblStepType); // Step Status selection var cblStepStatus = new RockCheckBoxList(); cblStepStatus.ID = filterControl.ID + "_cblStepStatus"; cblStepStatus.AddCssClass("js-step-status"); cblStepStatus.Label = "Statuses"; cblStepStatus.Help = "If selected, specifies the required Statuses of the Steps."; filterControl.Controls.Add(cblStepStatus); // Date Started var drpStarted = new SlidingDateRangePicker(); drpStarted.ID = filterControl.ID + "_drpDateStarted"; drpStarted.AddCssClass("js-date-started"); drpStarted.Label = "Date Started"; drpStarted.Help = "The date range within which the Step was started"; filterControl.Controls.Add(drpStarted); // Date Completed var drpCompleted = new SlidingDateRangePicker(); drpCompleted.ID = filterControl.ID + "_drpDateCompleted"; drpCompleted.AddCssClass("js-date-completed"); drpCompleted.Label = "Date Completed"; drpCompleted.Help = "The date range within which the Step was completed"; filterControl.Controls.Add(drpCompleted); // Step Campus selection var cblStepCampus = new RockCheckBoxList(); cblStepCampus.ID = filterControl.ID + "_cblStepCampus"; cblStepCampus.AddCssClass("js-step-campus"); cblStepCampus.Label = "Campuses"; cblStepCampus.Help = "Select the campuses that the steps were completed at. Not selecting a value will select all campuses."; filterControl.Controls.Add(cblStepCampus); // Populate lists PopulateStepProgramRelatedSelectionLists(filterControl); PopulateStepCampuses(cblStepCampus); return(new Control[] { stepProgramSingleEntityPicker, cblStepType, cblStepStatus, drpStarted, drpCompleted, cblStepCampus }); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var comparisonControl = ComparisonHelper.ComparisonControl(ComparisonType.LessThan | ComparisonType.GreaterThanOrEqualTo | ComparisonType.EqualTo); comparisonControl.ID = filterControl.ID + "_comparisonControl"; filterControl.Controls.Add(comparisonControl); var globalAttributes = GlobalAttributesCache.Get(); CurrencyBox numberBoxAmount = new CurrencyBox(); numberBoxAmount.ID = filterControl.ID + "_numberBoxAmount"; numberBoxAmount.Label = "Amount"; filterControl.Controls.Add(numberBoxAmount); AccountPicker accountPicker = new AccountPicker(); accountPicker.AllowMultiSelect = true; accountPicker.ID = filterControl.ID + "_accountPicker"; accountPicker.AddCssClass("js-account-picker"); accountPicker.Label = "Accounts"; filterControl.Controls.Add(accountPicker); RockCheckBox cbIncludeChildAccounts = new RockCheckBox(); cbIncludeChildAccounts.ID = filterControl.ID + "_cbIncludeChildAccounts"; cbIncludeChildAccounts.Text = "Include Child Accounts"; cbIncludeChildAccounts.CssClass = "js-include-child-accounts"; filterControl.Controls.Add(cbIncludeChildAccounts); RockCheckBox cbIgnoreInactiveAccounts = new RockCheckBox(); cbIgnoreInactiveAccounts.ID = filterControl.ID + "_cbIgnoreInactiveAccounts"; cbIgnoreInactiveAccounts.Text = "Ignore Inactive Accounts"; cbIgnoreInactiveAccounts.CssClass = "js-ignore-inactive-accounts"; filterControl.Controls.Add(cbIgnoreInactiveAccounts); SlidingDateRangePicker slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.Help = "The date range of the transactions using the transaction date of each transaction"; slidingDateRangePicker.Required = true; filterControl.Controls.Add(slidingDateRangePicker); RockCheckBox cbCombineGiving = new RockCheckBox(); cbCombineGiving.ID = filterControl.ID + "_cbCombineGiving"; cbCombineGiving.Label = "Combine Giving"; cbCombineGiving.CssClass = "js-combine-giving"; cbCombineGiving.Help = "Combine individuals in the same giving group when calculating totals and reporting the list of individuals."; filterControl.Controls.Add(cbCombineGiving); RockCheckBox cbUseAnalytics = new RockCheckBox(); cbUseAnalytics.ID = filterControl.ID + "_cbUseAnalytics"; cbUseAnalytics.Label = "Use Analytics Models"; cbUseAnalytics.CssClass = "js-use-analytics"; cbUseAnalytics.Help = "Using Analytics Data might be faster than querying real-time data, but it may not include data that has been added or updated in the last 24 hours."; filterControl.Controls.Add(cbUseAnalytics); var controls = new Control[8] { comparisonControl, numberBoxAmount, accountPicker, cbIncludeChildAccounts, cbIgnoreInactiveAccounts, slidingDateRangePicker, cbCombineGiving, cbUseAnalytics }; // set an initial config for the selection var selectionConfig = new SelectionConfig { ComparisonType = ComparisonType.GreaterThanOrEqualTo }; SetSelection(entityType, controls, selectionConfig.ToJson()); return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var pGroupPicker = new GroupPicker(); pGroupPicker.AllowMultiSelect = true; pGroupPicker.ID = $"{filterControl.ID}_{nameof( pGroupPicker )}"; pGroupPicker.AddCssClass("js-group-picker"); filterControl.Controls.Add(pGroupPicker); var cbChildGroups = new RockCheckBox(); cbChildGroups.ID = $"{filterControl.ID}_{nameof( cbChildGroups )}"; cbChildGroups.AddCssClass("js-child-groups"); cbChildGroups.Text = "Include Child Groups"; filterControl.Controls.Add(cbChildGroups); var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes); ddlIntegerCompare.Label = "Attendance Count"; ddlIntegerCompare.ID = $"{filterControl.ID}_{nameof( ddlIntegerCompare )}"; ddlIntegerCompare.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlIntegerCompare); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = $"{filterControl.ID}_{nameof( tbAttendedCount )}"; tbAttendedCount.Label = " "; // give it whitespace label so it lines up nicely tbAttendedCount.AddCssClass("js-attended-count"); filterControl.Controls.Add(tbAttendedCount); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = $"{filterControl.ID}_{nameof( slidingDateRangePicker )}"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); filterControl.Controls.Add(slidingDateRangePicker); var schedulePicker = new SchedulePicker(); schedulePicker.Label = "Schedules"; schedulePicker.ID = $"{filterControl.ID}_{nameof( schedulePicker )}"; schedulePicker.AddCssClass("js-schedule-picker"); schedulePicker.AllowMultiSelect = true; filterControl.Controls.Add(schedulePicker); var controls = new Control[6] { pGroupPicker, cbChildGroups, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker, schedulePicker }; var defaultGroupAttendanceFilterSelection = new GroupAttendanceFilterSelection { IntegerCompare = ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), AttendedCount = 4, SlidingDateRange = slidingDateRangePicker.DelimitedValues, IncludeChildGroups = false, }; // set the default values in case this is a newly added filter SetSelection( entityType, controls, defaultGroupAttendanceFilterSelection.ToJson()); return(controls); }