Exemplo n.º 1
0
        private TypeFilterItem GetFilterItem(FilterDescription filterDes, PropertyInfo[] props)
        {
            if (null == filterDes || null == props || 1 > props.Length)
            {
                return(null);
            }

            var prop = props.FirstOrDefault(p => String.Equals(p.Name, filterDes.Field, StringComparison.OrdinalIgnoreCase));

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

            string fieldName = prop.Name;
            var    value     = ConvertSimpleType(filterDes.Value, prop.PropertyType);

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

            return(new TypeFilterItem {
                FieldName = fieldName, Value = value, Operator = filterDes.CodeOperator, IsStringMethodOperator = filterDes.IsStringMethodOperator
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取值
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        public object GetValueByField(string field)
        {
            if (Filters == null)
            {
                return(null);
            }
            FilterDescription filter = Filters.FirstOrDefault(c => c.Field == field);

            return(filter == null ? null : filter.Value);
        }