public void Update(PBMsgOrderRtn pe, string exchange) { bool found = false; foreach (ExecutionViewModel child in this) { if (child.BrokerOrderSeq == pe.BrokerOrderSeq) { found = true; child.Update(pe, exchange); Logger.Debug("Update PBMsgOrderRtn"); break; } } if (!found) { ExecutionViewModel evm = new ExecutionViewModel(); evm.Update(pe, exchange); this.Add(evm); Logger.Debug("Add PBMsgOrderRtn"); } //MainWindow.MyInstance.executionWindow.Refresh(); }
public void Update(PBMsgOrderRtn pe, string exhange) { Flag = false; InstrumentID = pe.InstrumentID; OrderStatus = pe.OrderStatus; OrderStatusCN = pe.StatusMsg.ToString(Encoding.GetEncoding("gb2312")); VolumeTraded = pe.VolumeTraded; VolumeTotal = pe.VolumeTotal; VolumeOriginal = pe.VolumeTotalOriginal; if (VolumeTotal == 0) { Status = PBMsgTrader.OrderStatus.ALL_FINISHED; } else if ((VolumeOriginal > VolumeTraded) && (VolumeTraded > 0)) { Status = PBMsgTrader.OrderStatus.PARTLY_FINISHED; } else { Status = (OrderStatus)pe.IOrderStatus; } OrderRef = pe.OrderRef; BrokerOrderSeq = pe.BrokerOrderSeq; InsertTime = pe.InsertTime; IsOrderOrTrade = true; //Direction = Enum.GetName(typeof(OrderDirection), int.Parse(pe.Direction)); Direction = ParseDirection(pe.Direction); CombOffsetFlag = ParseFlag(pe.CombOffsetFlag); Exchange = exhange; OrderSysID = pe.OrderSysID; LimitPrice = pe.LimitPrice; StopPrice = pe.StopPrice; }