internal ProductVariant(Guid productKey, ProductAttributeCollection attributes, CatalogInventoryCollection catalogInventoryCollection, bool master, string name, string sku, decimal price) : base(name, sku, price, catalogInventoryCollection) { Mandate.ParameterNotNull(attributes, "attributes"); Mandate.ParameterNotNull(catalogInventoryCollection, "warehouseInventory"); _productKey = productKey; _attibutes = attributes; _master = master; }
/// <summary> /// Initializes a new instance of the <see cref="ProductVariant"/> class. /// </summary> /// <param name="productKey"> /// The product key. /// </param> /// <param name="attributes"> /// The attributes. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="sku"> /// The SKU. /// </param> /// <param name="price"> /// The price. /// </param> internal ProductVariant( Guid productKey, ProductAttributeCollection attributes, string name, string sku, decimal price) : this(productKey, attributes, new CatalogInventoryCollection(), false, name, sku, price) { }
/// <summary> /// Initializes a new instance of the <see cref="ProductVariant"/> class. /// </summary> /// <param name="productKey"> /// The product key. /// </param> /// <param name="attributes"> /// The attributes. /// </param> /// <param name="catalogInventoryCollection"> /// The catalog inventory collection. /// </param> /// <param name="detachedContents"> /// The detached contents. /// </param> /// <param name="master"> /// The master. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="sku"> /// The SKU. /// </param> /// <param name="price"> /// The price. /// </param> internal ProductVariant(Guid productKey, ProductAttributeCollection attributes, CatalogInventoryCollection catalogInventoryCollection, DetachedContentCollection <IProductVariantDetachedContent> detachedContents, bool master, string name, string sku, decimal price) : base(name, sku, price, catalogInventoryCollection, detachedContents) { Ensure.ParameterNotNull(attributes, "attributes"); Ensure.ParameterNotNull(catalogInventoryCollection, "warehouseInventory"); _productKey = productKey; _attibutes = attributes; _master = master; }
internal ProductOption(string name, bool required, ProductAttributeCollection choices) { // This is required so that we can create attributes from the WebApi without a lot of // round trip traffic to the db to generate the Key(s). Key is virtual so also forces // this class to be sealed Key = Guid.NewGuid(); HasIdentity = false; _name = name; _required = required; _choices = choices; }
/// <summary> /// Creates a clone of this option. /// </summary> /// <returns> /// The <see cref="IProductOption"/>. /// </returns> public IProductOption Clone() { var choices = this.Choices.Select(x => x.Clone()).OrderBy(x => x.SortOrder); var o = (ProductOption)this.MemberwiseClone(); var atts = new ProductAttributeCollection(); foreach (var c in choices) { atts.Add(c); } o.Choices = atts; o.ResetDirtyProperties(); return(o); }
/// <summary> /// Initializes a new instance of the <see cref="ProductVariant"/> class. /// </summary> /// <param name="productKey"> /// The product key. /// </param> /// <param name="attributes"> /// The attributes. /// </param> /// <param name="catalogInventoryCollection"> /// The catalog inventory collection. /// </param> /// <param name="master"> /// The master. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="sku"> /// The SKU. /// </param> /// <param name="price"> /// The price. /// </param> internal ProductVariant(Guid productKey, ProductAttributeCollection attributes, CatalogInventoryCollection catalogInventoryCollection, bool master, string name, string sku, decimal price) : this(productKey, attributes, catalogInventoryCollection, new DetachedContentCollection <IProductVariantDetachedContent>(), false, name, sku, price) { }
/// <summary> /// The equals comparison. /// </summary> /// <param name="compare"> /// The compare. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public bool Equals(ProductAttributeCollection compare) { return(Count == compare.Count && compare.All(item => Contains(item.Key))); }