/// <summary> /// Impports all the packets for a given message /// </summary> /// <param name="aMessage"></param> private void importPackets(DataDictionary.Tests.DBElements.DBMessage aMessage, int TCS_order) { string sql = "SELECT TCSOrder, MessageOrder, Pac_ID, Var_Name, Var_Value FROM TSW_MessageBody ORDER BY MessageOrder, Var_Row"; OleDbDataAdapter adapter = new OleDbDataAdapter(sql, Connection); DataSet dataSet = new DataSet(); adapter.Fill(dataSet); int packetNumber = 0; DataDictionary.Tests.DBElements.DBPacket packet = (DataDictionary.Tests.DBElements.DBPacket)DataDictionary.Generated.acceptor.getFactory().createDBPacket(); if (dataSet.Tables.Count > 0) { foreach (DataRow dataRow in dataSet.Tables[0].Rows) { object[] items = dataRow.ItemArray; int order = (int)items[0]; short messageOrder = (short)items[1]; if (order == TCS_order && messageOrder == aMessage.MessageOrder) { short pacId = (short)items[2]; if (packetNumber != pacId) { if (packetNumber != 0) { aMessage.AddPacket(packet); } packet = (DataDictionary.Tests.DBElements.DBPacket)DataDictionary.Generated.acceptor.getFactory().createDBPacket(); packetNumber = pacId; } 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); } packet.AddField(field); } } if (packet != null) { aMessage.AddPacket(packet); } } }