void _import_OnRspQryOrder(OrderField pField, bool pLast) { //无数据时,也会返回一条空记录 if (string.IsNullOrEmpty(pField.InstrumentID)) { return; } OrderField f = DicOrderField.GetOrAdd(pField.OrderId, new OrderField()); foreach (var info in pField.GetType().GetFields()) { f.GetType().GetField(info.Name).SetValue(f, Convert.ChangeType(info.GetValue(pField), f.GetType().GetField(info.Name).FieldType)); } }
void _import_OnRtnOrder(OrderField pOrder) { OrderField f = DicOrderField.GetOrAdd(pOrder.OrderId, new OrderField()); foreach (var info in pOrder.GetType().GetFields()) { f.GetType().GetField(info.Name).SetValue(f, Convert.ChangeType(info.GetValue(pOrder), f.GetType().GetField(info.Name).FieldType)); } if (_OnRtnOrder != null) { _OnRtnOrder(this, new OrderArgs { Value = f, }); } }
void _import_OnRtnCancel(OrderField pOrder) { OrderField f = DicOrderField.GetOrAdd(pOrder.OrderID, new OrderField()); foreach (var info in pOrder.GetType().GetFields()) { f.GetType().GetField(info.Name).SetValue(f, Convert.ChangeType(info.GetValue(pOrder), f.GetType().GetField(info.Name).FieldType)); } f.Status = OrderStatus.Canceled; if (_OnRtnCancel != null) { _OnRtnCancel(this, new OrderArgs { Value = f, }); } }