예제 #1
0
        private void ProcessOrderHistoryRequestsTick(object state)
        {
            if (!_historyRequestProcessing)
            {
                _historyRequestProcessing = true;

                try
                {
                    if (DateTime.Now.Hour >= 1 && DateTime.Now.Hour < 5)
                    {
                        while (DateTime.Now.Hour < 5)
                        {
                            System.Threading.Thread.Sleep(60000);
                        }
                    }

                    using (_historyRequestScope = _diContainer.BeginLifetimeScope())
                    {
                        IOrderHistoryRequestLogic requestLogic = _historyRequestScope.Resolve <IOrderHistoryRequestLogic>();

                        requestLogic.ProcessRequests();
                    }

                    _successfulHistoryConnection = true;
                    _unsentCount = 0;
                }
                catch (EarlySocketException earlyEx)
                {
                    HandleEarlySocketException(earlyEx, true);
                }
                catch (SocketResponseException responseEx)
                {
                    HandleSocketResponseException(responseEx, true);
                }
                catch (CancelledTransactionException cancelledEx)
                {
                    HandleCancelledException(cancelledEx);
                }
                catch (Exception ex)
                {
                    _log.WriteErrorLog("Error processing order update requests", ex);
                    ExceptionEmail.Send(ex);
                }

                _historyRequestProcessing = false;
            }
        }
예제 #2
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="shoppingCartLogic"></param>
 /// <param name="orderLogic"></param>
 /// <param name="shipDayRepo"></param>
 /// <param name="historyRequestLogic"></param>
 /// <param name="profileLogic"></param>
 /// <param name="exportSettingsLogic"></param>
 /// <param name="logRepo"></param>
 /// <param name="historyHeaderRepository"></param>
 /// <param name="orderHistoryLogic"></param>
 /// <param name="cartService"></param>
 public OrderController(IShoppingCartLogic shoppingCartLogic, IOrderLogic orderLogic, IShipDateRepository shipDayRepo, IListService listService, ICatalogLogic catalogLogic,
                        IOrderHistoryRequestLogic historyRequestLogic, IUserProfileLogic profileLogic, IExportSettingLogic exportSettingsLogic,
                        IEventLogRepository logRepo, IOrderHistoryHeaderRepsitory historyHeaderRepository, IOrderHistoryLogic orderHistoryLogic,
                        IShoppingCartService cartService) : base(profileLogic)
 {
     _historyRequestLogic = historyRequestLogic;
     _orderLogic          = orderLogic;
     _shipDayService      = shipDayRepo;
     _shoppingCartLogic   = shoppingCartLogic;
     _exportLogic         = exportSettingsLogic;
     _log = logRepo;
     _historyHeaderRepo   = historyHeaderRepository;
     _historyLogic        = orderHistoryLogic;
     _listService         = listService;
     _catalogLogic        = catalogLogic;
     _shoppingCartService = cartService;
 }