Ejemplo n.º 1
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (RequestHeader == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "RequestHeader");
     }
     if (TransactionId == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TransactionId");
     }
     if (RequestHeader != null)
     {
         RequestHeader.Validate();
     }
     if (TransactionId != null)
     {
         if (TransactionId.Length > 64)
         {
             throw new ValidationException(ValidationRules.MaxLength, "TransactionId", 64);
         }
     }
     if (AccountNumber != null)
     {
         if (AccountNumber.Length > 34)
         {
             throw new ValidationException(ValidationRules.MaxLength, "AccountNumber", 34);
         }
     }
 }
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (RequestHeader != null)
     {
         RequestHeader.Validate();
     }
     if (TransactionIdFrom != null)
     {
         if (TransactionIdFrom.Length > 64)
         {
             throw new ValidationException(ValidationRules.MaxLength, "TransactionIdFrom", 64);
         }
     }
     if (MinAmount != null)
     {
         if (!System.Text.RegularExpressions.Regex.IsMatch(MinAmount, "^\\d*\\.\\d{2}$"))
         {
             throw new ValidationException(ValidationRules.Pattern, "MinAmount", "^\\d*\\.\\d{2}$");
         }
     }
     if (MaxAmount != null)
     {
         if (!System.Text.RegularExpressions.Regex.IsMatch(MaxAmount, "^\\d*\\.\\d{2}$"))
         {
             throw new ValidationException(ValidationRules.Pattern, "MaxAmount", "^\\d*\\.\\d{2}$");
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (RequestHeader == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "RequestHeader");
     }
     if (RequestHeader != null)
     {
         RequestHeader.Validate();
     }
 }