Exemple #1
0
        protected override void RunCallback()
        {
            var dbFactory     = new DbFactory();
            var time          = new TimeService(dbFactory);
            var settings      = new SettingsService(dbFactory);
            var log           = GetLogger();
            var actionService = new SystemActionService(log, 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 GrouponOrderCancellation(_api, actionService, log, time);
                    updater.ProcessCancellations(db);
                    settings.SetOrdersCancellationtDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId);
                }
            }
        }
        protected override void RunCallback()
        {
            var dbFactory = new DbFactory();
            var time      = new TimeService(dbFactory);
            var settings  = new SettingsService(dbFactory);

            var lastSyncDate = settings.GetOrdersAcknowledgementDate(_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 GrouponOrderAcknowledgement(_api, GetLogger(), time);
                    updater.UpdateOrders(db);
                    settings.SetOrdersAcknowledgementDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId);
                }
            }
        }