Exemple #1
0
        /// <summary>
        /// Does validate profile table name.
        /// </summary>
        /// <param name="value">Profile table name to validation.</param>
        /// <param name="cultureInfo">Ignored.</param>
        /// <returns>Validation result.</returns>
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            ProfileNotEmptyValidationRule emptyValidation = new ProfileNotEmptyValidationRule();
            ValidationResult result = emptyValidation.Validate(value, cultureInfo);

            if (!result.IsValid)
            {
                return(result);
            }

            result = ValidationResult.ValidResult;

            string         message = null;
            IList <string> tabels  = DataSourceOpener.GetTableNameList(out message);

            if (!tabels.Contains(value.ToString()))
            {
                message = App.Current.FindString("ImportProfileInvalidTableName");
                result  = new ValidationResult(false, message);
            }

            return(result);
        }
        /// <summary>
        /// Does validate profile table name.
        /// </summary>
        /// <param name="value">Profile table name to validation.</param>
        /// <param name="cultureInfo">Ignored.</param>
        /// <returns>Validation result.</returns>
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            ProfileNotEmptyValidationRule emptyValidation = new ProfileNotEmptyValidationRule();
            ValidationResult result = emptyValidation.Validate(value, cultureInfo);
            if (!result.IsValid)
                return result;

            result = ValidationResult.ValidResult;

            string message = null;
            IList<string> tabels = DataSourceOpener.GetTableNameList(out message);
            if (!tabels.Contains(value.ToString()))
            {
                message = App.Current.FindString("ImportProfileInvalidTableName");
                result = new ValidationResult(false, message);
            }

            return result;
        }