public void getAllInventoryItems() { AMZNHelper amznHelper = new AMZNHelper(); IDictionary<string, string> r1 = new Dictionary<string, String>(); r1["Action"] = "ListInventorySupply"; r1["SellerId"] = "A3FWGQLMG1AAXG"; r1["MarketplaceId"] = "ATVPDKIKX0DER"; r1["QueryStartDateTime"] = amznHelper.GetFormattedTimestamp(DateTime.Now.AddMonths(-6)); r1["Version"] = "2010-10-01"; MWSWebRequest wr = new MWSWebRequest(); string s = wr.getResponse("https://mws.amazonservices.com/FulfillmentInventory/2010-10-01", r1, false, true); var xDoc = XDocument.Parse(s); XElement xe = Util.stripNS(xDoc.Elements().First()); IEnumerable<XElement> InventoryMembers = xe.Descendants("member"); foreach (XElement member in InventoryMembers) { string asin = Util.tryGetElementValueString(member, "ASIN", true); string SellerSKU = Util.tryGetElementValueString(member, "SellerSKU", true); string fnsku = Util.tryGetElementValueString(member, "FNSKU", true); InventoryMember i = new InventoryMember(asin, fnsku, SellerSKU); DataStore.Upsert_Inventory(i); } return; }
public void TestDataStore() { InventoryMember i = new InventoryMember("x", "y", "z"); DataStore.Upsert_Inventory(i); InventoryMember i2 = DataStore.getInventoryByAsin(i.ASIN); Assert.IsNotNull(i2); Assert.AreEqual(i2.FNSKU, i.FNSKU); Product p = new Product("z", "a"); Product p2 = DataStore.getProductByAsin(p.ASIN); }
public static void Upsert_Product(Product p) { loadFiles(); lock (Products) { Products[p.ASIN] = p; if (Inventory.ContainsKey(p.ASIN)) { InventoryMember inv = Inventory[p.ASIN]; var label = new FNSkuLabel(inv.ASIN, inv.FNSKU, p.Title, "New", 1, 3); if (Labels.Contains(label)) { Labels.Remove(label); } Labels.Add(label); } } saveProduct(); }
public static void Upsert_Inventory(InventoryMember inv) { loadFiles(); lock (Inventory) { Inventory[inv.ASIN] = inv; if (Products.ContainsKey(inv.ASIN)) { Product p = Products[inv.ASIN]; var label = new FNSkuLabel(inv.ASIN, inv.FNSKU, p.Title, "New", 1, 3); if (Labels.Contains(label)) { Labels.Remove(label); } Labels.Add(label); } } saveInventory(); }
public void getAllInventoryItems() { AMZNHelper amznHelper = new AMZNHelper(); IDictionary <string, string> r1 = new Dictionary <string, String>(); r1["Action"] = "ListInventorySupply"; r1["SellerId"] = "A3FWGQLMG1AAXG"; r1["MarketplaceId"] = "ATVPDKIKX0DER"; r1["QueryStartDateTime"] = amznHelper.GetFormattedTimestamp(DateTime.Now.AddMonths(-6)); r1["Version"] = "2010-10-01"; MWSWebRequest wr = new MWSWebRequest(); string s = wr.getResponse("https://mws.amazonservices.com/FulfillmentInventory/2010-10-01", r1, false, true); var xDoc = XDocument.Parse(s); XElement xe = Util.stripNS(xDoc.Elements().First()); IEnumerable <XElement> InventoryMembers = xe.Descendants("member"); foreach (XElement member in InventoryMembers) { string asin = Util.tryGetElementValueString(member, "ASIN", true); string SellerSKU = Util.tryGetElementValueString(member, "SellerSKU", true); string fnsku = Util.tryGetElementValueString(member, "FNSKU", true); InventoryMember i = new InventoryMember(asin, fnsku, SellerSKU); DataStore.Upsert_Inventory(i); } return; }