Esempio n. 1
0
        public static Expression <Func <T, bool> > And <T>(string[] keys, T t)
        {
            if (keys == null)
            {
                return(null);
            }
            var expression = EfUtils.True <T>();

            for (int i = 0; i < keys.Length; i++)
            {
                var text = keys[i];
                var expr = t.GetType().GetProperty(text);
                var val  = expr.GetValue(t, null).ToString();
                var type = expr.ToString();
                if (text.ToLower().Equals("datetime") || text.ToLower().Equals("clientdatetime"))
                {
                    expression = expression.And(EfUtils.AndIndexOf <T>(type, text, val));
                }
                else
                {
                    expression = expression.And(EfUtils.And <T>(type, text, val));
                }
            }
            return(expression);
        }
Esempio n. 2
0
        public static Expression <Func <T, bool> > AndByGuid <T>(string key, Guid val)
        {
            if (string.IsNullOrEmpty(key) || val == null)
            {
                return(null);
            }
            var expression = EfUtils.True <T>();

            expression = expression.And(EfUtils.AndByGuid <T>("Guid", key, val));
            return(expression);
        }
Esempio n. 3
0
        public static Expression <Func <T, bool> > AndByGuid <T>(string[] keys, Guid val)
        {
            if (keys == null || val == null)
            {
                return(null);
            }
            var expression = EfUtils.True <T>();

            for (int i = 0; i < keys.Length; i++)
            {
                var text = keys[i];
                expression = expression.And(EfUtils.AndByGuid <T>("Guid", text, val));
            }
            return(expression);
        }
Esempio n. 4
0
        public static Expression <Func <T, bool> > AndOr <T>(string[] keys, string orKey, T t)
        {
            if (keys == null)
            {
                return(null);
            }
            var expression = EfUtils.And <T>(keys, t);

            if (!string.IsNullOrEmpty(orKey))
            {
                Expression <Func <T, bool> > exp_right = EfUtils.And <T>(new string[]
                {
                    orKey
                }, t);
                expression = expression.Or(exp_right);
            }
            return(expression);
        }