Beispiel #1
0
        private void Import_Click(object sender, RoutedEventArgs e)
        {
            var toProcess = Sheets.GetToProcessSheet();

            // Define the URL to request the list feed of the worksheet.
            AtomLink listFeedLink = toProcess.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null);

            // Fetch the list feed of the worksheet.
            ListQuery listQuery = new ListQuery(listFeedLink.HRef.ToString());
            ListFeed listFeed = Sheets.GetSpreadsheetService().Query(listQuery);

            _sellables.Clear();
            foreach (var entry in listFeed.Entries.OfType<ListEntry>())
            {
                if (entry.Elements[(int)ToProcessSheetColumns.BundleID].Value != "")
                {
                    int bundleId = int.Parse(entry.Elements[(int)ToProcessSheetColumns.BundleID].Value);
                    var bundle = _sellables.OfType<BundleToSell>().FirstOrDefault(x => x.BundleId == bundleId);
                    if (bundle == null)
                    {
                        bundle = new BundleToSell { BundleId = bundleId };
                        _sellables.Add(bundle);
                    }
                    bundle.Games.Add(new GameToSell(entry));
                }
                else
                {
                    _sellables.Add(new GameToSell(entry));
                }
            }

            // Define the URL to request the list feed of the worksheet.
            listFeedLink = Sheets.GetProcessedSheet().Links.FindService(GDataSpreadsheetsNameTable.ListRel, null);

            // Fetch the list feed of the worksheet.
            listQuery = new ListQuery(listFeedLink.HRef.ToString());
            listFeed = Sheets.GetSpreadsheetService().Query(listQuery);

            var ebay = new EbayAccess();

            foreach (var entry in listFeed.Entries.OfType<ListEntry>())
            {
                if (string.IsNullOrEmpty(entry.Elements[3].Value))
                {
                    EbayAccess.ListingInfo info;
                    ebay.GetListingInfo(live, entry.Elements[2].Value, out info);
                    if (info.ViewUrl != null)
                    {
                        entry.Elements[3].Value = info.ViewUrl;
                    }
                    else
                    {
                        entry.Elements[3].Value = "Error getting URL!";
                    }
                    entry.Update();
                }
            }
        }
Beispiel #2
0
        private void Import_Click(object sender, RoutedEventArgs e)
        {
            // Define the URL to request the list feed of the worksheet.
            AtomLink listFeedLink = Sheets.GetProcessedSheet().Links.FindService(GDataSpreadsheetsNameTable.ListRel, null);

            // Fetch the list feed of the worksheet.
            ListQuery listQuery = new ListQuery(listFeedLink.HRef.ToString());
            ListFeed listFeed = Sheets.GetSpreadsheetService().Query(listQuery);

            foreach (var entry in listFeed.Entries.OfType<ListEntry>())
            {
                _games.Add(new ListedGame(entry));
            }

            // Define the URL to request the list feed of the worksheet.
            listFeedLink = Sheets.GetProcessedSheet().Links.FindService(GDataSpreadsheetsNameTable.ListRel, null);

            // Fetch the list feed of the worksheet.
            listQuery = new ListQuery(listFeedLink.HRef.ToString());
            listFeed = Sheets.GetSpreadsheetService().Query(listQuery);

            var ebay = new EbayAccess();

            foreach (var entry in listFeed.Entries.OfType<ListEntry>())
            {
                if (string.IsNullOrEmpty(entry.Elements[3].Value))
                {
                    EbayAccess.ListingInfo info;
                    ebay.GetListingInfo(ToProcess.live, entry.Elements[2].Value, out info);
                    if (info.ViewUrl != null)
                    {
                        entry.Elements[3].Value = info.ViewUrl;
                    }
                    else
                    {
                        entry.Elements[3].Value = "Error getting URL!";
                    }
                    entry.Update();
                }
            }
        }