public override bool IsRequiredInternal(object state)
        {
            AccountCountry accountCountry = this.GetAccountCountry(state);

            if (accountCountry != null)
            {
                CountryFieldValidator validator = accountCountry.GetValidator(this._fieldValidatorType);
                if (validator != null && !string.IsNullOrEmpty(validator.Regex))
                {
                    return(true);
                }
            }
            return(false);
        }
        internal override string GetLabelString(object state)
        {
            string         str            = string.Empty;
            AccountCountry accountCountry = this.GetAccountCountry(state);

            if (accountCountry != null)
            {
                CountryFieldValidator validator = accountCountry.GetValidator(this._fieldValidatorType);
                if (validator != null)
                {
                    str = Shell.LoadString(validator.NameStringId);
                }
            }
            return(str);
        }
        internal override string GetOverlayString(object state)
        {
            string         str            = string.Empty;
            AccountCountry accountCountry = this.GetAccountCountry(state);

            if (accountCountry != null)
            {
                CountryFieldValidator validator = accountCountry.GetValidator(this._fieldValidatorType);
                if (validator != null)
                {
                    str = validator.FriendlyFormat;
                }
            }
            return(str);
        }
예제 #4
0
        public CountryFieldValidator GetValidator(CountryFieldValidatorType type)
        {
            CountryFieldValidator countryFieldValidator = null;

            if (this.Validators != null && CountryFieldValidatorLookup.ContainsKey(type))
            {
                for (int index = 0; index < this.Validators.Length; ++index)
                {
                    CountryFieldValidator validator = this.Validators[index];
                    if (validator.Name == (string)CountryFieldValidatorLookup[type])
                    {
                        countryFieldValidator = validator;
                        break;
                    }
                }
            }
            return(countryFieldValidator);
        }
        public override bool IsValidInternal(string value, object state)
        {
            string         pattern        = null;
            AccountCountry accountCountry = this.GetAccountCountry(state);

            if (accountCountry == null)
            {
                return(true);
            }
            if (accountCountry != null)
            {
                CountryFieldValidator validator = accountCountry.GetValidator(this._fieldValidatorType);
                if (validator != null && !string.IsNullOrEmpty(validator.Regex))
                {
                    pattern = validator.Regex;
                }
            }
            return(string.IsNullOrEmpty(pattern) || value != null && Regex.IsMatch(value, pattern));
        }