public void ImportShopifyListings(IMarketApi api) { var itemSyncService = new ShopifyItemsImporter(_log, _time, _dbFactory, _styleHistoryService, null); itemSyncService.Import(api, null, ShopifyItemsImporter.ImportModes.Full, false, true, true, importDescription: false); }
protected override void RunCallback() { var dbFactory = new DbFactory(); var time = new TimeService(dbFactory); var log = GetLogger(); CompanyDTO company = null; using (var db = dbFactory.GetRDb()) { company = db.Companies.GetFirstWithSettingsAsDto(); } var settings = new SettingsService(dbFactory); var styleHistoryService = new StyleHistoryService(log, time, 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 ShopifyItemsImporter(log, time, dbFactory, styleHistoryService, null); var isImportDescription = company.ShortName != PortalEnum.HDEA.ToString() && company.ShortName != PortalEnum.BS.ToString(); itemSyncService.Import(_api, null, ShopifyItemsImporter.ImportModes.Full, processOnlyNewStyles: false, overrideStyleIds: true, overrideStyleTitles: true, importDescription: isImportDescription); settings.SetListingsReadDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId); } catch (Exception ex) { LogError(ex.Message, ex); } } }