Ejemplo n.º 1
0
        public static bool SetNewStatus(IOrder order, OrderStateEvents stateEvent)
        {
            if (order == null)
            {
                throw new ApplicationException("The order cannot be null when changing the status");
            }

            OrderStati oldStatus = order.Status;

            switch (stateEvent)
            {
                //case OrderStateEvents.Approve:
                //    machine.checkApprove(order);
                //    break;
                case OrderStateEvents.New:
                    machine.checkNew(order);
                    break;
                case OrderStateEvents.Send:
                    machine.checkSend(order);
                    break;
                case OrderStateEvents.Place:
                    machine.checkPlaced(order);
                    break;
                case OrderStateEvents.Fill:
                    machine.checkFill(order);
                    break;
                case OrderStateEvents.CheckFill:
                    machine.checkCheck(order);
                    break;
                case OrderStateEvents.Terminate:
                    machine.checkTerminate(order);
                    break;
                default:
                    break;
            }

            // Set Close Date
            machine.checkSetDateClosed(order);

            return (oldStatus != order.Status);
        }
Ejemplo n.º 2
0
 private void setOrderStatus(OrderStateEvents newEvent)
 {
     OrderStateMachine.SetNewStatus(this.Order, newEvent);
 }