Esempio n. 1
0
        protected override bool CustomValidation()
        {
            var start = ControlInfo1.GetValue();

            if (!(start is DateTime))
            {
                return(false);
            }

            var end = ControlInfo2.GetValue();

            if (!(end is DateTime))
            {
                return(false);
            }

            var startDateTime = (DateTime)start;
            var endDateTime   = (DateTime)end;

            if (startDateTime.IsMinOrMax() || endDateTime.IsMinOrMax())
            {
                return(false);
            }

            if (startDateTime >= endDateTime)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        protected override bool CustomValidation()
        {
            var first = ControlInfo1.GetValue() as IComparable;

            if (first == null)
            {
                return(false);
            }

            var second = ControlInfo2.GetValue() as IComparable;

            if (second == null)
            {
                return(false);
            }

            switch (Operator)
            {
            case ComparasionOperator.LessThan:
                return(first.CompareTo(second) < 0);

            case ComparasionOperator.LessThanEqualsTo:
                return(first.CompareTo(second) <= 0);

            case ComparasionOperator.EqualsTo:
                return(first.CompareTo(second) == 0);

            case ComparasionOperator.GreaterThan:
                return(first.CompareTo(second) > 0);

            case ComparasionOperator.GreaterThanEqualsTo:
                return(first.CompareTo(second) >= 0);

            default:
                return(false);
            }
        }
Esempio n. 3
0
        public override bool Validate()
        {
            if (ControlInfo1 == null)
            {
                return(false);
            }

            if (ControlInfo2 == null)
            {
                return(false);
            }

            if (!ControlInfo1.IsMyPropertyValuesValid())
            {
                return(false);
            }

            if (!ControlInfo2.IsMyPropertyValuesValid())
            {
                return(false);
            }

            return(CustomValidation());
        }