多级类属性赋值实践(报文)
来源:互联网 发布:anaconda2.7知乎 编辑:程序博客网 时间:2024/06/05 09:05
SysSoft.EDI.ShipRecord.Message message = new SysSoft.EDI.ShipRecord.Message();
this.Message = message;
Type MessageType = message.GetType();
PropertyInfo[] MessgeInfo = MessageType.GetProperties();
string ProName;
for (int j = 0; j < MessgeInfo.Length; j++) {
ProName = MessgeInfo[j].Name;
object SubObject = MessageType.InvokeMember(ProName, BindingFlags.GetProperty, null, message, null);
Type SubType = SubObject.GetType();
PropertyInfo[] SubProInfo = SubType.GetProperties();
PropertyInfo SubInfo;
for (int i = 0; i < SubProInfo.Length; i++)
{
SubInfo = SubProInfo[i];
if (SubInfo.PropertyType.Namespace.ToLower().Trim() != "system") GetSubNodeData(SubInfo.Name, SubObject);
if (EDICommondList[SubInfo.Name] == null) continue;
SubInfo.SetValue(SubObject, Convert.ChangeType(EDICommondList[SubInfo.Name], SubInfo.PropertyType), null);
}
PropertyInfo InfoHead = MessageType.GetProperty(ProName);
InfoHead.SetValue(message, SubObject, null);
}
private void GetSubNodeData(string SubNodeName, object Node)
{
Type NodeType=Node.GetType();
string NodeName = NodeType.Name;
object SubNodeObject = NodeType.InvokeMember(SubNodeName, BindingFlags.GetProperty, null,Node, null);
Type SubNodeType = SubNodeObject.GetType();
PropertyInfo[] SubNodePros = SubNodeType.GetProperties();
string ProName;
CShipStandardMapping Mapping = new CShipStandardMapping();
CShipStandardEntities StandardEntity = new CShipStandardEntities();
Type StandardEntityType = StandardEntity.GetType();
StandardEntity.GetEntityData(this.ShipKey);
PropertyInfo EntryProperty;
object EntryProValue;
for (int i = 0; i < SubNodePros.Length; i++)
{
ProName = SubNodePros[i].Name;
if (SubNodePros[i].PropertyType.Namespace.ToLower() != "system")
{
GetSubNodeData(ProName, SubNodeObject);
}
else
{
if (NodeName.ToLower() == "messagemessagebodydeclaration")
{
object MaoCol = Mapping.ColsMapping[ProName];
if (MaoCol==null) continue;
EntryProperty = StandardEntityType.GetProperty(MaoCol.ToString());
EntryProValue = EntryProperty.GetValue(StandardEntity, null);
if (EntryProValue == null) continue;
SubNodePros[i].SetValue(SubNodeObject, EntryProValue, null);
}
else
{
SubNodePros[i].SetValue(SubNodeObject, Convert.ChangeType(EDICommondList[ProName], SubNodePros[i].PropertyType), null);
}
}
}
PropertyInfo InfoSubNode = NodeType.GetProperty(SubNodeName);
InfoSubNode.SetValue(Node, SubNodeObject, null);
}
- 多级类属性赋值实践(报文)
- 多级类属性赋值(报文)
- RabbitMq应用实践一(报文)
- angular js的data赋值(给类中的一个类属性的属性赋值)
- 类的属性赋值失败
- 属性赋值
- 消息队列(报文队列)实践到内核
- Python多级排序(多属性排序)csv文件
- 多级选择组件解决实践
- ISO8583报文工具类(组装和解析报文)
- ISO8583报文工具类(组装和解析报文)
- 遍历类属性字段并进行赋值
- 利用“反射”给类的属性赋值。
- 类的属性取值与赋值
- javabean 不同的类 相同属性赋值
- php 对类属性 赋值 疑惑
- 实体类相同属性之间相互赋值
- fastjson 多级联属性过滤
- 轻松掌握ISO8583报文协议
- Biztalk server 2009 安装完后找不到 “业务规则编辑器”
- 面试经历12
- Linux环境进程间通信——信号
- 震撼的CSDN用户关系图
- 多级类属性赋值实践(报文)
- 习语言 1.3版 下载方法
- C队列 输出杨辉三角
- const 函数
- printf格式控制符的完整格式
- C#存储过程操作
- GCC在AMD64平台下的参数传递
- STL set详解
- 简单的exp全备份脚本及部署过程(step by step)