Exemple #1
0
        /// <summary>
        /// Handles a generic order request
        /// </summary>
        /// <param name="request"><see cref="OrderRequest"/> to be handled</param>
        /// <returns><see cref="OrderResponse"/> for request</returns>
        public void HandleOrderRequest(OrderRequest request)
        {
            OrderResponse response;

            switch (request.OrderRequestType)
            {
            case OrderRequestType.Submit:
                response = HandleSubmitOrderRequest((SubmitOrderRequest)request);
                break;

            case OrderRequestType.Update:
                response = HandleUpdateOrderRequest((UpdateOrderRequest)request);
                break;

            case OrderRequestType.Cancel:
                response = HandleCancelOrderRequest((CancelOrderRequest)request);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            // mark request as processed
            request.SetResponse(response, OrderRequestStatus.Processed);
        }