Пример #1
0
 public void CallOrderAcknowledgement()
 {
     using (var db = _dbFactory.GetRWDb())
     {
         var service = new WalmartOrderAcknowledgement(_walmartCAApi, _log, _time);
         service.UpdateOrders(db);
     }
 }
        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);

            using (var db = dbFactory.GetRWDb())
            {
                LogWrite("Last sync date=" + lastSyncDate);

                if (!lastSyncDate.HasValue ||
                    (time.GetUtcTime() - lastSyncDate) > _betweenProcessingInverval)
                {
                    var updater = new WalmartOrderAcknowledgement(_api, GetLogger(), time);
                    updater.UpdateOrders(db);
                    settings.SetOrdersAcknowledgementDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId);
                }
            }
        }