コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: hydrohead/MWSZonBarcode
        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);
        }
コード例 #3
0
ファイル: UnitTest1.cs プロジェクト: hankover/MWSZonBarcode
        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);
        }
コード例 #4
0
ファイル: DataStore.cs プロジェクト: hankover/MWSZonBarcode
        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();
        }
コード例 #5
0
ファイル: DataStore.cs プロジェクト: hankover/MWSZonBarcode
        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();
        }
コード例 #6
0
        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;
        }
コード例 #7
0
ファイル: DataStore.cs プロジェクト: hydrohead/MWSZonBarcode
        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();
        }