Class ValidationResult
The validation result, consisting of a list of validation messages and flags indicating the validation state.
Inheritance
Inherited Members
Namespace: Codecrete.SwissQRBill.Generator
Assembly: Codecrete.SwissQRBill.Core.dll
Syntax
public sealed class ValidationResult
Properties
| Improve this Doc View SourceCleanedBill
Gets or sets the cleaned bill data.
As part of the validation, the bill data is cleaned, i.e. leading and trailing whitespace is trimmed,
empty values are replaced with null
, invalid characters are replaced and too long data is truncated.
The result is the cleaned bill data.
Declaration
public Bill CleanedBill { get; set; }
Property Value
Type | Description |
---|---|
Bill | The cleaned bill data. |
Description
Gets a human-readable description of the validation problems.
The description includes errors only.
Declaration
public string Description { get; }
Property Value
Type | Description |
---|---|
System.String | The description. |
HasErrors
Gets if this validation result contains any error messages.
Declaration
public bool HasErrors { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
HasMessages
Gets if this validation result contains any messages.
Declaration
public bool HasMessages { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
HasWarnings
Gets if this validation result contains any warning messages.
Declaration
public bool HasWarnings { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsValid
Gets if the bill data is valid and the validation therefore has succeeded.
A successful validation may still produce warning messages.
Declaration
public bool IsValid { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
ValidationMessages
Gets the list of validation messages.
The result is never null
.
Declaration
public List<ValidationMessage> ValidationMessages { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<ValidationMessage> | The validation message list. |
Methods
| Improve this Doc View SourceAddMessage(ValidationMessage.MessageType, String, String, String[])
Adds a new validation message to this validation result.
Declaration
public void AddMessage(ValidationMessage.MessageType type, string field, string messageKey, string[] messageParameters = null)
Parameters
Type | Name | Description |
---|---|---|
ValidationMessage.MessageType | type | The message type. |
System.String | field | The name of the affected field. |
System.String | messageKey | The language-neutral message key. |
System.String[] | messageParameters | The optional message parameters (text) to be inserted into the localized message. |