public SpecialOrderLogicImpl(IUnitOfWork unitOfWork, IEventLogRepository log, IGenericQueueRepository queue,
                                     IGenericSubscriptionQueueRepository genericSubscriptionQueue,
                                     IOrderHistoryDetailRepository detailRepo, IOrderHistoryHeaderRepsitory headerRepo,
                                     ICustomerRepository customerRepository, IMessageTemplateLogic messageTemplateLogic,
                                     IDsrLogic dsrLogic, IUserProfileLogic userProfileLogic,
                                     IUserMessagingPreferenceRepository userMessagingPreferenceRepository,
                                     IUserPushNotificationDeviceRepository userPushNotificationDeviceRepository,
                                     Func <Channel, IMessageProvider> messageProviderFactory)
        {
            _unitOfWork = unitOfWork;
            _log        = log;
            _queue      = queue;
            _genericSubscriptionQueue = genericSubscriptionQueue;
            _keepListening            = true;
            _headerRepo           = headerRepo;
            _detailRepo           = detailRepo;
            _customerRepository   = customerRepository;
            _messageTemplateLogic = messageTemplateLogic;
            _dsrLogic             = dsrLogic;
            _userProfileLogic     = userProfileLogic;
            _userMessagingPreferenceRepository    = userMessagingPreferenceRepository;
            _userPushNotificationDeviceRepository = userPushNotificationDeviceRepository;
            _messageProviderFactory = messageProviderFactory;

            // subscribe to event to receive message through subscription
            _genericSubscriptionQueue.MessageReceived += GenericSubscriptionQueue_MessageReceived;
        }
 public AccessRequestLogicImpl(IGenericQueueRepository queueRepo, IKbitRequestLogic KbitRequestLogic, IEventLogRepository logRepo, IPowerMenuLogic pmLogic)
 {
     _kbitLogic          = KbitRequestLogic;
     _pmLogic            = pmLogic;
     _keepQueueListening = true;
     _log   = logRepo;
     _queue = queueRepo;
 }
Beispiel #3
0
        public OrderQueueLogicImpl(IEventLogRepository eventLog, IGenericQueueRepository orderQueue, IOrderSocketConnectionRepository mfCon, ISpecialOrderRepository specialOrder)
        {
            _log          = eventLog;
            _mfConnection = mfCon;
            _orderQueue   = orderQueue;
            _specialOrder = specialOrder;

            AllowOrderProcessing = true;
        }
Beispiel #4
0
 public ContractListChangesLogicImpl(ICatalogLogic catalogLogic, ICustomerRepository customerRepository,
                                     IEventLogRepository eventLogRepository, IGenericQueueRepository queueRepository, IContractChangesRepository contractChangesRepo,
                                     IMessageTemplateLogic messageTemplateLogic)
 {
     _catalogLogic         = catalogLogic;
     _customerRepo         = customerRepository;
     _log                  = eventLogRepository;
     _queueRepo            = queueRepository;
     _contractChangesRepo  = contractChangesRepo;
     _messageTemplateLogic = messageTemplateLogic;
 }
Beispiel #5
0
        public NotificationQueueConsumerImpl(IEventLogRepository eventLogRepository, IGenericQueueRepository genericQueueRepository,
                                             Func <NotificationType, INotificationHandler> notificationHandlerFactory, IUnitOfWork unitOfWork,
                                             IGenericSubscriptionQueueRepository genericSubscriptionQueue)
        {
            this.eventLogRepository         = eventLogRepository;
            this.genericQueueRepository     = genericQueueRepository;
            this.genericSubscriptionQueue   = genericSubscriptionQueue;
            this.notificationHandlerFactory = notificationHandlerFactory;
            this._uow = unitOfWork;

            this.genericSubscriptionQueue.MessageReceived += GenericSubscriptionQueue_MessageReceived;
        }
Beispiel #6
0
        public PushMessageConsumerImpl(IEventLogRepository eventLogRepository,
                                       IGenericSubscriptionQueueRepository genericSubscriptionQueue,
                                       IGenericQueueRepository genericQueueRepository, IPushNotificationMessageProvider pushMessageProvider)
        {
            _eventLogRepository       = eventLogRepository;
            _genericQueueRepository   = genericQueueRepository;
            _genericSubscriptionQueue = genericSubscriptionQueue;
            _pushMessageProvider      = pushMessageProvider;

            // subscribe to event to receive message through subscription
            _genericSubscriptionQueue.MessageReceived += GenericSubscriptionQueue_MessageReceived;
        }
Beispiel #7
0
        public ConfirmationLogicImpl(IEventLogRepository eventLogRepository, ISocketListenerRepository socketListenerRepository, IGenericQueueRepository internalMessagingLogic,
                                     IOrderConversionLogic conversionLogic, IUnitOfWork unitOfWork, IGenericSubscriptionQueueRepository subscriptionQueue)
        {
            _log    = eventLogRepository;
            _socket = socketListenerRepository;
            this.genericeQueueRepository  = internalMessagingLogic;
            this.genericSubscriptionQueue = subscriptionQueue;
            _conversionLogic = conversionLogic;
            _unitOfWork      = unitOfWork;

            _socket.FileReceived         += SocketFileReceived;
            _socket.ClosedPort           += SocketPortClosed;
            _socket.OpeningPort          += SocketOpeningPort;
            _socket.WaitingConnection    += SocketWaitingConnection;
            _socket.BeginningFileReceipt += SocketBeginningFileReceipt;
            _socket.ErrorEncountered     += SocketExceptionEncountered;

            subscriptionQueue.MessageReceived += SubscriptionQueue_MessageReceived;
        }
        public OrderHistoryLogicImpl(IOrderHistoryHeaderRepsitory headerRepo,
                                     IPurchaseOrderRepository poRepo,
                                     IKPayInvoiceRepository kpayInvoiceRepository,
                                     ICatalogLogic catalogLogic,
                                     IOrderHistoryDetailRepository detailRepo,
                                     IUnitOfWork unitOfWork,
                                     IEventLogRepository log,
                                     IGenericQueueRepository queue,
                                     IOrderConversionLogic conversionLogic,
                                     ICustomerRepository customerRepository,
                                     ISocketListenerRepository socket,
                                     IGenericSubscriptionQueueRepository genericSubscriptionQueue)
        {
            _log   = log;
            _queue = queue;
            _genericSubscriptionQueue = genericSubscriptionQueue;
            _socket = socket;

            _headerRepo            = headerRepo;
            _detailRepo            = detailRepo;
            _poRepo                = poRepo;
            _kpayInvoiceRepository = kpayInvoiceRepository;
            _catalogLogic          = catalogLogic;
            _unitOfWork            = unitOfWork;
            _conversionLogic       = conversionLogic;
            _keepListening         = true;
            _customerRepository    = customerRepository;

            _socket.FileReceived         += SocketFileReceived;
            _socket.ClosedPort           += SocketPortClosed;
            _socket.OpeningPort          += SocketOpeningPort;
            _socket.WaitingConnection    += SocketWaitingConnection;
            _socket.BeginningFileReceipt += SocketBeginningFileReceipt;
            _socket.ErrorEncountered     += SocketExceptionEncountered;

            // subscribe to event to receive message through subscription
            _genericSubscriptionQueue.MessageReceived += GenericSubscriptionQueue_MessageReceived;
        }
Beispiel #9
0
 public PushMessagePublisherImpl(IGenericQueueRepository queueRepository)
 {
     _queueRepository = queueRepository;
 }
Beispiel #10
0
 public OrderHistoryRequestLogicImpl(IEventLogRepository logRepo, IGenericQueueRepository queueRepo, IOrderUpdateSocketConnectionRepository socket)
 {
     _log    = logRepo;
     _queue  = queueRepo;
     _socket = socket;
 }
Beispiel #11
0
        public void ProcessOrderUpdatesTick(object state)
        {
            if (!_orderUpdateProcessing)
            {
                _orderUpdateProcessing = true;

                try
                {
                    // if update path does not exist, send an email then suppress messages
                    // disallow processing here until the folder exists, but do not kill the service
                    // to keep other threads running
                    if (Directory.Exists(Configuration.OrderUpdateWatchPath))
                    {
                        _allowOrderUpdateProcessing = true;
                        _silenceOrderUpdateMessages = false;
                    }
                    else
                    {
                        _allowOrderUpdateProcessing = false;

                        if (!_silenceOrderUpdateMessages)
                        {
                            HandleMissingOrderUpdateWatchPath();

                            _silenceOrderUpdateMessages = true;
                        }
                    }

                    if (_allowOrderUpdateProcessing)
                    {
                        string[] files = Directory.GetFiles(Configuration.OrderUpdateWatchPath);
                        _orderScope = _diContainer.BeginLifetimeScope();

                        IGenericQueueRepository repo = _orderScope.Resolve <IGenericQueueRepository>();

                        Parallel.ForEach(files, filePath =>
                        {
                            IOrderHistoryLogic logic = _orderScope.Resolve <IOrderHistoryLogic>();

                            if (CanOpenFile(filePath))
                            {
                                var logMessage = "Processing " + filePath + ".";
                                _log.WriteInformationLog(logMessage);

                                OrderHistoryFileReturn parsedFile = null;
                                using (var reader = File.OpenText(filePath))
                                {
                                    parsedFile = logic.ParseMainframeFile(reader);
                                }

                                if (parsedFile.Files.Count == 0)
                                {
                                    logMessage = "No instances of OrderHistoryFile were extracted from " + filePath + ".";
                                    _log.WriteWarningLog(logMessage);
                                }

                                var serializedFiles = new BlockingCollection <string>();

                                Parallel.ForEach(parsedFile.Files, file =>
                                {
                                    // do not upload an order file with an invalid header
                                    if (file.ValidHeader)
                                    {
                                        file.SenderApplicationName = Configuration.ApplicationName;
                                        file.SenderProcessName     = "Process Order History Updates From Mainframe (Flat File)";

                                        try
                                        {
                                            var serializedFile = JsonConvert.SerializeObject(file);
                                            serializedFiles.Add(serializedFile);

                                            //StringBuilder logMsg = new StringBuilder();
                                            //logMsg.AppendLine(string.Format("Serializing order history message ({0}).", file.MessageId));
                                            //logMsg.AppendLine();
                                            //logMsg.AppendLine(serializedFile);

                                            //_log.WriteInformationLog(logMsg.ToString());

                                            _silenceOrderUpdateMessages = false;
                                        }
                                        catch (Exception ex)
                                        {
                                            if (!_silenceOrderUpdateMessages)
                                            {
                                                HandleException(ex);
                                                _silenceOrderUpdateMessages = true;
                                            }
                                        }
                                    }
                                });

                                if (serializedFiles.Count > 0)
                                {
                                    logMessage = "Publishing " + serializedFiles.Count + " order history messages to queue.";
                                    _log.WriteInformationLog(logMessage);

                                    repo.BulkPublishToQueue(serializedFiles.ToList(), Configuration.RabbitMQConfirmationServer, Configuration.RabbitMQUserNamePublisher, Configuration.RabbitMQUserPasswordPublisher, Configuration.RabbitMQVHostConfirmation, Configuration.RabbitMQExchangeHourlyUpdates);
                                }

                                File.Delete(filePath);

                                logMessage = "Deleted " + filePath + ".";
                                _log.WriteInformationLog(logMessage);
                            } // end if CanOpenFile
                        });

                        _orderScope.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }

                _orderUpdateProcessing = false;
            }
        }
Beispiel #12
0
 //Func<NotificationType, INotificationHandler> notificationHandlerFactory;
 #endregion
 #region constructor
 public OrderHistoryWriterImpl(IEventLogRepository eventLogRepository, IGenericQueueRepository genericQueueRepository)
 {
     this.eventLogRepository     = eventLogRepository;
     this.genericQueueRepository = genericQueueRepository;
 }
Beispiel #13
0
 public ApplicationHealthLogicImpl(IGenericQueueRepository queueRepo, IEmailClient email, IEventLogRepository log)
 {
     _queueRepo = queueRepo;
     _email     = email;
     _log       = log;
 }