private void InitializeOrder(CommonOrder commonOrder)
        {
            Transaction transaction = null;
            Guid accountId = commonOrder.AccountId;
            Guid instrumentId = commonOrder.InstrumentId;

            if (!this.ExchangeSettingManager.Instruments.ContainsKey(instrumentId) || !this.ExchangeSettingManager.Accounts.ContainsKey(accountId))
                    return;

            Account account = this.ExchangeSettingManager.Accounts[accountId];
            InstrumentClient instrument = this.ExchangeSettingManager.Instruments[instrumentId];

            if (!this._Orders.ContainsKey(commonOrder.Id))
            {
                if (!this._Transactions.ContainsKey(commonOrder.TransactionId))
                {
                    transaction = new Transaction(commonOrder, account, instrument);

                    this._Transactions.Add(transaction.Id, transaction);

                    Order order = new Order(transaction, commonOrder);
                    this._Orders.Add(order.Id, order);
                    transaction.Add(order);
                }
            }
            else
            {
                transaction = this._Orders[commonOrder.Id].Transaction;

                if (this._Orders[commonOrder.Id].Phase == iExchange.Common.OrderPhase.Executed)
                    return;
                this._Orders[commonOrder.Id].Update(commonOrder);
            }
        }
        private void Process(CommonOrder commonOrder, bool isExecuted)
        {
            Transaction transaction = null;
            if (!this._Orders.ContainsKey(commonOrder.Id))
            {
                if (!this._Transactions.ContainsKey(commonOrder.TransactionId))
                    return;
                transaction = this._Transactions[commonOrder.TransactionId];
                Order order = new Order(transaction, commonOrder);
                this._Orders.Add(order.Id, order);
                transaction.Add(order);
            }
            else
            {
                transaction = this._Orders[commonOrder.Id].Transaction;

                if (isExecuted && transaction.SubType == iExchange.Common.TransactionSubType.Match
                    && (transaction.Phase == iExchange.Common.OrderPhase.Canceled || transaction.Phase == iExchange.Common.OrderPhase.Executed))
                {
                    return;
                }
                if (this._Orders[commonOrder.Id].Phase == iExchange.Common.OrderPhase.Executed && isExecuted)
                    return;
                this._Orders[commonOrder.Id].Update(commonOrder);
            }
        }