Exemplo n.º 1
0
 /// <remarks/>
 public void findItemsByKeywordsAsync(FindItemsByKeywordsRequest findItemsByKeywordsRequest) {
     this.findItemsByKeywordsAsync(findItemsByKeywordsRequest, null);
 }
Exemplo n.º 2
0
 /// <remarks/>
 public void findItemsByKeywordsAsync(FindItemsByKeywordsRequest findItemsByKeywordsRequest, object userState) {
     if ((this.findItemsByKeywordsOperationCompleted == null)) {
         this.findItemsByKeywordsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnfindItemsByKeywordsOperationCompleted);
     }
     this.InvokeAsync("findItemsByKeywords", new object[] {
                 findItemsByKeywordsRequest}, this.findItemsByKeywordsOperationCompleted, userState);
 }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // on page load

            if (!IsPostBack)
            {

                // if a user is logged in show their username
                if (Context.User.Identity.IsAuthenticated == true)
                {
                    loginLink.Text = "(" + Context.User.Identity.Name + ") Log Out";
                }

                // Show how many items are in the cart
                ShoppingCart cart = (ShoppingCart)Session["MyShoppingCart"];
                cartLink.Text = "Shopping Cart (" + cart.CartCount() + ")";

                // create a new ebay service request object
                CustomFindService service = new CustomFindService();
                service.Url = "http://svcs.ebay.com/services/search/FindingService/v1";

                FindItemsByKeywordsRequest request = new FindItemsByKeywordsRequest();
                request.keywords = "exercise, fitness, running";

                PaginationInput pagination = new PaginationInput();
                pagination.entriesPerPageSpecified = true;
                pagination.entriesPerPage = 50;
                pagination.pageNumberSpecified = true;
                pagination.pageNumber = 1;
                request.paginationInput = pagination;

                try
                {
                    // get results from ebay seach
                    FindItemsByKeywordsResponse response = service.findItemsByKeywords(request);
                    SearchResult result = response.searchResult;

                    // fill a datatable with the gathered info
                    DataSet ds = new DataSet(); ;
                    ds.Tables.Add("Listing");
                    DataTable table = ds.Tables["Listing"];

                    table.Columns.Add("item_id");
                    table.Columns.Add("image");
                    table.Columns.Add("title");
                    table.Columns.Add("price");

                    foreach (SearchItem item in result.item)
                    {
                        if (item.listingInfo.buyItNowAvailable)
                        {
                            DataRow rw = table.NewRow();
                            rw["item_id"] = item.itemId;
                            rw["title"] = item.title;
                            rw["image"] = "<img src=" + item.galleryURL + " />";
                            rw["price"] = item.listingInfo.buyItNowPrice.Value.ToString("C");
                            table.Rows.Add(rw);
                        }
                    }

                    // add the datatable to the grid
                    ProductListings.DataSource = ds;
                    ProductListings.DataBind();
                }
                catch (Exception)
                {
                }
            }
        }