/// <summary> /// Imports all the messages used by this step /// </summary> /// <param name="aStep"></param> private void importStepMessages(DataDictionary.Tests.Step aStep) { string sql = "SELECT TCSOrder, MessageOrder, MessageType, Var_Name, Var_Value FROM TSW_MessageHeader ORDER BY MessageOrder, Var_Row"; OleDbDataAdapter adapter = new OleDbDataAdapter(sql, Connection); DataSet dataSet = new DataSet(); adapter.Fill(dataSet); if (dataSet.Tables.Count > 0) { int messageNumber = 0; DataDictionary.Tests.DBElements.DBMessage message = null; int order = -1; foreach (DataRow dataRow in dataSet.Tables[0].Rows) { object[] items = dataRow.ItemArray; order = (int)items[0]; if (order == aStep.getTCS_Order()) { short messageOrder = (short)items[1]; if (messageNumber != messageOrder) // we create a new Message { if (messageNumber != 0) { aStep.AddMessage(message); importPackets(message, order); } short messageTypeNumber = (short)items[2]; DataDictionary.Generated.acceptor.DBMessageType messageType = DataDictionary.Generated.acceptor.DBMessageType.defaultDBMessageType; switch (messageTypeNumber) { case 0: messageType = DataDictionary.Generated.acceptor.DBMessageType.aEUROBALISE; break; case 1: messageType = DataDictionary.Generated.acceptor.DBMessageType.aEUROLOOP; break; case 2: messageType = DataDictionary.Generated.acceptor.DBMessageType.aEURORADIO; break; } message = (DataDictionary.Tests.DBElements.DBMessage)DataDictionary.Generated.acceptor.getFactory().createDBMessage(); message.MessageOrder = messageOrder; message.MessageType = messageType; messageNumber = messageOrder; } DataDictionary.Tests.DBElements.DBField field = (DataDictionary.Tests.DBElements.DBField)DataDictionary.Generated.acceptor.getFactory().createDBField(); string variable = items[3] as string; if (variable != null) { field.Variable = variable; } string value = items[4] as string; if (value != null) { field.Value = DataDictionary.Tests.Translations.Translation.format_decimal(value); } message.AddField(field); } } if (message != null) { aStep.AddMessage(message); importPackets(message, aStep.getTCS_Order()); } } }