Esempio n. 1
0
        /// <summary>
        /// The &lt;merchant-item-id&gt; tag contains a value,
        /// such as a stock keeping unit (SKU),
        /// that you use to uniquely identify an item.
        /// </summary>
        /// <param name="itemID">The item to add to the box</param>
        public void AddMerchantItemID(string itemID)
        {
            if (itemID == null || itemID.Length == 0)
            {
                throw new ArgumentException("itemID must be valid length > 0.");
            }

            AutoGen.ItemShippingInformation[] items
                = new AutoGen.ItemShippingInformation[_items.Count];
            _items.CopyTo(items, 0);

            for (int i = 0; i < items.Length; i++)
            {
                if (items[i].itemid.merchantitemid == itemID)
                {
                    throw new ApplicationException(
                              "Duplicate MerchantItemID added to the box'" + itemID + "'.");
                }
            }

            //The hash starts with G for google items and M for merchant items
            AutoGen.ItemShippingInformation item = null;

            string key = "M:" + itemID;

            if (!_lookup.TryGetValue(key, out item))
            {
                item = new AutoGen.ItemShippingInformation();

                AutoGen.ItemId lineItem = new GCheckout.AutoGen.ItemId();
                lineItem.merchantitemid = itemID;
                item.itemid             = lineItem;

                _lookup[key] = item;
            }
            AppendTracking(item);
            _items.Add(item);
        }
        /// <summary>
        /// The &lt;merchant-item-id&gt; tag contains a value, 
        /// such as a stock keeping unit (SKU), 
        /// that you use to uniquely identify an item.
        /// </summary>
        /// <param name="itemID">The item to add to the box</param>
        public void AddMerchantItemID(string itemID)
        {
            if (itemID == null || itemID.Length == 0)
            throw new ArgumentException("itemID must be valid length > 0.");

              AutoGen.ItemShippingInformation[] items
            = new AutoGen.ItemShippingInformation[_items.Count];
              _items.CopyTo(items, 0);

              for (int i = 0; i < items.Length; i++) {
            if (items[i].itemid.merchantitemid == itemID) {
              throw new ApplicationException(
            "Duplicate MerchantItemID added to the box'" + itemID + "'.");
            }
              }

              //The hash starts with G for google items and M for merchant items
              AutoGen.ItemShippingInformation item = null;

              string key = "M:" + itemID;

              if (!_lookup.TryGetValue(key, out item)) {

            item = new AutoGen.ItemShippingInformation();

            AutoGen.ItemId lineItem = new GCheckout.AutoGen.ItemId();
            lineItem.merchantitemid = itemID;
            item.itemid = lineItem;

            _lookup[key] = item;
              }
              AppendTracking(item);
              _items.Add(item);
        }
 /// <summary>
 /// Add a new item based on a MerchantItemID
 /// </summary>
 /// <param name="merchantItemID">
 /// The &lt;merchant-item-id&gt; tag contains a value,
 /// such as a stock keeping unit (SKU), 
 /// that you use to uniquely identify an item.
 /// </param>
 public void AddMerchantItemId(string merchantItemID)
 {
     AutoGen.ItemId item = new GCheckout.AutoGen.ItemId();
       item.merchantitemid = merchantItemID;
       _items.Add(item);
 }
 /// <summary>
 /// Add a new item based on a MerchantItemID
 /// </summary>
 /// <param name="merchantItemID">
 /// The &lt;merchant-item-id&gt; tag contains a value,
 /// such as a stock keeping unit (SKU),
 /// that you use to uniquely identify an item.
 /// </param>
 public void AddMerchantItemId(string merchantItemID)
 {
     AutoGen.ItemId item = new GCheckout.AutoGen.ItemId();
     item.merchantitemid = merchantItemID;
     _items.Add(item);
 }