Exemplo n.º 1
0
        public CallMessagesResult <bool> UpdateFeed(ILogService log,
                                                    ITime time,
                                                    IDbFactory dbFactory,
                                                    ISystemActionService actionService,
                                                    IItemHistoryService itemHistoryService,
                                                    long companyId)
        {
            var sourceFeed = Path.Combine(UrlHelper.GetImportCatalogFeedPath(), FileName);

            var marketplaceManager = new MarketplaceKeeper(dbFactory, false);

            marketplaceManager.Init();

            IWalmartApi api = (IWalmartApi) new MarketFactory(marketplaceManager.GetAll(), time, log, dbFactory, null)
                              .GetApi(companyId, MarketType.WalmartCA, null);

            var service = new WalmartListingInfoReader(log, time, api, dbFactory, actionService, itemHistoryService, null, null);

            service.UpdateListingInfo(sourceFeed);

            return(new CallMessagesResult <bool>()
            {
                Data = true
            });
        }
        protected override void RunCallback()
        {
            var dbFactory          = new DbFactory();
            var time               = new TimeService(dbFactory);
            var log                = GetLogger();
            var settings           = new SettingsService(dbFactory);
            var systemAction       = new SystemActionService(log, time);
            var itemHistoryService = new ItemHistoryService(log, time, dbFactory);
            var lastSyncDate       = settings.GetListingsReadDate(_api.Market, _api.MarketplaceId);

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

            var walmartReader = new WalmartListingInfoReader(GetLogger(),
                                                             time,
                                                             _api,
                                                             dbFactory,
                                                             systemAction,
                                                             itemHistoryService,
                                                             AppSettings.WalmartReportBaseDirectory,
                                                             AppSettings.WalmartFeedBaseDirectory);

            if (!lastSyncDate.HasValue ||
                (time.GetUtcTime() - lastSyncDate) > _betweenProcessingInverval)
            {
                walmartReader.UpdateListingInfo();
                walmartReader.ReadListingInventory();

                walmartReader.ResetQtyForNotExistListings();
                walmartReader.RetireNotExistListings();

                settings.SetListingsReadDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId);
            }
        }
Exemplo n.º 3
0
        public void ResetNotExistListingQty(IWalmartApi api, string overrideReportPath)
        {
            var service = new WalmartListingInfoReader(_log, _time, api, _dbFactory,
                                                       _actionService,
                                                       _itemHistoryService,
                                                       AppSettings.WalmartReportBaseDirectory,
                                                       AppSettings.WalmartFeedBaseDirectory);

            service.ResetQtyForNotExistListings(overrideReportPath);
        }
Exemplo n.º 4
0
        public void UpdateListingInfo(WalmartCAApi api, string reportPath)
        {
            var service = new WalmartListingInfoReader(_log, _time, api, _dbFactory,
                                                       _actionService,
                                                       _itemHistoryService,
                                                       AppSettings.WalmartReportBaseDirectory,
                                                       AppSettings.WalmartFeedBaseDirectory);

            service.UpdateListingInfo(reportPath);
        }
Exemplo n.º 5
0
        public void FindSecondDayFlagDisparity(IWalmartApi api, string overrideFeedpath)
        {
            var service = new WalmartListingInfoReader(_log, _time, api, _dbFactory,
                                                       _actionService,
                                                       _itemHistoryService,
                                                       AppSettings.WalmartReportBaseDirectory,
                                                       AppSettings.WalmartFeedBaseDirectory);

            service.FindSecondDayFlagDisparity(overrideFeedpath);
        }
Exemplo n.º 6
0
        public void RetireNotExistListings(IWalmartApi api)
        {
            var service = new WalmartListingInfoReader(_log, _time, api, _dbFactory,
                                                       _actionService,
                                                       _itemHistoryService,
                                                       AppSettings.WalmartReportBaseDirectory,
                                                       AppSettings.WalmartFeedBaseDirectory);

            service.RetireNotExistListings();
        }