Beispiel #1
0
        public FieldValidator ToSDKFieldValidator()
        {
            if (fieldValidation == null)
            {
                return(fieldValidator);
            }

            fieldValidator = new FieldValidator();

            fieldValidator.Message = fieldValidation.ErrorMessage;
            if (fieldValidation.ErrorCode.HasValue)
            {
                fieldValidator.ErrorCode = fieldValidation.ErrorCode.Value;
            }
            if (fieldValidation.MaxLength.HasValue)
            {
                fieldValidator.MaxLength = fieldValidation.MaxLength.Value;
            }
            if (fieldValidation.MinLength.HasValue)
            {
                fieldValidator.MinLength = fieldValidation.MinLength.Value;
            }
            fieldValidator.Regex = fieldValidation.Pattern;
            if (fieldValidation.Required.HasValue)
            {
                fieldValidator.Required = fieldValidation.Required.Value;
            }
            if (fieldValidation.Disabled.HasValue)
            {
                fieldValidator.Disabled = fieldValidation.Disabled.Value;
            }
            if (fieldValidation.Enum != null)
            {
                foreach (string option in fieldValidation.Enum)
                {
                    fieldValidator.AddOption(option);
                }
            }

            return(fieldValidator);
        }
Beispiel #2
0
 public FieldValidatorConverter(FieldValidation fieldValidation)
 {
     this.fieldValidation = fieldValidation;
     fieldValidator       = null;
 }
Beispiel #3
0
 public FieldValidatorConverter(FieldValidator fieldValidator)
 {
     this.fieldValidator = fieldValidator;
     fieldValidation     = null;
 }