Exemple #1
0
        public void SubmitItemsFeed(WalmartApi api,
                                    List <string> asinList,
                                    PublishedStatuses overrideStatus)
        {
            //api.GetFeedItems("5C8BE412C2754386B8BEEE11D968AE91@AQMBAQA");

            var feed = new WalmartItemsFeed(_log,
                                            _time,
                                            api,
                                            _dbFactory,
                                            AppSettings.WalmartFeedBaseDirectory,
                                            AppSettings.SwatchImageDirectory,
                                            AppSettings.SwatchImageBaseUrl,
                                            AppSettings.WalmartImageDirectory,
                                            AppSettings.WalmartImageBaseUrl);

            var steps = new StepSleeper(TimeSpan.FromMinutes(5), 1);

            var feedDto = feed.CheckFeedStatus(TimeSpan.FromHours(12));

            if (feedDto == null)
            {
                feed.SubmitFeed(asinList, overrideStatus);
            }

            //steps.NextStep();
        }
Exemple #2
0
        protected override void RunCallback()
        {
            var dbFactory    = new DbFactory();
            var time         = new TimeService(dbFactory);
            var log          = GetLogger();
            var settings     = new SettingsService(dbFactory);
            var htmlScraper  = new HtmlScraperService(log, time, dbFactory);
            var imageManager = new ImageManager(log, htmlScraper, dbFactory, time);

            var lastSyncDate = settings.GetListingsSendDate(_api.Market, _api.MarketplaceId);
            var pauseStatus  = settings.GetListingsSyncPause(_api.Market, _api.MarketplaceId) ?? false;

            LogWrite("Last sync date=" + lastSyncDate);

            if (pauseStatus)
            {
                LogWrite("Listings sync in pause");
                return;
            }

            if (!lastSyncDate.HasValue ||
                (time.GetUtcTime() - lastSyncDate) > _betweenProcessingInverval)
            {
                var feed = new WalmartItemsFeed(GetLogger(),
                                                time,
                                                _api,
                                                dbFactory,
                                                AppSettings.WalmartFeedBaseDirectory,
                                                AppSettings.SwatchImageDirectory,
                                                AppSettings.SwatchImageBaseUrl,
                                                AppSettings.WalmartImageDirectory,
                                                AppSettings.WalmartImageBaseUrl);

                var feedDto = feed.CheckFeedStatus(TimeSpan.FromHours(24));

                if (feedDto == null) //NOTE: no feed to check
                {
                    //NOTE: Update Image Types, to get right image
                    imageManager.UpdateStyleImageTypes();

                    feed.SubmitFeed();
                    settings.SetListingsSendDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId);
                }
            }
        }
Exemple #3
0
        public void SubmitItemsFeed(WalmartCAApi api, List <string> asinList, PublishedStatuses overrideItemStatus)
        {
            var feed = new WalmartItemsFeed(_log,
                                            _time,
                                            api,
                                            _dbFactory,
                                            AppSettings.WalmartFeedBaseDirectory,
                                            AppSettings.SwatchImageDirectory,
                                            AppSettings.SwatchImageBaseUrl,
                                            AppSettings.WalmartImageDirectory,
                                            AppSettings.WalmartImageBaseUrl);

            var steps = new StepSleeper(TimeSpan.FromMinutes(5), 1);

            var feedDto = feed.CheckFeedStatus(TimeSpan.Zero);

            if (feedDto == null)
            {
                feed.SubmitFeed(asinList, overrideItemStatus);
            }

            //steps.NextStep();
        }