Exemple #1
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (DisplayName == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName");
     }
     if (TriggeringLogic == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TriggeringLogic");
     }
     if (Actions == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Actions");
     }
     if (TriggeringLogic != null)
     {
         TriggeringLogic.Validate();
     }
     if (Actions != null)
     {
         foreach (var element in Actions)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (DisplayName == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName");
     }
     if (TriggeringLogic == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TriggeringLogic");
     }
     if (Actions == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Actions");
     }
     if (DisplayName != null)
     {
         if (DisplayName.Length > 500)
         {
             throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 500);
         }
     }
     if (Order > 1000)
     {
         throw new ValidationException(ValidationRules.InclusiveMaximum, "Order", 1000);
     }
     if (Order < 1)
     {
         throw new ValidationException(ValidationRules.InclusiveMinimum, "Order", 1);
     }
     if (TriggeringLogic != null)
     {
         TriggeringLogic.Validate();
     }
     if (Actions != null)
     {
         if (Actions.Count > 20)
         {
             throw new ValidationException(ValidationRules.MaxItems, "Actions", 20);
         }
         foreach (var element in Actions)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
 }