Esempio n. 1
0
        /// <summary>
        /// Gets the validation message.
        /// </summary>
        /// <param name="valueName">Name of the value.</param>
        /// <param name="arguments">The arguments.</param>
        /// <returns>
        /// The validation message
        /// </returns>
        public override string GetValidationMessage(string valueName, params string[] arguments)
        {
            IValidationMessageBuilder messageBuilder = GetValidationMessageBuilder();
            string validationMessage = messageBuilder.SetMessageResourceName(Constants.ValidationMessageResourceNames.CREDIT_CARD_VALIDATION_MESSAGE)
                                       .Build(valueName, arguments);

            return(validationMessage);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the validation message.
        /// </summary>
        /// <param name="valueName">Name of the value.</param>
        /// <param name="arguments">The arguments.</param>
        /// <returns>
        /// The validation message
        /// </returns>
        public override string GetValidationMessage(string valueName, params string[] arguments)
        {
            IValidationMessageBuilder messageBuilder = GetValidationMessageBuilder();
            string validationMessage = messageBuilder.SetMessageResourceName(m_ValidationMessageResourceName)
                                       .Build(valueName, arguments);

            return(validationMessage);
        }
        /// <summary>
        /// Gets the validation message.
        /// </summary>
        /// <param name="valueName">Name of the value.</param>
        /// <param name="arguments">The arguments.</param>
        /// <returns>
        /// The validation message
        /// </returns>
        public override string GetValidationMessage(string valueName, params string[] arguments)
        {
            IValidationMessageBuilder messageBuilder = GetValidationMessageBuilder();
            string validationMessage = messageBuilder.SetMessageResourceName(Constants.ValidationMessageResourceNames.NOT_EQUAL_TO_VALIDATION_MESSAGE)
                                       .SetValidatorProperties(m_ValidatorProperties)
                                       .Build(valueName, arguments);

            return(validationMessage);
        }
        /// <summary>
        /// Gets the validation message.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="valueName">Name of the value.</param>
        /// <param name="arguments">The arguments.</param>
        /// <returns>The validation message</returns>
        public string GetValidationMessage(object entity, string valueName, params string[] arguments)
        {
            // TODO: Use property property name transformer and display name resolver
            // TODO: Test not equal to validator
            IValidationMessageBuilder messageBuilder = ValidatorBase.GetValidationMessageBuilder();
            string validationMessage = messageBuilder.SetMessageResourceName(Constants.ValidationMessageResourceNames.EQUAL_TO_VALIDATION_MESSAGE)
                                       .SetParameter(Constants.ValidationMessageParameterNames.VALUE_TO_COMPARE, m_ConfirmProperty ? m_MemberToCompareMemberInfo.Name : Convert.ToString(GetValueToCompare(entity), CultureInfo.CurrentCulture))
                                       .Build(valueName, arguments);

            return(validationMessage);
        }
        /// <summary>
        /// Gets the validation message.
        /// </summary>
        /// <param name="valueName">Name of the value.</param>
        /// <param name="arguments">The arguments.</param>
        /// <returns>
        /// The validation message
        /// </returns>
        public override string GetValidationMessage(string valueName, params string[] arguments)
        {
            string validationMessageResourceName;

            if (Max == -1)
            {
                validationMessageResourceName = Constants.ValidationMessageResourceNames.BIGGER_THAN_LENGTH_VALIDATION_MESSAGE;
            }
            else if (Min == 0)
            {
                validationMessageResourceName = Constants.ValidationMessageResourceNames.SMALLER_THAN_LENGTH_VALIDATION_MESSAGE;
            }
            else
            {
                validationMessageResourceName = Constants.ValidationMessageResourceNames.LENGTH_VALIDATION_MESSAGE;
            }

            IValidationMessageBuilder messageBuilder = GetValidationMessageBuilder();
            string validationMessage = messageBuilder.SetMessageResourceName(validationMessageResourceName)
                                       .SetValidatorProperties(m_ValidatorProperties)
                                       .Build(valueName, arguments);

            return(validationMessage);
        }