コード例 #1
0
 public void StartUp()
 {
     _applicationController = ContextRegistry.GetContext()["ApplicationController"] as ApplicationController;
     if (_applicationController != null)
     {
         _applicationController.StartServer();
     }
     _service = ContextRegistry.GetContext()["OrderExecutionService"] as OrderExecutionService;
 }
コード例 #2
0
        /// <summary>
        /// Argument Constructor
        /// </summary>
        /// <param name="orderExecutionService">Provides communication access with Order Execution Server</param>
        public OrderExecutionManager(OrderExecutionService orderExecutionService)
        {
            // Save object reference
            _orderExecutionService = orderExecutionService;

            SubscribeExecutionServiceEvents();

            // Start Service
            _orderExecutionService.StartService();
        }
コード例 #3
0
        /// <summary>
        /// Argument Constructor
        /// </summary>
        /// <param name="orderExecutionService">Provides communication access with Order Execution Server</param>
        public OrderExecutionController(OrderExecutionService orderExecutionService)
        {
            // Initialize Manager
            _orderExecutionManager = new OrderExecutionManager(orderExecutionService);

            // Intialize local maps
            _providersMap = new Dictionary <string, OrderExecutionProvider>();

            // Subscribe Application events
            SubscribeEvents();

            // Subscribe Order Execution Manager events
            SubscribeManagerEvents();
        }
コード例 #4
0
        private static void ProcessAllOrders(IDictionary <Guid, IOrder> orders)
        {
            OrderProcessingService         orderProcessingService         = new OrderProcessingService();
            IOrderExecutionService         orderExecutionService          = new OrderExecutionService();
            MembershipProcessingStrategy   membershipProcessingStrategy   = new MembershipProcessingStrategy(orderExecutionService);
            ProductOrderProcessingStrategy productOrderProcessingStrategy = new ProductOrderProcessingStrategy(orderExecutionService);
            VideoRequestProcessingStrategy videoRquestProcessingStrategy  = new VideoRequestProcessingStrategy(orderExecutionService);

            Console.WriteLine("\n\t\t---------------------------------------------\n");
            Console.WriteLine("\n\t\t*********************************************\n");
            Console.WriteLine("\n\t\t* PROCESSING ALL THE PLACED ORDERS *\n");
            try
            {
                foreach (KeyValuePair <Guid, IOrder> kvp in orders)
                {
                    string name = kvp.Value.GetType().Name.ToUpper();
                    switch ((OrderType)Enum.Parse(typeof(OrderType), name))
                    {
                    case OrderType.MEMBERSHIP:
                        orderProcessingService.SetOrderProcessingStrategy(membershipProcessingStrategy);
                        orderProcessingService.ProcessOrder(kvp.Value);
                        break;

                    case OrderType.PRODUCT:
                        orderProcessingService.SetOrderProcessingStrategy(productOrderProcessingStrategy);
                        orderProcessingService.ProcessOrder(kvp.Value);
                        break;

                    case OrderType.VIDEO:
                        orderProcessingService.SetOrderProcessingStrategy(videoRquestProcessingStrategy);
                        orderProcessingService.ProcessOrder(kvp.Value);
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine("\n\t\t*********************************************\n");
            Console.WriteLine("\n\t\t---------------------------------------------\n");
            Console.WriteLine("\n\t\t* ALL ORDERS HAS BEEN PROCESSED *\n");
        }
コード例 #5
0
        public void Setup()
        {
            // Initialize and Start Order Execution Engine Server
            _oEapplicationController = ContextRegistry.GetContext()["ApplicationController"] as OeApplicationController;
            if (_oEapplicationController != null)
            {
                _oEapplicationController.StartServer();
            }

            Thread.Sleep(1000);

            // Initialize and Start Position Engine Server
            _applicationController = new ApplicationController(new PositionEngineMqServer("PEMQConfig.xml"), new PositionMessageProcessor());
            if (_applicationController != null)
            {
                _applicationController.StartServer();
            }

            // Initialize Position Engine Service
            _positionEngineService = ContextRegistry.GetContext()["PositionEngineService"] as PositionEngineService;

            // Initialize Order Execution Service
            _orderExecutionService = ContextRegistry.GetContext()["OrderExecutionService"] as OrderExecutionService;
        }