本文整理汇总了C#中DataDictionary.AddPacket方法的典型用法代码示例。如果您正苦于以下问题:C# DataDictionary.AddPacket方法的具体用法?C# DataDictionary.AddPacket怎么用?C# DataDictionary.AddPacket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataDictionary
的用法示例。
在下文中一共展示了DataDictionary.AddPacket方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: importPackets
/// <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);
}
}
}