Example #1
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var controls = new List <Control>();

            ddlStringFilterComparison    = ComparisonHelper.ComparisonControl(ComparisonHelper.StringFilterComparisonTypes);
            ddlStringFilterComparison.ID = string.Format("{0}_{1}", filterControl.ID, controls.Count());
            ddlStringFilterComparison.AddCssClass("js-filter-compare");
            filterControl.Controls.Add(ddlStringFilterComparison);
            controls.Add(ddlStringFilterComparison);

            tbPostalCode    = new RockTextBox();
            tbPostalCode.ID = filterControl.ID + "_tbPostalCode";
            tbPostalCode.AddCssClass("js-filter-control");
            filterControl.Controls.Add(tbPostalCode);
            controls.Add(tbPostalCode);

            ddlLocationType                = new RockDropDownList();
            ddlLocationType.ID             = filterControl.ID + "_ddlLocationType";
            ddlLocationType.Label          = "Location Type";
            ddlLocationType.DataValueField = "Id";
            ddlLocationType.DataTextField  = "Value";
            DefinedTypeCache locationDefinedType = DefinedTypeCache.Get(SystemGuid.DefinedType.GROUP_LOCATION_TYPE.AsGuid());

            ddlLocationType.BindToDefinedType(locationDefinedType);
            ddlLocationType.Items.Insert(0, new ListItem("(All Location Types)", ""));
            filterControl.Controls.Add(ddlLocationType);
            controls.Add(ddlLocationType);

            return(controls.ToArray());
        }
Example #2
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var controls = new List <Control>();

            var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes | ComparisonType.Between);

            ddlIntegerCompare.ID = string.Format("{0}_{1}", filterControl.ID, "ddlIntegerCompare");
            ddlIntegerCompare.AddCssClass("js-filter-compare");
            filterControl.Controls.Add(ddlIntegerCompare);
            controls.Add(ddlIntegerCompare);

            var numberBox = new NumberBox();

            numberBox.ID = string.Format("{0}_{1}", filterControl.ID, "numberBox");
            numberBox.AddCssClass("js-filter-control");
            filterControl.Controls.Add(numberBox);
            controls.Add(numberBox);

            numberBox.FieldName = "Age";

            var numberRangeEditor = new Rock.Web.UI.Controls.NumberRangeEditor();

            numberRangeEditor.ID         = string.Format("{0}_{1}", filterControl.ID, "numberRangeEditor");
            numberRangeEditor.RangeLabel = "and";
            numberRangeEditor.AddCssClass("js-filter-control-between");
            filterControl.Controls.Add(numberRangeEditor);
            controls.Add(numberRangeEditor);

            return(controls.ToArray());
        }
Example #3
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: Group Member Data View Picker
            var ddlDataView = new DataViewPicker();

            ddlDataView.ID    = parentControl.GetChildControlInstanceName(_CtlDataView);
            ddlDataView.Label = "Has Group Memberships in this Data View";
            ddlDataView.Help  = "A Group Member Data View that provides the set of possible Group Members.";
            parentControl.Controls.Add(ddlDataView);

            var ddlCompare = ComparisonHelper.ComparisonControl(CountComparisonTypesSpecifier, false);

            ddlCompare.Label = "where the number of matching Group Memberships is";
            ddlCompare.ID    = parentControl.GetChildControlInstanceName(_CtlComparison);
            ddlCompare.AddCssClass("js-filter-compare");
            parentControl.Controls.Add(ddlCompare);

            var nbCount = new NumberBox();

            nbCount.Label = "&nbsp;";
            nbCount.ID    = parentControl.GetChildControlInstanceName(_CtlMemberCount);
            nbCount.AddCssClass("js-filter-control js-member-count");
            nbCount.FieldName = "Membership Count";
            parentControl.Controls.Add(nbCount);

            // Populate the Data View Picker
            ddlDataView.EntityTypeId = EntityTypeCache.Read(typeof(Rock.Model.GroupMember)).Id;

            return(new Control[] { ddlDataView, ddlCompare, nbCount });
        }
Example #4
0
        /// <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.CssClass = "js-data-view-picker";
            dvpDataView.Label    = "Contains People from this Data View";
            dvpDataView.Help     = "A Person Data View that provides the set of possible Group Members.";
            filterControl.Controls.Add(dvpDataView);

            var ddlCompare = ComparisonHelper.ComparisonControl(CountComparisonTypesSpecifier);

            ddlCompare.Label = "where the number of matching Group Members is";
            ddlCompare.ID    = filterControl.GetChildControlInstanceName(_CtlComparison);
            ddlCompare.AddCssClass("js-filter-compare");
            filterControl.Controls.Add(ddlCompare);

            var nbCount = new NumberBox();

            nbCount.Label = "&nbsp;";
            nbCount.ID    = filterControl.GetChildControlInstanceName(_CtlMemberCount);
            nbCount.AddCssClass("js-filter-control js-member-count");
            nbCount.FieldName = "Member Count";
            filterControl.Controls.Add(nbCount);

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

            return(new Control[] { dvpDataView, ddlCompare, nbCount });
        }
Example #5
0
        /// <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);
        }
Example #6
0
        /// <summary>
        /// Gets the filter compare 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>
        /// <returns></returns>
        public virtual Control FilterCompareControl(Dictionary <string, ConfigurationValue> configurationValues, string id, bool required)
        {
            RockDropDownList ddlCompare = ComparisonHelper.ComparisonControl(FilterComparisonType, required);

            ddlCompare.ID = string.Format("{0}_ddlCompare", id);
            ddlCompare.AddCssClass("js-filter-compare");
            return(ddlCompare);
        }
Example #7
0
        /// <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 = "&nbsp;"; // 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);
        }
Example #8
0
        /// <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 = "&nbsp;"; // 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);
        }
Example #9
0
        /// <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(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 = Rock.Web.Cache.GlobalAttributesCache.Read();

            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);

            DateRangePicker dateRangePicker = new DateRangePicker();

            dateRangePicker.ID       = parentControl.ID + "_2";
            dateRangePicker.Label    = "Date Range";
            dateRangePicker.Required = true;
            parentControl.Controls.Add(dateRangePicker);

            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);

            var controls = new Control[5] {
                comparisonControl, numberBoxAmount, accountPicker, dateRangePicker, cbCombineGiving
            };

            SetSelection(controls, string.Format("{0}|||||", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString()));

            return(controls);
        }
Example #11
0
        /// <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 = "&nbsp;"; // 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);
        }
Example #12
0
 /// <summary>
 /// Gets the filter compare 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 FilterCompareControl(Dictionary <string, ConfigurationValue> configurationValues, string id, bool required, FilterMode filterMode)
 {
     if (filterMode == FilterMode.SimpleFilter)
     {
         // hide the compare control for SimpleFilter mode
         RockDropDownList ddlCompare = ComparisonHelper.ComparisonControl(FilterComparisonType, required);
         ddlCompare.ID = string.Format("{0}_ddlCompare", id);
         ddlCompare.AddCssClass("js-filter-compare");
         ddlCompare.Visible = false;
         return(ddlCompare);
     }
     else
     {
         return(base.FilterCompareControl(configurationValues, id, required, filterMode));
     }
 }
Example #13
0
        /// <summary>
        /// Gets the filter compare control with the specified FilterMode
        /// </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 virtual Control FilterCompareControl(Dictionary <string, ConfigurationValue> configurationValues, string id, bool required, FilterMode filterMode)
        {
            RockDropDownList ddlCompare = ComparisonHelper.ComparisonControl(FilterComparisonType, required);

            if (filterMode == FilterMode.SimpleFilter && (
                    FilterComparisonType == ComparisonHelper.BinaryFilterComparisonTypes ||
                    FilterComparisonType == ComparisonHelper.StringFilterComparisonTypes ||
                    FilterComparisonType == ComparisonHelper.ContainsFilterComparisonTypes))
            {
                // hide the compare control for SimpleFilter mode if it is a string, list, or binary comparison type
                ddlCompare.Visible = false;
            }

            ddlCompare.ID = string.Format("{0}_ddlCompare", id);
            ddlCompare.AddCssClass("js-filter-compare");
            return(ddlCompare);
        }
Example #14
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes);

            ddlIntegerCompare.Label = "Count";
            ddlIntegerCompare.ID    = string.Format("{0}_ddlIntegerCompare", filterControl.ID);
            ddlIntegerCompare.AddCssClass("js-filter-compare");
            filterControl.Controls.Add(ddlIntegerCompare);

            var nbMemberCount = new NumberBox();

            nbMemberCount.Label = "&nbsp;";
            nbMemberCount.ID    = string.Format("{0}_nbMemberCount", filterControl.ID);
            nbMemberCount.AddCssClass("js-filter-control js-member-count");
            nbMemberCount.FieldName = "Member Count";
            filterControl.Controls.Add(nbMemberCount);

            RockDropDownList ddlLeader = new RockDropDownList();

            ddlLeader.ID = string.Format("{0}_ddlMemberType", filterControl.ID);
            ddlLeader.AddCssClass("js-filter-control js-member-is-leader");
            ddlLeader.Label = "Member Type";
            ddlLeader.Items.Add(new ListItem(string.Empty, string.Empty));
            ddlLeader.Items.Add(new ListItem("Leader", "true"));
            ddlLeader.Items.Add(new ListItem("Not Leader", "false"));
            filterControl.Controls.Add(ddlLeader);
            ddlLeader.Style[HtmlTextWriterStyle.Display] = this.SimpleMemberCountMode ? "none" : string.Empty;

            RockDropDownList ddlMemberStatus = new RockDropDownList();

            ddlMemberStatus.ID = string.Format("{0}_ddlMemberStatus", filterControl.ID);
            ddlMemberStatus.AddCssClass("js-filter-control js-member-status");
            ddlMemberStatus.Label = "Member Status";
            ddlMemberStatus.Items.Add(new ListItem(string.Empty, string.Empty));
            foreach (GroupMemberStatus memberStatus in Enum.GetValues(typeof(GroupMemberStatus)))
            {
                ddlMemberStatus.Items.Add(new ListItem(memberStatus.ConvertToString(), memberStatus.ConvertToInt().ToString()));
            }

            filterControl.Controls.Add(ddlMemberStatus);

            ddlLeader.Visible       = !this.SimpleMemberCountMode;
            ddlMemberStatus.Visible = !this.SimpleMemberCountMode;

            return(new Control[] { ddlIntegerCompare, nbMemberCount, ddlLeader, ddlMemberStatus });
        }
Example #15
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes);

            ddlIntegerCompare.Label = "Count";
            ddlIntegerCompare.ID    = string.Format("{0}_ddlIntegerCompare", filterControl.ID);
            ddlIntegerCompare.AddCssClass("js-filter-compare");
            filterControl.Controls.Add(ddlIntegerCompare);

            var nbCapacityCount = new NumberBox();

            nbCapacityCount.Label = "&nbsp;";
            nbCapacityCount.ID    = string.Format("{0}_nbCapacityCount", filterControl.ID);
            nbCapacityCount.AddCssClass("js-filter-control js-capacity-count");
            nbCapacityCount.FieldName = "Capacity Count";
            filterControl.Controls.Add(nbCapacityCount);

            return(new Control[] { ddlIntegerCompare, nbCapacityCount });
        }
Example #16
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var controls = new List <Control>();

            var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes);

            ddlIntegerCompare.ID = string.Format("{0}_{1}", filterControl.ID, controls.Count());
            ddlIntegerCompare.AddCssClass("js-filter-compare");
            filterControl.Controls.Add(ddlIntegerCompare);
            controls.Add(ddlIntegerCompare);

            var currencyBox = new CurrencyBox();

            currencyBox.ID = string.Format("{0}_{1}", filterControl.ID, controls.Count());
            currencyBox.AddCssClass("js-filter-control");
            filterControl.Controls.Add(currencyBox);
            controls.Add(currencyBox);

            return(controls.ToArray());
        }
Example #17
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls(Type entityType, FilterField filterControl)
        {
            var ddlGroupType = new RockDropDownList();

            ddlGroupType.ID = filterControl.ID + "_0";
            filterControl.Controls.Add(ddlGroupType);

            foreach (Rock.Model.GroupType groupType in new GroupTypeService(new RockContext()).Queryable())
            {
                ddlGroupType.Items.Add(new ListItem(groupType.Name, groupType.Guid.ToString()));
            }

            var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes);

            ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare";
            filterControl.Controls.Add(ddlIntegerCompare);

            var tbAttendedCount = new RockTextBox();

            tbAttendedCount.ID = filterControl.ID + "_2";
            filterControl.Controls.Add(tbAttendedCount);

            var tbInLastWeeksCount = new RockTextBox();

            tbInLastWeeksCount.ID = filterControl.ID + "_tbInLastWeeksCount";
            filterControl.Controls.Add(tbInLastWeeksCount);

            var controls = new Control[4] {
                ddlGroupType, ddlIntegerCompare, tbAttendedCount, tbInLastWeeksCount
            };

            // set the default values in case this is a newly added filter
            SetSelection(
                entityType,
                controls,
                string.Format("{0}|{1}|4|16", ddlGroupType.Items.Count > 0 ? ddlGroupType.Items[0].Value : "0", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString()));

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

            var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes);

            ddlIntegerCompare.ID = string.Format("{0}_{1}", filterControl.ID, controls.Count());
            ddlIntegerCompare.AddCssClass("js-filter-compare");
            filterControl.Controls.Add(ddlIntegerCompare);
            controls.Add(ddlIntegerCompare);

            var ddlGradeDefinedValue = new RockDropDownList();

            ddlGradeDefinedValue.ID = string.Format("{0}_{1}", filterControl.ID, controls.Count());
            ddlGradeDefinedValue.AddCssClass("js-filter-control");

            ddlGradeDefinedValue.Items.Clear();

            // add blank item as first item
            ddlGradeDefinedValue.Items.Add(new ListItem());

            var schoolGrades = DefinedTypeCache.Read(Rock.SystemGuid.DefinedType.SCHOOL_GRADES.AsGuid());

            if (schoolGrades != null)
            {
                foreach (var schoolGrade in schoolGrades.DefinedValues.OrderByDescending(a => a.Value.AsInteger()))
                {
                    ddlGradeDefinedValue.Items.Add(new ListItem(schoolGrade.Description, schoolGrade.Guid.ToString()));
                }
            }

            filterControl.Controls.Add(ddlGradeDefinedValue);
            controls.Add(ddlGradeDefinedValue);

            return(controls.ToArray());
        }
Example #19
0
        /// <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 = "&nbsp;"; // 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);
        }
Example #20
0
        /// <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);
        }
Example #21
0
        /// <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 = "&nbsp;"; // 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);
        }