Ejemplo n.º 1
0
        private static abstractSearch CreateSearchCriteria(Type type, string property)
        {
            abstractSearch result = null;

            if (type.Equals(typeof(string)))
            {
                result = new textSearch();
            }
            else if (type.Equals(typeof(int)) || type.Equals(typeof(int?)))
            {
                result = new intSearch();
            }
            else if (type.Equals(typeof(decimal)) || type.Equals(typeof(decimal?)))
            {
                result = new decimalSearch();
            }
            else if (type.Equals(typeof(DateTime)) || type.Equals(typeof(DateTime?)))
            {
                result = new dateSearch();
            }

            if (result != null)
            {
                result.property = property;
            }

            return(result);
        }
Ejemplo n.º 2
0
        public static ICollection <abstractSearch> AddCustomSearchCriteria <T>(this ICollection <abstractSearch> searchCriterias, Expression <Func <T, object> > property)
        {
            Type   propertyType     = null;
            string fullPropertyPath = GetPropertyPath(property, out propertyType);

            abstractSearch searchCriteria = CreateSearchCriteria(propertyType, fullPropertyPath);

            if (searchCriteria != null)
            {
                searchCriterias.Add(searchCriteria);
            }

            return(searchCriterias);
        }