Exemplo n.º 1
0
 /// <summary>
 /// The tax included in product price.
 /// </summary>
 /// <param name="extendedData">
 /// The extended data.
 /// </param>
 /// <returns>
 /// A value indicating whether or not tax is included in the product price.
 /// </returns>
 public static bool TaxIncludedInProductPrice(this ExtendedDataCollection extendedData)
 {
     return(extendedData.ContainsKey(Constants.ExtendedDataKeys.TaxIncludedInProductPrice) &&
            extendedData.GetValue(Constants.ExtendedDataKeys.TaxIncludedInProductPrice).AsBool());
 }
Exemplo n.º 2
0
 /// <summary>
 /// Returns the "merchOnSale" value as a boolean
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// A value indicating whether or not the item is on sale.
 /// </returns>
 public static bool GetOnSaleValue(this ExtendedDataCollection extendedData)
 {
     return(extendedData.GetValue(Constants.ExtendedDataKeys.OnSale).AsBool());
 }
Exemplo n.º 3
0
 /// <summary>
 /// True/false indicating whether or not the collection contains a ShipmentKey
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// A value indicating whether or not the extended data collection contains a shipment key.
 /// </returns>
 public static bool ContainsShipmentKey(this ExtendedDataCollection extendedData)
 {
     return(extendedData.ContainsKey(Constants.ExtendedDataKeys.ShipmentKey));
 }
Exemplo n.º 4
0
 /// <summary>
 /// True/false indicating whether or not the collection contains a WarehouseCatalogKey
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// A value indicating whether or not the extended data collection contains a warehouse key.
 /// </returns>
 public static bool ContainsWarehouseCatalogKey(this ExtendedDataCollection extendedData)
 {
     return(extendedData.ContainsKey(Constants.ExtendedDataKeys.WarehouseCatalogKey));
 }
Exemplo n.º 5
0
 /// <summary>
 /// returns the "merchWeight" value
 /// </summary>
 /// <param name="extendedData">The <see cref="ExtendedDataCollection"/></param>
 /// <returns>The barcode</returns>
 public static string GetBarcodeValue(this ExtendedDataCollection extendedData)
 {
     return(extendedData.GetValue(Constants.ExtendedDataKeys.Barcode));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Gets an <see cref="IAddress"/> from the <see cref="ExtendedDataCollection"/>
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <param name="addressType">
 /// The address Type.
 /// </param>
 /// <returns>
 /// The <see cref="IAddress"/>.
 /// </returns>
 public static IAddress GetAddress(this ExtendedDataCollection extendedData, AddressType addressType)
 {
     return(extendedData.GetAddress(addressType == AddressType.Shipping
                                        ? Constants.ExtendedDataKeys.ShippingDestinationAddress
                                        : Constants.ExtendedDataKeys.BillingAddress));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Returns the VersionKey
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// The version key.
 /// </returns>
 public static Guid GetVersionKey(this ExtendedDataCollection extendedData)
 {
     return(!extendedData.ContainsVersionKey() ?
            Guid.Empty :
            extendedData.GetValue(Constants.ExtendedDataKeys.VersionKey).AsGuid());
 }
Exemplo n.º 8
0
 /// <summary>
 /// returns the "merchLength" value
 /// </summary>
 /// <param name="extendedData">The <see cref="ExtendedDataCollection"/></param>
 /// <returns>The length</returns>
 public static decimal GetLengthValue(this ExtendedDataCollection extendedData)
 {
     return(extendedData.GetValue(Constants.ExtendedDataKeys.Length).AsDecimal());
 }
Exemplo n.º 9
0
 /// <summary>
 /// Returns the ProductKey
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// The product key.
 /// </returns>
 public static Guid GetProductKey(this ExtendedDataCollection extendedData)
 {
     return(extendedData.GetValue(Constants.ExtendedDataKeys.ProductKey).AsGuid());
 }
Exemplo n.º 10
0
 /// <summary>
 /// True/false indicating whether or not the collection contains a ProductKey
 /// </summary>
 /// <param name="extendedData">
 /// The extended data.
 /// </param>
 /// <returns>
 ///  A value indicating whether or not the extended data collection contains a version key.
 /// </returns>
 public static bool ContainsVersionKey(this ExtendedDataCollection extendedData)
 {
     return(extendedData.ContainsKey(Constants.ExtendedDataKeys.VersionKey));
 }
Exemplo n.º 11
0
 /// <summary>
 /// True/false indicating whether or not the collection contains a ProductVariantKey
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// A value indicating whether or not the extended data collection contains a product variant key.
 /// </returns>
 public static bool ContainsProductVariantKey(this ExtendedDataCollection extendedData)
 {
     return(extendedData.ContainsKey(Constants.ExtendedDataKeys.ProductVariantKey));
 }
Exemplo n.º 12
0
 /// <summary>
 /// True/false indicating whether or not this extended data collection contains information
 /// which could define a <see cref="IProductVariant"/>
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 public static bool DefinesProductVariant(this ExtendedDataCollection extendedData)
 {
     return(extendedData.ContainsProductVariantKey() && extendedData.ContainsProductKey());
 }
Exemplo n.º 13
0
 /// <summary>
 /// The contains any.
 /// </summary>
 /// <param name="extendedData">
 /// The extended data.
 /// </param>
 /// <param name="keys">
 /// The keys.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 public static bool ContainsAny(this ExtendedDataCollection extendedData, IEnumerable <string> keys)
 {
     return(extendedData.Keys.ToArray().Any(keys.Contains));
 }
Exemplo n.º 14
0
 /// <summary>
 /// Returns the "merchSalePrice" value
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// The sales price
 /// </returns>
 public static decimal GetSalePriceValue(this ExtendedDataCollection extendedData)
 {
     return(extendedData.GetValue(Constants.ExtendedDataKeys.SalePrice).AsDecimal());
 }
Exemplo n.º 15
0
 /// <summary>
 /// Returns the "merchTrackInventory" value
 /// </summary>
 /// <param name="extendedData">The <see cref="ExtendedDataCollection"/></param>
 /// <returns>A value indicating whether or not the line item (product) should be included in inventory operations</returns>
 public static bool GetTrackInventoryValue(this ExtendedDataCollection extendedData)
 {
     return(extendedData.GetValue(Constants.ExtendedDataKeys.TrackInventory).AsBool());
 }
Exemplo n.º 16
0
 /// <summary>
 /// Returns the "merchManufacturerModelNumber" value
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// The manufacturers model number
 /// </returns>
 public static string GetManufacturerModelNumberValue(this ExtendedDataCollection extendedData)
 {
     return(extendedData.GetValue(Constants.ExtendedDataKeys.ManufacturerModelNumber));
 }
Exemplo n.º 17
0
 /// <summary>
 /// Returns the "merchOutOfStockPurchase" value
 /// </summary>
 /// <param name="extendedData">The <see cref="ExtendedDataCollection"/></param>
 /// <returns>A value indicating whether or not the item can be purchased even if it's out of stock</returns>
 public static bool GetOutOfStockPurchaseValue(this ExtendedDataCollection extendedData)
 {
     return(extendedData.GetValue(Constants.ExtendedDataKeys.OutOfStockPurchase).AsBool());
 }
Exemplo n.º 18
0
 /// <summary>
 /// True/false indicating whether or not this extended data collection contains a child serialized extended data collection
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// A value indicating whether or not this extended data collection contains a child serialized extended data collection
 /// </returns>
 public static bool ContainsExtendedDataSerialization(this ExtendedDataCollection extendedData)
 {
     return(extendedData.ContainsKey(Constants.ExtendedDataKeys.ExtendedData));
 }
Exemplo n.º 19
0
 /// <summary>
 /// The add extended data collection.
 /// </summary>
 /// <param name="extendedData">
 /// The extended data.
 /// </param>
 /// <param name="extendedDataToSerialize">
 /// The extended data to serialize.
 /// </param>
 public static void AddExtendedDataCollection(this ExtendedDataCollection extendedData, ExtendedDataCollection extendedDataToSerialize)
 {
     extendedData.SetValue(Constants.ExtendedDataKeys.ExtendedData, extendedDataToSerialize.SerializeToXml());
 }
Exemplo n.º 20
0
 /// <summary>
 /// Adds an <see cref="IAddress"/> to extended data.  This is intended for shipment addresses
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <param name="address">
 /// The address.
 /// </param>
 /// <param name="addressType">
 /// The Origin or Destination addresses
 /// </param>
 public static void AddAddress(this ExtendedDataCollection extendedData, IAddress address, AddressType addressType)
 {
     extendedData.AddAddress(
         address,
         addressType == AddressType.Shipping ? Constants.ExtendedDataKeys.ShippingDestinationAddress : Constants.ExtendedDataKeys.BillingAddress);
 }
Exemplo n.º 21
0
 /// <summary>
 /// Returns the "merchDownload" value
 /// </summary>
 /// <param name="extendedData">The <see cref="ExtendedDataCollection"/></param>
 /// <returns>A value indicating whether or not the item is downloadable</returns>
 public static bool GetDownloadValue(this ExtendedDataCollection extendedData)
 {
     return(extendedData.GetValue(Constants.ExtendedDataKeys.Download).AsBool());
 }
Exemplo n.º 22
0
 /// <summary>
 /// Gets a <see cref="ExtendedDataCollection"/> from the <see cref="ExtendedDataCollection"/>
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// The <see cref="ExtendedDataCollection"/>.
 /// </returns>
 public static ExtendedDataCollection GetExtendedDataCollection(this ExtendedDataCollection extendedData)
 {
     return(extendedData.ContainsExtendedDataSerialization()
                ? new ExtendedDataCollection(extendedData.GetValue(Constants.ExtendedDataKeys.ExtendedData))
                : null);
 }
Exemplo n.º 23
0
 /// <summary>
 /// Returns the "merchTrackInventory" value
 /// </summary>
 /// <param name="extendedData">The <see cref="ExtendedDataCollection"/></param>
 /// <returns>The Umbraco media Id</returns>
 public static int GetDownloadMediaIdValue(this ExtendedDataCollection extendedData)
 {
     return(extendedData.GetValue(Constants.ExtendedDataKeys.DownloadMediaId).AsInt());
 }
Exemplo n.º 24
0
 /// <summary>
 /// Returns the merchShipMethodKey value as a GUID
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// The GUID based 'Key' of the <see cref="IShipMethod"/>
 /// </returns>
 public static Guid GetShipMethodKey(this ExtendedDataCollection extendedData)
 {
     return(extendedData.GetValue(Constants.ExtendedDataKeys.ShipMethodKey).AsGuid());
 }
Exemplo n.º 25
0
        /// <summary>
        /// Returns the "merchPrice" value
        /// </summary>
        /// <param name="extendedData">
        /// The extended Data.
        /// </param>
        /// <returns>
        /// The price.
        /// </returns>
        public static decimal GetPriceValue(this ExtendedDataCollection extendedData)
        {
            decimal converted = decimal.TryParse(extendedData.GetValue(Constants.ExtendedDataKeys.Price), System.Globalization.NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out converted) ? converted : 0;

            return(converted);
        }
Exemplo n.º 26
0
 /// <summary>
 /// Return the WarehouseCatalogKey
 /// </summary>
 /// <param name="extendedData">
 /// The extended Data.
 /// </param>
 /// <returns>
 /// The GUID warehouse catalog key.
 /// </returns>
 public static Guid GetWarehouseCatalogKey(this ExtendedDataCollection extendedData)
 {
     return(extendedData.GetValue(Constants.ExtendedDataKeys.WarehouseCatalogKey).AsGuid());
 }
Exemplo n.º 27
0
 /// <summary>
 /// The get allows validation value.
 /// </summary>
 /// <param name="extendedData">
 /// The extended data.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 internal static bool GetAllowsValidationValue(this ExtendedDataCollection extendedData)
 {
     return(!extendedData.ContainsKey(Constants.ExtendedDataKeys.LineItemAllowsValidation) ||
            extendedData.GetValue(Constants.ExtendedDataKeys.LineItemAllowsValidation).AsBool());
 }