Ejemplo n.º 1
0
 public bool UpdateInstrument(Token token, ParameterUpdateTask parameterUpdateTask)
 {
     try
     {
         XmlNode instrumentNode = ManagerHelper.GetInstrumentParametersXml(parameterUpdateTask);
         return(Global.StateServer.UpdateInstrument(token, instrumentNode));
     }
     catch (Exception ex)
     {
         AppDebug.LogEvent("ManagerCallback.UpdateInstrument",
                           string.Format("UpdateInstrument:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
         return(false);
     }
 }
Ejemplo n.º 2
0
        public static XmlNode GetInstrumentParametersXml(ParameterUpdateTask settingTask)
        {
            XmlDocument exchangeDoc = new XmlDocument();
            XmlElement xmlInstrumentRoot = exchangeDoc.CreateElement("Instruments");

            foreach (Guid instrumentId in settingTask.Instruments)
            {
                XmlElement instrumentElement = exchangeDoc.CreateElement("Instrument");
                instrumentElement.SetAttribute("ID", instrumentId.ToString());
                foreach (ExchangeSetting setting in settingTask.ExchangeSettings)
                {
                    instrumentElement.SetAttribute(setting.ParameterKey, setting.ParameterValue);
                }
                xmlInstrumentRoot.AppendChild(instrumentElement);
            }
            exchangeDoc.AppendChild(xmlInstrumentRoot);
            return exchangeDoc.DocumentElement;
        }
Ejemplo n.º 3
0
        internal static XmlNode GetInstrumentParametersXml(ParameterUpdateTask settingTask)
        {
            XmlDocument exchangeDoc       = new XmlDocument();
            XmlElement  xmlInstrumentRoot = exchangeDoc.CreateElement("Instruments");

            foreach (Guid instrumentId in settingTask.Instruments)
            {
                XmlElement instrumentElement = exchangeDoc.CreateElement("Instrument");
                instrumentElement.SetAttribute("ID", instrumentId.ToString());
                foreach (ExchangeSetting setting in settingTask.ExchangeSettings)
                {
                    instrumentElement.SetAttribute(setting.ParameterKey, setting.ParameterValue);
                }
                xmlInstrumentRoot.AppendChild(instrumentElement);
            }
            exchangeDoc.AppendChild(xmlInstrumentRoot);
            return(exchangeDoc.DocumentElement);
        }
Ejemplo n.º 4
0
 public bool UpdateInstrument(ParameterUpdateTask parameterUpdateTask)
 {
     try
     {
         Token token = new Token(Guid.Empty, UserType.System, AppType.Manager);
         bool isOk = this._StateServer.UpdateInstrument(token, parameterUpdateTask);
         return isOk;
     }
     catch (Exception ex)
     {
         Logger.TraceEvent(TraceEventType.Error, "ExchangeSystem.UpdateInstrument Error:\r\n" + ex.ToString());
         return false;
     }
 }
 public static ParameterUpdateTask GetExchangeParametersTask(TaskScheduler taskScheduler)
 {
     ParameterUpdateTask task = new ParameterUpdateTask();
     List<Guid> instruments = new List<Guid>();
     foreach (ExchangeIntrument instrument in taskScheduler.ExchangInstruments)
     {
         instruments.Add(instrument.InstrumentId);
     }
     foreach (ParameterSettingTask setting in taskScheduler.ParameterSettings)
     {
         if (setting.SettingParameterType == SettingParameterType.InstrumentParameter)
         {
             ExchangeSetting exchangeSetting = new ExchangeSetting();
             exchangeSetting.ParameterKey = setting.ParameterKey;
             exchangeSetting.ParameterValue = setting.ParameterValue;
             task.ExchangeSettings.Add(exchangeSetting);
         }
     }
     task.Instruments = instruments.ToArray();
     return task;
 }