예제 #1
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (BuyingPrice == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "BuyingPrice");
     }
     if (RegularPrice == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "RegularPrice");
     }
     if (FulfillmentChannel == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "FulfillmentChannel");
     }
     if (ItemCondition == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "ItemCondition");
     }
     if (ItemSubCondition == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "ItemSubCondition");
     }
     if (SellerSKU == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "SellerSKU");
     }
     if (BuyingPrice != null)
     {
         BuyingPrice.Validate();
     }
 }
예제 #2
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (BuyingPrice == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "BuyingPrice");
     }
     if (RegularPrice == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "RegularPrice");
     }
     if (FulfillmentChannel == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "FulfillmentChannel");
     }
     if (ItemCondition == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "ItemCondition");
     }
     if (ItemSubCondition == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "ItemSubCondition");
     }
     if (SellerSKU == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "SellerSKU");
     }
     if (BuyingPrice != null)
     {
         BuyingPrice.Validate();
     }
     if (QuantityDiscountPrices != null)
     {
         foreach (var element in QuantityDiscountPrices)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
 }