C# Класс Castle.Components.Validator.CreditCardValidator

Наследование: AbstractValidator
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
ApplyBrowserValidation ( BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target ) : void

Applies the browser validation by setting up one or more input rules on IBrowserValidationGenerator.

CreditCardValidator ( ) : System

Initializes a new credit card validator.

CreditCardValidator ( CardType allowedTypes ) : System

Initializes a new credit card validator.

CreditCardValidator ( CardType allowedTypes, string exceptions ) : System

Initializes a new credit card validator.

CreditCardValidator ( string exceptions ) : System

Initializes a new credit card validator.

IsValid ( object instance, object fieldValue ) : bool

Validate that the propety value matches a valid (formatted) credit card Note: null values are consider OK always.

Приватные методы

Метод Описание
IsLuhnValid ( string cardNumber ) : bool
IsValidCardType ( string cardNumber ) : bool

Описание методов

ApplyBrowserValidation() публичный Метод

Applies the browser validation by setting up one or more input rules on IBrowserValidationGenerator.
public ApplyBrowserValidation ( BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target ) : void
config BrowserValidationConfiguration The config.
inputType InputElementType Type of the input.
generator IBrowserValidationGenerator The generator.
attributes IDictionary The attributes.
target string The target.
Результат void

CreditCardValidator() публичный Метод

Initializes a new credit card validator.
public CreditCardValidator ( ) : System
Результат System

CreditCardValidator() публичный Метод

Initializes a new credit card validator.
public CreditCardValidator ( CardType allowedTypes ) : System
allowedTypes CardType The card types to accept.
Результат System

CreditCardValidator() публичный Метод

Initializes a new credit card validator.
public CreditCardValidator ( CardType allowedTypes, string exceptions ) : System
allowedTypes CardType The card types to accept.
exceptions string An array of card numbers to skip checking for (eg. gateway test numbers). Only digits should be provided for the exceptions.
Результат System

CreditCardValidator() публичный Метод

Initializes a new credit card validator.
public CreditCardValidator ( string exceptions ) : System
exceptions string An array of card numbers to skip checking for (eg. gateway test numbers). Only digits should be provided for the exceptions.
Результат System

IsValid() публичный Метод

Validate that the propety value matches a valid (formatted) credit card Note: null values are consider OK always.
public IsValid ( object instance, object fieldValue ) : bool
instance object
fieldValue object
Результат bool