示例#1
0
 /// <summary>
 /// Creates the control needed to filter (query) values using this field type.
 /// </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 System.Web.UI.Control FilterControl(System.Collections.Generic.Dictionary <string, ConfigurationValue> configurationValues, string id, bool required, Rock.Reporting.FilterMode filterMode)
 {
     return(base.FilterControl(configurationValues, id, required, filterMode));
 }
 /// <summary>
 /// Creates the control needed to filter (query) values using this field type.
 /// </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 System.Web.UI.Control FilterControl(System.Collections.Generic.Dictionary <string, ConfigurationValue> configurationValues, string id, bool required, Rock.Reporting.FilterMode filterMode)
 {
     // This field type does not support filtering
     return(null);
 }
示例#3
0
        /// <summary>
        /// Gets the Attribute Query Expression to be used with an Entity Query
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="qry">The qry.</param>
        /// <param name="filterControl">The filter control.</param>
        /// <param name="attribute">The attribute.</param>
        /// <param name="serviceInstance"></param>
        /// <param name="filterMode">The filter mode.</param>
        /// <returns></returns>
        public virtual IQueryable <T> ApplyAttributeQueryFilter <T>(IQueryable <T> qry, Control filterControl, Rock.Web.Cache.AttributeCache attribute, IService serviceInstance, Rock.Reporting.FilterMode filterMode) where T : Rock.Data.Entity <T>, new()
        {
            if (filterControl == null)
            {
                return(qry);
            }

            var filterValues = GetFilterValues(filterControl, attribute.QualifierValues, filterMode);
            var entityFields = EntityHelper.GetEntityFields(typeof(T));
            var entityField  = entityFields.Where(a => a.FieldKind == FieldKind.Attribute && a.AttributeGuid == attribute.Guid).FirstOrDefault();

            if (entityField == null)
            {
                entityField = EntityHelper.GetEntityFieldForAttribute(attribute, false);
            }

            var parameterExpression = serviceInstance.ParameterExpression;
            var attributeExpression = Rock.Utility.ExpressionHelper.GetAttributeExpression(serviceInstance, parameterExpression, entityField, filterValues);

            qry = qry.Where(parameterExpression, attributeExpression);

            return(qry);
        }