Esempio n. 1
0
        protected override bool Validate(string value, out string errorMessage)
        {
            int  val;
            bool valid = int.TryParse(value, out val);

            errorMessage = string.Empty;
            if (!valid)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("Invalid Value (Valid Value Format: \"");
                sb.Append(FormatPatterns.GetIntFormatPattern());
                sb.Append("\")");
                errorMessage = sb.ToString();
            }
            return(valid);
        }
Esempio n. 2
0
        protected virtual bool Validate(string value, out string errorMessage)
        {
            double val;
            bool   valid = double.TryParse(value, out val);

            errorMessage = string.Empty;
            if (!valid)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("Invalid Value (Valid Value Format: \"");
                sb.Append(FormatPatterns.GetDoubleFormatPattern());
                sb.Append("\")");
                errorMessage = sb.ToString();
            }
            return(valid);
        }
Esempio n. 3
0
        protected virtual bool Validate(string value, out string errorMessage)
        {
            TimeSpan val;
            bool     valid = TimeSpan.TryParseExact(value, "c", CultureInfo.CurrentCulture, out val);

            errorMessage = string.Empty;
            if (!valid)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("Invalid Value (Valid Value Format: \"");
                sb.Append(FormatPatterns.GetTimeSpanFormatPattern());
                sb.Append("\")");
                errorMessage = sb.ToString();
            }
            return(valid);
        }