コード例 #1
0
ファイル: OrderStateMachine.cs プロジェクト: kiquenet/B4F
        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);
        }
コード例 #2
0
ファイル: TransactionOrder.cs プロジェクト: kiquenet/B4F
 private void setOrderStatus(OrderStateEvents newEvent)
 {
     OrderStateMachine.SetNewStatus(this.Order, newEvent);
 }