public static ValidationResult DateRangeRule(int id, int cnt, string target, ValidationRule rule)
		{
			ValidationResult result = new ValidationResult();
			if (isValid(target)) 
			{
				SimpleDate dt0 = new SimpleDate(target);
				SimpleDate dt1 = new SimpleDate(rule.min);
				SimpleDate dt2 = new SimpleDate(rule.max);
				result.Success = dt0.compare(dt1) >= 0 && dt0.compare(dt2) <= 0;
			}
			result.ErrorMessage = "DateRangeRule violation.";
			return result;
		}
Exemple #2
0
        public int compare(SimpleDate dt)
        {
            int diff = this.year - dt.year;
            if (diff != 0)
                return diff;

            diff = this.month - dt.month;

            if (diff != 0)
                return diff;

            return this.day - dt.day;
        }
Exemple #3
0
        public static ValidationResult DateRangeRule(int id, int cnt, string target, ValidationRule rule)
        {
            ValidationResult result = new ValidationResult();

            if (isValid(target))
            {
                SimpleDate dt0 = new SimpleDate(target);
                SimpleDate dt1 = new SimpleDate(rule.min);
                SimpleDate dt2 = new SimpleDate(rule.max);
                result.Success = dt0.compare(dt1) >= 0 && dt0.compare(dt2) <= 0;
            }
            result.ErrorMessage = "DateRangeRule violation.";
            return(result);
        }
Exemple #4
0
        public int compare(SimpleDate dt)
        {
            int diff = this.year - dt.year;

            if (diff != 0)
            {
                return(diff);
            }

            diff = this.month - dt.month;

            if (diff != 0)
            {
                return(diff);
            }

            return(this.day - dt.day);
        }