private static List<ExchangeUpdateData> ToExchangeUpdateDatas(XmlNode content) { List<ExchangeUpdateData> exchangeUpdateDatas = new List<ExchangeUpdateData>(); foreach (XmlNode xmlNode in content.ChildNodes) { ExchangeMetadataType metadataType; if (Enum.TryParse<ExchangeMetadataType>(xmlNode.Name, out metadataType)) { ExchangeUpdateData exchangeUpdateData = new ExchangeUpdateData() { ExchangeMetadataType = metadataType, FieldsAndValues = new Dictionary<string, string>() }; foreach (XmlAttribute attribute in xmlNode.Attributes) { exchangeUpdateData.FieldsAndValues.Add(attribute.Name, attribute.Value); } exchangeUpdateDatas.Add(exchangeUpdateData); } else if (xmlNode.Name == "Instruments") { CommandConvertor.ExtractDatas(exchangeUpdateDatas, xmlNode, ExchangeMetadataType.Instrument); } else if (xmlNode.Name == "Customers") { CommandConvertor.ExtractDatas(exchangeUpdateDatas, xmlNode, ExchangeMetadataType.Customer); } else if (xmlNode.Name == "QuotePolicyDetails") { CommandConvertor.ExtractDatas(exchangeUpdateDatas, xmlNode, ExchangeMetadataType.QuotePolicyDetail); } else { Logger.AddEvent(TraceEventType.Warning, "CommandConvertor.ToExchangeUpdateDatas Unknown metadata type:\r\n{0}", xmlNode.OuterXml); } } return exchangeUpdateDatas; }
private void NotifyInstrumentUpdate(ExchangeMetadataType metadataType, Dictionary<string, string> fieldsAndValues, Guid[] instrumentIds) { ExchangeUpdateData[] exchangeUpdateDatas = new ExchangeUpdateData[instrumentIds.Length]; for (int i = 0; i < instrumentIds.Length; i++) { Dictionary<string, string> fieldsAndValues2 = new Dictionary<string, string>(fieldsAndValues); fieldsAndValues2.Add(ExchangeFieldSR.ID, instrumentIds[i].ToString()); exchangeUpdateDatas[i] = new ExchangeUpdateData() { ExchangeMetadataType = metadataType, FieldsAndValues = fieldsAndValues2, }; } UpdateMessage updateMessage = new UpdateMessage() { ExchangeCode = this.ExchangeCode, ExchangeUpdateDatas = exchangeUpdateDatas }; MainService.ClientManager.Dispatch(updateMessage); }
private static void ExtractDatas(List<ExchangeUpdateData> exchangeUpdateDatas, XmlNode xmlNode, ExchangeMetadataType metadataType) { foreach (XmlNode instrumentNode in xmlNode.ChildNodes) { ExchangeUpdateData exchangeUpdateData = new ExchangeUpdateData() { ExchangeMetadataType = metadataType, FieldsAndValues = new Dictionary<string, string>() }; foreach (XmlAttribute attribute in xmlNode.Attributes) { exchangeUpdateData.FieldsAndValues.Add(attribute.Name, attribute.Value); } exchangeUpdateDatas.Add(exchangeUpdateData); } }