Beispiel #1
0
        /// <summary>
        /// compare la valeur courante de l'objet passe a la valeur definie pour un type de comparaison
        /// </summary>
        /// <param name="obj">l'objet re�u</param>
        /// <returns>vrai ou faux</returns>
        public bool Predicate(object obj)
        {
            bool result = false;
            Nullable <DateTime> CurrentPropertyValue = (Nullable <DateTime>)PredicateUtils.GetValue(obj, Property);

            switch (Comparaison)
            {
            case DateTimeComparaison.Equals:
                result = CurrentPropertyValue.Equals(Value);
                break;

            case DateTimeComparaison.inf:
                if (CurrentPropertyValue < Value)
                {
                    result = true;
                }
                break;

            case DateTimeComparaison.Sup:
                if (CurrentPropertyValue > Value)
                {
                    result = true;
                }
                break;
            }

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// compare la valeur courante de l'objet passe a la valeur definie pour un type de comparaison
        /// </summary>
        /// <param name="obj">l'objet re�u</param>
        /// <returns>vrai ou faux</returns>
        public bool Predicate(object obj)
        {
            bool   result = false;
            string CurrentPropertyValue = Convert.ToString(PredicateUtils.GetValue(obj, Property));

            switch (Comparaison)
            {
            case stringComparaison.Contains:
                result = CurrentPropertyValue.Contains(Value);
                break;

            case stringComparaison.EndWith:
                result = CurrentPropertyValue.EndsWith(Value);
                break;

            case stringComparaison.Equals:
                result = CurrentPropertyValue.Equals(Value);
                break;

            case stringComparaison.Length:
                if (CurrentPropertyValue.Length > Convert.ToInt32(Value))
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
                break;

            case stringComparaison.StartsWith:
                result = CurrentPropertyValue.StartsWith(Value);
                break;
            }

            return(result);
        }