protected override void RunCallback() { var dbFactory = new DbFactory(); var time = new TimeService(dbFactory); var settings = new SettingsService(dbFactory); var actionService = new SystemActionService(GetLogger(), time); var lastSyncDate = settings.GetOrdersCancellationDate(_api.Market, _api.MarketplaceId); _api.Connect(); using (var db = dbFactory.GetRWDb()) { LogWrite("Last sync date=" + lastSyncDate); if (!lastSyncDate.HasValue || (time.GetUtcTime() - lastSyncDate) > _betweenProcessingInverval) { var updater = new BaseOrderCancellation(_api, actionService, GetLogger(), time); updater.ProcessCancellations(db); settings.SetOrdersCancellationtDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId); } } }
protected override void RunCallback() { _api.Connect(); var dbFactory = new DbFactory(); var time = new TimeService(dbFactory); var settings = new SettingsService(dbFactory); var log = GetLogger(); using (var db = dbFactory.GetRWDb()) { var lastSyncDate = settings.GetOrdersFulfillmentDate(_api.Market, _api.MarketplaceId); LogWrite("Last sync date=" + lastSyncDate); if (!lastSyncDate.HasValue || (time.GetUtcTime() - lastSyncDate) > _betweenProcessingInverval) { var updater = new BaseOrderUpdater(_api, log, time); updater.UpdateOrders(db); settings.SetOrdersFulfillmentDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId); } } }