示例#1
0
        /// <summary>
        /// Gets the selection.
        /// Implement this version of GetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            // Get selection control instances.
            var pnlGroupAttributeFilterControls = controls.GetByName <Panel>(_CtlGroup);
            var ddlProperty = controls.GetByName <DropDownList>(_CtlProperty);

            if (pnlGroupAttributeFilterControls == null)
            {
                return(null);
            }

            var settings = new FilterSettings();

            settings.AttributeKey = ddlProperty.SelectedValue;

            var entityFields = GetGroupMemberAttributes();
            var entityField  = entityFields.FirstOrDefault(f => f.Name == ddlProperty.SelectedValue);

            if (entityField != null)
            {
                var panelControls = new List <Control>();
                panelControls.AddRange(pnlGroupAttributeFilterControls.Controls.OfType <Control>());

                var control = panelControls.FirstOrDefault(c => c.ID.EndsWith("_" + entityField.Name));

                if (control != null)
                {
                    entityField.FieldType.Field.GetFilterValues(control, entityField.FieldConfig).ForEach(v => settings.AttributeFilterSettings.Add(v));
                }
            }

            return(settings.ToSelectionString());
        }
示例#2
0
        /// <summary>
        /// Gets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <returns></returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            var stepProgramSingleEntityPicker = (controls[0] as SingleEntityPicker <StepProgram>);
            var cblStepTypes     = (controls[1] as RockCheckBoxList);
            var cblStepStatuses  = (controls[2] as RockCheckBoxList);
            var sdpDateStarted   = (controls[3] as SlidingDateRangePicker);
            var sdpDateCompleted = (controls[4] as SlidingDateRangePicker);
            var cblStepCampuses  = (controls[5] as RockCheckBoxList);

            var settings = new FilterSettings();

            int stepProgramId = stepProgramSingleEntityPicker.SelectedValueAsId() ?? 0;

            var dataContext = new RockContext();

            var stepProgram = GetStepProgram(dataContext, stepProgramId);

            if (stepProgram != null)
            {
                settings.StepProgramGuid = stepProgram.Guid;
            }

            settings.StepTypeGuids = cblStepTypes.SelectedValues.AsGuidList();

            settings.StepStatusGuids = cblStepStatuses.SelectedValues.AsGuidList();

            settings.StartedInPeriod.FromDelimitedString(sdpDateStarted.DelimitedValues);

            settings.CompletedInPeriod.FromDelimitedString(sdpDateCompleted.DelimitedValues);

            settings.StepCampusGuids = cblStepCampuses.SelectedValues.AsGuidList();

            return(settings.ToSelectionString());
        }
        /// <summary>
        /// Gets the selection.
        /// Implement this version of GetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            var ddlDataView = controls.GetByName <DataViewPicker>(_CtlDataView);

            var settings = new FilterSettings();

            settings.DataViewGuid = DataComponentSettingsHelper.GetDataViewGuid(ddlDataView.SelectedValue);

            return(settings.ToSelectionString());
        }
示例#4
0
        /// <summary>
        /// Gets the selection.
        /// Implement this version of GetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            var dvpDataView     = controls.GetByName <DataViewItemPicker>(_CtlDataView);
            var ddlLocationType = controls.GetByName <RockDropDownList>(_CtlLocationType);

            var settings = new FilterSettings();

            settings.LocationTypeGuid = ddlLocationType.SelectedValue.AsGuidOrNull();
            settings.DataViewGuid     = DataComponentSettingsHelper.GetDataViewGuid(dvpDataView.SelectedValue);

            return(settings.ToSelectionString());
        }
示例#5
0
        /// <summary>
        /// Gets the selection.
        /// Implement this version of GetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            var ddlDataView = controls.GetByName <DataViewPicker>(_CtlDataView);
            var ddlCompare  = controls.GetByName <RockDropDownList>(_CtlComparison);
            var nbValue     = controls.GetByName <NumberBox>(_CtlMemberCount);

            var settings = new FilterSettings();

            settings.GroupMemberDataViewGuid = DataComponentSettingsHelper.GetDataViewGuid(ddlDataView.SelectedValue);
            settings.MemberCountComparison   = ddlCompare.SelectedValueAsEnum <ComparisonType>(ComparisonType.GreaterThan);
            settings.MemberCount             = nbValue.Text.AsInteger();

            return(settings.ToSelectionString());
        }
示例#6
0
        /// <summary>
        /// Gets the selection.
        /// Implement this version of GetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection(Type entityType, Control[] controls)
        {
            var ddlLocationType = controls.GetByName <RockDropDownList>(_CtlLocationType);
            var acAddress       = controls.GetByName <AddressControl>(_CtlLocationAddress);

            var settings = new FilterSettings();

            settings.LocationTypeGuid = ddlLocationType.SelectedValue.AsGuidOrNull();
            if (acAddress != null)
            {
                settings.Street1    = acAddress.Street1;
                settings.City       = acAddress.City;
                settings.State      = acAddress.State;
                settings.PostalCode = acAddress.PostalCode;
                settings.Country    = acAddress.Country;
            }

            return(settings.ToSelectionString());
        }
        /// <summary>
        /// Gets the selection.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="filterMode"></param>
        /// <returns></returns>
        public override string GetSelection(Type entityType, Control[] controls, FilterMode filterMode)
        {
            var settings = new FilterSettings();

            if (controls.Length > 0)
            {
                var containerControl = controls[0] as DynamicControlsPanel;
                if (containerControl.Controls.Count >= 1)
                {
                    // note: since this datafilter creates additional controls outside of CreateChildControls(), we'll use our _controlsToRender instead of the controls parameter
                    GroupTypePicker groupTypePicker = containerControl.Controls[0] as GroupTypePicker;
                    Guid            groupTypeGuid   = Guid.Empty;
                    var             groupTypeId     = groupTypePicker.SelectedGroupTypeId;

                    if (containerControl.Controls.Count == 1 || filterMode == FilterMode.SimpleFilter)
                    {
                        groupTypePicker_SelectedIndexChanged(groupTypePicker, new EventArgs());
                    }

                    if (containerControl.Controls.Count > 1)
                    {
                        DropDownList ddlProperty = containerControl.Controls[1] as DropDownList;
                        settings.AttributeKey = ddlProperty.SelectedValue;
                        var entityFields = GetGroupMemberAttributes(groupTypeId);
                        var entityField  = entityFields.FirstOrDefault(f => f.UniqueName == ddlProperty.SelectedValue);
                        if (entityField != null)
                        {
                            var panelControls = new List <Control>();
                            panelControls.AddRange(containerControl.Controls.OfType <Control>());

                            var control = panelControls.FirstOrDefault(c => c.ID.EndsWith(entityField.UniqueName));
                            if (control != null)
                            {
                                entityField.FieldType.Field.GetFilterValues(control, entityField.FieldConfig, filterMode).ForEach(v => settings.AttributeFilterSettings.Add(v));
                            }
                        }
                    }
                }
            }

            return(settings.ToSelectionString());
        }
示例#8
0
        /// <summary>
        /// Gets a formatted string representing the current filter control values.
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection( Type entityType, Control[] controls )
        {
            var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView );
            var ddlCompare = controls.GetByName<RockDropDownList>( _CtlComparison );
            var nbValue = controls.GetByName<NumberBox>( _CtlMemberCount );

            var settings = new FilterSettings();

            settings.PersonDataViewGuid = DataComponentSettingsHelper.GetDataViewGuid( ddlDataView.SelectedValue );
            settings.PersonCountComparison = ddlCompare.SelectedValueAsEnum<ComparisonType>( ComparisonType.GreaterThan );
            settings.PersonCount = nbValue.Text.AsInteger();

            return settings.ToSelectionString();
        }
示例#9
0
        /// <summary>
        /// Gets the selection.
        /// Implement this version of GetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection( Type entityType, Control[] controls )
        {
            var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView );
            var ddlLocationType = controls.GetByName<RockDropDownList>( _CtlLocationType );

            var settings = new FilterSettings();

            settings.LocationTypeGuid = ddlLocationType.SelectedValue.AsGuidOrNull();
            settings.DataViewGuid = DataComponentSettingsHelper.GetDataViewGuid( ddlDataView.SelectedValue );

            return settings.ToSelectionString();
        }
        /// <summary>
        /// Gets the selection.
        /// Implement this version of GetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection( Type entityType, Control[] controls )
        {
            // Get selection control instances.
            var pnlGroupAttributeFilterControls = controls.GetByName<DynamicControlsPanel>( _CtlGroup );
            var ddlProperty = controls.GetByName<DropDownList>( _CtlProperty );

            if (pnlGroupAttributeFilterControls == null)
            {
                return null;
            }

            var settings = new FilterSettings();
            settings.AttributeKey = ddlProperty.SelectedValue;

            var entityFields = GetGroupMemberAttributes();
            var entityField = entityFields.FirstOrDefault( f => f.Name == ddlProperty.SelectedValue );
            if (entityField != null)
            {
                var panelControls = new List<Control>();
                panelControls.AddRange( pnlGroupAttributeFilterControls.Controls.OfType<Control>() );

                var control = panelControls.FirstOrDefault( c => c.ID.EndsWith( "_" + entityField.Name ) );

                if (control != null)
                {
                    entityField.FieldType.Field.GetFilterValues( control, entityField.FieldConfig, FilterMode.AdvancedFilter ).ForEach( v => settings.AttributeFilterSettings.Add( v ) );
                }
            }

            return settings.ToSelectionString();
        }
示例#11
0
        /// <summary>
        /// Gets the selection.
        /// Implement this version of GetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection( Type entityType, Control[] controls )
        {
            var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView );

            var settings = new FilterSettings();

            settings.DataViewGuid = DataComponentSettingsHelper.GetDataViewGuid( ddlDataView.SelectedValue );

            return settings.ToSelectionString();
        }