public void CreateStagingEbayItem(StagingEbayItem item, bool commit = false)
 {
     var newStagingEbayItem = istgEbayItemRepository.Create();
     istgEbayItemRepository.LoadStagingEbayItemToRepositoryObjectForCreate(item, ref newStagingEbayItem);
     istgEbayItemRepository.Add(newStagingEbayItem);
     if (commit)
     {
         istgEbayItemRepository.SaveChanges();
     }
 }
 public bool EbayItemExists(string itemId, out StagingEbayItem item)
 {
     return istgEbayItemRepository.EbayItemExists(itemId, out item);
 }
        private void UpdateCounts(StagingEbayItem stagingEbayItem, StagingEbayBatchImport stagingEbayBatchImport)
        {
            /***ebay Listing Type values
                **AdFormat
                    * Advertisement to solicit inquiries on listings such as real estate. Permits no bidding on that item, service, or property. To express interest, a buyer fills out a contact form that eBay forwards to the seller as a lead. This format does not enable buyers and sellers to transact online through eBay and eBay Feedback is not available for ad format listings.
                **Auction
                    * Competitive-bid on-line auction format. Buyers engage in competitive bidding, although Buy It Now may be offered as long as no valid bids have been placed. Online auctions are listed on eBay.com; they can also be listed in a seller's eBay Store if the seller is a Store owner.
                **AuctionsWithBIN
                    * Same as Auction format, but Buy It Now is enabled. AuctionsWithBIN changes to Auction if a valid bid has been placed on the item. Valid bids include bids that are equal to or above any specified reserve price.
                **Classified
                    * Classified Ads connect buyers and sellers, who then complete the sale outside of eBay. This format does not enable buyers and sellers to transact online through eBay and eBay Feedback is not available for these listing types.
                **FixedPrice
                * A fixed-price listing. Auction-style bidding is not allowed. On some sites, this auction format is also known as "Buy It Now Only" (not to be confused with the Buy It Now option available with competitive- bidding auctions). Fixed-price listings appear on eBay.com; they can also be listed in a seller's eBay Store if the seller is a Store owner.
            ***/
            switch (stagingEbayItem.ListingInfoListingType.ToLower())
            {
                case EbayListingTypeAuctionInLower:
                    stagingEbayBatchImport.Auctions++;
                    break;
                case EbayListingTypeAuctionWithBinInLower:
                    stagingEbayBatchImport.AuctionsWithBIN++;
                    break;
                case EbayListingTypeClassifiedInLower:
                    stagingEbayBatchImport.Classified++;
                    break;
                case EbayListingTypeFixedPriceInLower:
                    stagingEbayBatchImport.FixedPrice++;
                    break;
                case EbayListingTypeStoreInventory:
                    stagingEbayBatchImport.StoreInventory++;
                    break;
            }

            stagingEbayBatchImport.Imported++;
        }
        public static StagingEbayItem SearchItemToStgEbayItem(SearchItem ebayItem)
        {
            StagingEbayItem stgItem = new StagingEbayItem();
            //Condition
            if (ebayItem.condition != null && ebayItem.condition.conditionIdSpecified)
            {
                stgItem.Condition = ebayItem.condition.conditionDisplayName;
            }
            stgItem.CountryCode = ebayItem.country;
            stgItem.GalleryURL = ebayItem.galleryURL;
            stgItem.GlobalId = ebayItem.globalId;
            stgItem.ItemId = ebayItem.itemId;
            //Listing Information
            if (ebayItem.listingInfo != null)
            {
                ListingInfo listingInfo = ebayItem.listingInfo;
                if (listingInfo.buyItNowAvailableSpecified)
                {
                    stgItem.ListingInfoBuyItNowAvailable = listingInfo.buyItNowAvailable;
                    if (listingInfo.buyItNowPrice != null)
                    {
                        stgItem.ListingInfoBuyItNowPrice = Convert.ToDecimal(listingInfo.buyItNowPrice.Value);
                    }
                }
                else
                {
                    stgItem.ListingInfoBuyItNowAvailable = false;
                }
                if (listingInfo.endTimeSpecified)
                {
                    stgItem.ListingInfoEndTime = listingInfo.endTime;
                }
                if (listingInfo.giftSpecified)
                {
                    stgItem.ListingInfoGift = listingInfo.gift;
                }
                stgItem.ListingInfoListingType = listingInfo.listingType;
                if (listingInfo.startTimeSpecified)
                {
                    stgItem.ListingInfoStartTime = listingInfo.startTime;
                }
            }
            if(ebayItem.primaryCategory != null)
            {
                stgItem.PrimaryCategory = ebayItem.primaryCategory.categoryName;
            }
            if(ebayItem.productId != null)
            {
                stgItem.ProducitId = ebayItem.productId.Value;
            }
            if(ebayItem.secondaryCategory != null)
            {
                stgItem.SecondaryCategory = ebayItem.secondaryCategory.categoryName;
            }
            if (ebayItem.sellerInfo != null)
            {
                stgItem.SellerInfoTopRatedSeller = ebayItem.sellerInfo.topRatedSellerSpecified &&
                                                   ebayItem.sellerInfo.topRatedSeller;
            }
            //Selling Status
            if (ebayItem.sellingStatus != null)
            {
                SellingStatus sellingStatus = ebayItem.sellingStatus;
                if (sellingStatus.bidCountSpecified)
                {
                    stgItem.SellingStatusBidCount = sellingStatus.bidCount;
                }
                if (sellingStatus.currentPrice != null)
                {
                    stgItem.SellingStatusCurrentPrice = Convert.ToDecimal(sellingStatus.currentPrice.Value);
                }
                stgItem.SellingStatusSellingState = sellingStatus.sellingState;
                stgItem.SellingStatusTimeLeft = sellingStatus.timeLeft;
            }
            //Store Info
            if (ebayItem.storeInfo != null)
            {
                Storefront storefront = ebayItem.storeInfo;
                stgItem.StoreInfoStoreName = storefront.storeName;
                stgItem.StoreInfoStoreURL = storefront.storeURL;
            }
            stgItem.SubTitle = ebayItem.subtitle;
            stgItem.Title = ebayItem.title;
            stgItem.ViewItemUrl = ebayItem.viewItemURL;

            return stgItem;
        }
Esempio n. 5
0
        /// <summary>
        /// Calls the database stored procedure spIsEbayLoadRunning
        /// Check if an ebay load is already running, return the count of IsProcessing records in the database
        /// </summary>
        /// <returns>true if load is running, otherwise false</returns>
        public bool EbayItemExists(string itemId, out StagingEbayItem item)
        {
            ObjectResult<StagingEbayItem> results = ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<StagingEbayItem>("spEbayItemExists", new [] { new ObjectParameter("itemId", itemId) });

            item = results.FirstOrDefault();

            return item != null;
        }