protected override void RunCallback() { var dbFactory = new DbFactory(); var time = new TimeService(dbFactory); var log = GetLogger(); var settings = new SettingsService(dbFactory); var lastSyncDate = settings.GetListingsReadDate(_api.Market, _api.MarketplaceId); LogWrite("Last sync date=" + lastSyncDate); if (!lastSyncDate.HasValue || (time.GetUtcTime() - lastSyncDate) > _betweenProcessingInverval) { try { var itemSyncService = new WooCommerceItemsImporter(log, time, dbFactory); itemSyncService.Import(_api); settings.SetListingsReadDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId); } catch (Exception ex) { LogError(ex.Message, ex); } } }
public void ImportListings(IMarketApi api) { var itemSyncService = new WooCommerceItemsImporter(_log, _time, _dbFactory); itemSyncService.Import(api); }