Example #1
0
        public void GetItemBySku(JetApi api)
        {
            var sku  = "MK210-4T";
            var item = api.GetProduct(sku);

            _log.Info(item.ToString());
        }
Example #2
0
        public void VerifyApiTestHookSetsApi()
        {
            var newImpl = new JetApi();

            using (new ApiTestHook(newImpl))
            {
                Assert.AreSame(Api.Impl, newImpl);
            }
        }
Example #3
0
        public void GetOrders(JetApi api)
        {
            var orders = api.GetOrders(_log, DateTime.Now.AddDays(-7), new List <string>()
            {
                OrderStatusEnumEx.Pending
            });

            _log.Info("GetOrders: " + orders.Count());
        }
Example #4
0
 public void CallCompleteReturns(JetApi api)
 {
     using (var db = _dbFactory.GetRWDb())
     {
         var actionService = new SystemActionService(_log, _time);
         var service       = new BaseOrderRefundService(api, actionService, _emailService, _log, _time);
         service.ProcessRefunds(db, null);
     }
 }
 public JetOrderCancellation(JetApi api,
                             ISystemActionService actionService,
                             ILogService log,
                             ITime time)
 {
     _api           = api;
     _log           = log;
     _time          = time;
     _actionService = actionService;
 }
Example #6
0
 public UpdateJetListingQtyThread(JetApi api,
                                  long companyId,
                                  ISystemMessageService messageService,
                                  TimeSpan?callbackInterval,
                                  TimeSpan betweenProcessingInverval)
     : base("UpdateJetListingQty", companyId, messageService, callbackInterval)
 {
     _api = api;
     _betweenProcessingInverval = betweenProcessingInverval;
 }
 public UpdateJetOrderAcknowledgmentDataThread(JetApi api,
                                               long companyId,
                                               ISystemMessageService messageService,
                                               TimeSpan?callbackInterval,
                                               TimeSpan betweenProcessingInverval)
     : base("UpdateJetOrderAcknowledgment", companyId, messageService, callbackInterval)
 {
     _api = api;
     _betweenProcessingInverval = betweenProcessingInverval;
 }
Example #8
0
        public void SubmitInventory(JetApi api)
        {
            var sync = new JetItemsSync(_log,
                                        _time,
                                        api,
                                        _dbFactory,
                                        AppSettings.JetImageDirectory,
                                        AppSettings.JetImageBaseUrl);

            sync.SendInventoryUpdates();
        }
Example #9
0
        public void VerifyDisposingApiTestHookResetsApi()
        {
            var oldImpl = Api.Impl;
            var newImpl = new JetApi();

            using (new ApiTestHook(newImpl))
            {
            }

            Assert.AreSame(Api.Impl, oldImpl);
        }
 public JetOrderReturn(JetApi api,
                       ISystemActionService actionService,
                       IEmailService emailService,
                       ILogService log,
                       ITime time)
 {
     _api           = api;
     _log           = log;
     _time          = time;
     _actionService = actionService;
     _emailService  = emailService;
 }
Example #11
0
        public JetItemsSync(ILogService log,
                            ITime time,
                            JetApi api,
                            IDbFactory dbFactory,
                            string jetImageDirectory,
                            string jetImageBaseUrl)
        {
            _log       = log;
            _time      = time;
            _api       = api;
            _dbFactory = dbFactory;

            _jetImageDirectory = jetImageDirectory;
            _jetImageBaseUrl   = jetImageBaseUrl;
        }
        /// <summary>
        /// The proxy callback function to call the user-defined managed delegate.
        /// </summary>
        /// <param name="instance">
        /// The instance.
        /// </param>
        /// <param name="commitIdSeen">
        /// The commit-id flushed.
        /// </param>
        /// <param name="grbit">
        /// Reserved currently.
        /// </param>
        /// <returns>
        /// An error code.
        /// </returns>
        private JET_err NativeDurableCommitCallback(
            IntPtr instance,
            ref NATIVE_COMMIT_ID commitIdSeen,
            uint grbit)
        {
            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                JET_INSTANCE jetInstance = new JET_INSTANCE()
                {
                    Value = instance
                };

                if (this.instance != jetInstance)
                {
                    // We assume it's only called on one instance at a time. The only thing
                    // we really care about is serialization of the byte array.
                    //
                    // It would be nice to throw an error, but we're going back to real
                    // code, which doesn't deal with managed exceptions well.
                    return(JET_err.CallbackFailed);
                }

                JET_COMMIT_ID commitId = new JET_COMMIT_ID(commitIdSeen);

                return(this.wrappedCallback(jetInstance, commitId, (DurableCommitCallbackGrbit)grbit));
            }
            catch (Exception ex)
            {
                Trace.WriteLineIf(
                    TraceSwitch.TraceWarning, string.Format(CultureInfo.InvariantCulture, "Caught Exception {0}", ex));

                JetApi.ReportUnhandledException(ex, "Unhandled exception during NativeDurableCommitCallback");

                // This should never be executed, but the compiler doesn't know it.
                return(JET_err.CallbackFailed);
            }
        }
Example #13
0
        public CallJetProcessing(ILogService log,
                                 ITime time,
                                 ICacheService cacheService,
                                 IDbFactory dbFactory,
                                 IEmailService emailService,
                                 JetApi jetApi,
                                 CompanyDTO company)
        {
            _log          = log;
            _time         = time;
            _dbFactory    = dbFactory;
            _cacheService = cacheService;
            _jetApi       = jetApi;
            _company      = company;
            _emailService = emailService;

            var itemHistoryService = new ItemHistoryService(_log, _time, _dbFactory);

            _actionService            = new SystemActionService(_log, _time);
            _htmlScraper              = new HtmlScraperService(log, time, dbFactory);
            _barcodeService           = new BarcodeService(log, _time, _dbFactory);
            _autoCreateListingService = new AutoCreateNonameListingService(_log, _time, dbFactory, cacheService, _barcodeService, _emailService, itemHistoryService, AppSettings.IsDebug);
        }
 public JetOrderAcknowledgement(JetApi api, ILogService log, ITime time)
 {
     _api  = api;
     _log  = log;
     _time = time;
 }
 public void VerifyGetActualSizeThrowsExceptionOnOverflow()
 {
     int ignored = JetApi.GetActualSize(uint.MaxValue);
 }
Example #16
0
 public void VerifyGetActualBookmarkSizeReturnsZeroForDebugFill()
 {
     Assert.AreEqual(0, JetApi.GetActualBookmarkSize(0xDDDDDDDD));
 }
Example #17
0
 public void VerifyGetActualBookmarkSizeThrowsExceptionOnOverflow()
 {
     int ignored = JetApi.GetActualBookmarkSize(UInt32.MaxValue);
 }
Example #18
0
 public void VerifyGetActualBookmarkSizeReturnsPositiveNumber()
 {
     Assert.AreEqual(17, JetApi.GetActualBookmarkSize(17U));
 }
Example #19
0
 public void VerifyGetActualBookmarkSizeReturnsZeroForZero()
 {
     Assert.AreEqual(0, JetApi.GetActualBookmarkSize(0U));
 }
 public JetOrderUpdater(JetApi api, ILogService log, ITime time)
 {
     _api  = api;
     _log  = log;
     _time = time;
 }