Google.GData.ContentForShopping.ContentForShoppingService.UpdateInventoryFeed C# (CSharp) Method

UpdateInventoryFeed() public method

takes a list of entries, adds update as the batch operation and updates them Must have Id set on each entry as the proper location. Consider using AddLocalId for this.
public UpdateInventoryFeed ( List entries ) : Google.GData.ContentForShopping.InventoryFeed
entries List the list of entries to update
return Google.GData.ContentForShopping.InventoryFeed
        public InventoryFeed UpdateInventoryFeed(List<InventoryEntry> entries) {
            return this.UpdateInventoryFeed(entries, this.accountId);
        }

Same methods

ContentForShoppingService::UpdateInventoryFeed ( List entries, string accountId ) : Google.GData.ContentForShopping.InventoryFeed

Usage Example

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 + ")");
            }
        }