Exemplo 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);
        }
Exemplo n.º 2
0
        public static decimal filterDecimalValue(this ICollection <abstractSearch> filter, string property)
        {
            decimal result = 0;

            decimalSearch ds = filter.Where(x => x.property.ToLower() == property.ToLower()).FirstOrDefault() as decimalSearch;

            if (ds != default(decimalSearch))
            {
                result = ds.searchTerm.Value;
            }

            return(result);
        }