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); }
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); } }