UpdateInventoryEntry() public method

Updates an existing inventory entry with the new values Must have EditUri set to the location of the entry. Consider using AddLocalId with setEditUri=true for this.
public UpdateInventoryEntry ( Google.GData.ContentForShopping.InventoryEntry entry ) : Google.GData.ContentForShopping.InventoryEntry
entry Google.GData.ContentForShopping.InventoryEntry the entry to update
return Google.GData.ContentForShopping.InventoryEntry
Exemplo n.º 1
0
        private static void RunSample(string username, string password, string accountId,
                                      string language, string country, string productId,
                                      string storeCode)
            {
            // Connect to the service
            ContentForShoppingService service = new ContentForShoppingService("Inventory-Sample", accountId);
            service.setUserCredentials(username, password);

            // Create a new inventory entry
            InventoryEntry entry = new InventoryEntry();
            entry.Availability = "in stock";
            entry.Price = new Price("usd", "250.00");
            entry.Quantity = 1000;
            entry.SalePrice = new SalePrice("usd", "199.90");
            entry.SalePriceEffectiveDate = "2012-01-09 2012-01-13";

            // Add necessary EditUri
            bool setEditUri = true;
            entry = service.AddLocalId(entry, language, country, productId, storeCode, setEditUri);

            // Update the product we just constructed
            Console.WriteLine("Updating local product");
            InventoryEntry updated = service.UpdateInventoryEntry(entry);

            // Attempt a similar update via batch
            updated.Quantity = 900;
            updated.Price = new Price("usd", "240.00");

            updated = service.AddLocalId(updated, language, country, productId, storeCode);
            InventoryFeed feed = service.UpdateInventoryFeed(new List<InventoryEntry> {updated});

            // Display title and id for each local product
            Console.WriteLine("Listing all inventory returned");
            foreach (InventoryEntry m in feed.Entries) {
                Console.WriteLine("Locsl Product: " + m.Title.Text + " (" + m.EditUri + ")");
            }
        }