/// <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(); } }
/// <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(); } } } }