示例#1
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);
        }
        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 static StagingEbayItemModel CreateFrom(this StagingEbayItem source)
        {
            var hostURL = ConfigurationManager.AppSettings["HostURL"];

            var oModel = new StagingEbayItemModel
            {
                EbayItemtId            = source.EbayItemtId,
                EbayBatchImportId      = "<a  title='Click to see the batch detail'  target='_blank' href='" + hostURL + "Admin/BatchImportLV?vpek=" + source.EbayBatchImportId + "'>" + source.EbayBatchImportId + "</a>",
                EbayBatchImportIdValue = source.EbayBatchImportId,
                ToyGraderItemId        = source.ToyGraderItemId,
                CreatedBy  = string.IsNullOrEmpty(source.CreatedBy) ? "" : source.AspNetUserCreatedBy.FirstName + " " + source.AspNetUserCreatedBy.LastName,
                CreatedOn  = source.CreatedOn.ToShortDateString(),
                ModifiedBy = string.IsNullOrEmpty(source.ModifiedBy)?"":source.AspNetUserModifiedBy.FirstName + " " + source.AspNetUserModifiedBy.LastName,
                ModifiedOn = source.ModifiedOn != null?source.ModifiedOn.Value.ToShortDateString() : "",
                                 Deleted   = source.Deleted,
                                 DeletedOn = source.DeletedOn != null?source.DeletedOn.Value.ToShortDateString() : "",
                                                 DeletedBy   = source.DeletedBy,
                                                 Condition   = source.Condition,
                                                 CountryCode = source.CountryCode,
                                                 GalleryURL  = source.GalleryURL,
                                                 GlobalId    = source.GlobalId,
                                                 ItemId      = source.ItemId,
                                                 ListingInfoBuyItNowAvailable = Convert.ToBoolean(source.ListingInfoBuyItNowAvailable),
                                                 ListingInfoBuyItNowPrice     = source.ListingInfoBuyItNowPrice,
                                                 ListingInfoEndTime           = source.ListingInfoEndTime,
                                                 ListingInfoGift        = Convert.ToBoolean(source.ListingInfoGift),
                                                 ListingInfoListingType = source.ListingInfoListingType,
                                                 ListingInfoStartTime   =
                                                     source.ListingInfoStartTime != null?source.ListingInfoStartTime.Value.ToShortDateString() : "",
                                                         PrimaryCategory           = source.PrimaryCategory,
                                                         ProducitId                = source.ProducitId,
                                                         SecondaryCategory         = source.SecondaryCategory,
                                                         SellerInfoTopRatedSeller  = Convert.ToBoolean(source.SellerInfoTopRatedSeller),
                                                         SellingStatusBidCount     = source.SellingStatusBidCount,
                                                         SellingStatusCurrentPrice = source.SellingStatusCurrentPrice,
                                                         SellingStatusSellingState = source.SellingStatusSellingState,
                                                         SellingStatusTimeLeft     = source.SellingStatusTimeLeft,
                                                         StoreInfoStoreName        = source.StoreInfoStoreName,
                                                         StoreInfoStoreURL         = source.StoreInfoStoreURL,
                                                         StoreInfoStoreURLTag      = string.IsNullOrEmpty(source.StoreInfoStoreURL) ? "" : "<a href='" + source.StoreInfoStoreURL + "' target='_blank'><i class='fa fa-external-link'></i></a>",
                                                         AFASerial        = source.AFASerial,
                                                         SubTitle         = source.SubTitle,
                                                         Title            = "<a href='" + hostURL + "Admin/EbayItemImportDetail?vpek=" + source.EbayItemtId + "'>" + source.Title + "</a>",
                                                         TitleDescription = source.Title,
                                                         ViewItemUrlTag   = string.IsNullOrEmpty(source.ViewItemUrl) ? "" : "<a href='" + source.ViewItemUrl + "' target='_blank'><i class='fa fa-external-link'></i></a>",
                                                         ViewItemUrl      = source.ViewItemUrl,
                                                         ViewItemUrlLV    = string.IsNullOrEmpty(source.ViewItemUrl) ? "" : "<a href='" + source.ViewItemUrl + "' target='_blank'>Open</a>",
                                                         EbayItemDetails  = "<a href='" + hostURL + "Admin/EbayItemImportDetail?vpek=" + source.EbayItemtId + "'>Details</a>"
            };

            return(oModel);
        }
        private StagingEbayItem CreateStagingEbayItem(IStagingEbayLoadService stagingEbayLoadService, SearchItem ebaySearchItem, int batchId, DateTime ebayCheckTime, string userId)
        {
            StagingEbayItem stagingEbayItem = FindingServiceSearchItemMapper.SearchItemToStgEbayItem(ebaySearchItem);

            stagingEbayItem.EbayBatchImportId = batchId;
            //Set the created-on for staging ebay item record
            stagingEbayItem.CreatedOn = ebayCheckTime;
            stagingEbayItem.CreatedBy = userId;
            //Need to set the datetime to null because the default values are the start of time
            stagingEbayItem.DeletedOn  = null;
            stagingEbayItem.ModifiedOn = null;

            //Call service create ebay item method
            stagingEbayLoadService.CreateStagingEbayItem(stagingEbayItem, true);
            return(stagingEbayItem);
        }
        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++;
        }
示例#6
0
        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);
        }
 public bool EbayItemExists(string itemId, out StagingEbayItem item)
 {
     return(istgEbayItemRepository.EbayItemExists(itemId, out item));
 }