コード例 #1
0
        public override bool IsValidInternal(string value)
        {
            DateTime dateTime;

            if (StringParserHelper.IsNullOrEmptyOrBlank(value) || !StringParserHelper.TryParseDate(value, out dateTime))
            {
                return(false);
            }
            DateTime now = DateTime.Now;

            if (dateTime.Year > now.Year)
            {
                return(true);
            }
            return(dateTime.Year == now.Year && dateTime.Month >= now.Month);
        }
コード例 #2
0
        public override bool IsValidInternal(string value, object state)
        {
            string cultureString = state as string;
            bool   flag;

            if (StringParserHelper.IsNullOrEmptyOrBlank(value))
            {
                flag = !this.IsRequired(state);
            }
            else
            {
                DateTime dateTime;
                flag = DateTimeHelper.TryParse(value, cultureString, out dateTime);
                if (flag && dateTime > DateTime.Now)
                {
                    flag = false;
                }
            }
            return(flag);
        }
コード例 #3
0
 public override bool IsValidInternal(string value) => StringParserHelper.IsNullOrEmptyOrBlank(value) || StringParserHelper.TryParseDate(value, out DateTime _);
コード例 #4
0
 public override bool IsValidInternal(string value) => !StringParserHelper.IsNullOrEmptyOrBlank(value);