public void ConvertFromMsg(ICommunicationMessage msg) { foreach (string key in msg.GetKeys()) { object val = msg.GetValue(key); switch (key) { case "COMMAND": if (val.ToString() != Constants.MSG_TYPE_ALARM_REPORT && val.ToString() != Constants.MSG_TYPE_ALARM_ORDER_CHANGE) { return; } break; case "接收时间": ReceiveTime = val.ToString(); break; case "集中告警流水号": TKSn = val.ToString(); break; case "厂商告警流水号": ManuSn = val.ToString(); break; case "告警城市": City = val.ToString(); break; case "设备厂商": Manufacturer = val.ToString(); break; case "业务类型": BusinessType = val.ToString(); break; case "OMCName": OMCName = val.ToString(); break; case "网元名称": NeName = val.ToString(); break; case "网元类型": NeType = val.ToString(); break; case "对象名称": ObjName = val.ToString(); break; case "对象类型": ObjType = val.ToString(); break; case "告警名称": AlarmName = val.ToString(); break; case "重定义告警名称": Redefinition = val.ToString(); break; // case "告警种类": // Category = val.ToString(); // break; case "告警级别": Severity = val.ToString(); break; case "告警发生时间": OccurTime = val.ToString(); break; case "告警确认时间LV1": AckTimeLV1 = val.ToString(); break; case "再次确认时间LV1": AckAgainTimeLV1 = val.ToString(); break; case "告警确认时间LV2": AckTimeLV2 = val.ToString(); break; case "再次确认时间LV2": AckAgainTimeLV2 = val.ToString(); break; case "告警恢复时间": ClearTime = val.ToString(); break; case "告警定位信息": Location = val.ToString(); break; case "操作员信息LV11": OperatorLV11 = val.ToString(); break; case "操作员信息LV12": OperatorLV12 = val.ToString(); break; case "操作员信息LV21": OperatorLV21 = val.ToString(); break; case "操作员信息LV22": OperatorLV22 = val.ToString(); break; case "工程上报信息": ProjectInfo = val.ToString(); break; //add case "工程超时": ProjectBool = val.ToString(); break; case "派单人LV1": OrderOperatorLV1 = val.ToString(); break; case "派单号LV1": OrderIDLV1 = val.ToString(); break; case "派单时间LV1": OrderTimeLV1 = val.ToString(); break; case "派单人LV2": OrderOperatorLV2 = val.ToString(); break; case "派单号LV2": OrderIDLV2 = val.ToString(); break; case "派单时间LV2": OrderTimeLV2 = val.ToString(); break; default: break; } } }
public void ConvertFromMsg(ICommunicationMessage msg) { try { if (msg.TK_CommandType != Constants.TK_CommandType.ALARM_REPORT && msg.TK_CommandType != Constants.TK_CommandType.ADAPTER_ALARM_REPORT && msg.TK_CommandType != Constants.TK_CommandType.ALARM_ORDER_CHANGE) { throw new Exception("无效告警报文."); } SyncRoot.AcquireWriterLock(-1); if (!msg.Contains("集中告警流水号")) { throw new Exception("告警报文没有流水号."); } foreach (string key in msg.GetKeys()) { switch (key) { case "集中告警流水号": TKSn = Convert.ToUInt64(msg.GetValue(key).ToString()); break; case "厂商告警流水号": ManuSn = msg.GetValue(key).ToString(); break; case "告警城市": City = msg.GetValue(key).ToString(); break; case "设备厂商": Manufacturer = msg.GetValue(key).ToString(); break; case "业务类型": BusinessType = msg.GetValue(key).ToString(); break; case "网元名称": NeName = msg.GetValue(key).ToString(); break; case "网元类型": NeType = msg.GetValue(key).ToString(); break; case "对象名称": ObjName = msg.GetValue(key).ToString(); break; case "对象类型": ObjType = msg.GetValue(key).ToString(); break; case "告警名称": AlarmName = msg.GetValue(key).ToString(); break; case "重定义告警名称": Redefinition = msg.GetValue(key).ToString(); break; //case "告警种类": // Category = msg.GetValue(key).ToString(); // break; case "告警级别": Severity = msg.GetValue(key).ToString(); break; case "告警发生时间": OccurTime = msg.GetValue(key).ToString(); break; case "告警确认时间LV1": AckTimeLV1 = msg.GetValue(key).ToString(); break; case "再次确认时间LV1": AckAgainTimeLV1 = msg.GetValue(key).ToString(); break; case "告警确认时间LV2": AckTimeLV2 = msg.GetValue(key).ToString(); break; case "再次确认时间LV2": AckAgainTimeLV2 = msg.GetValue(key).ToString(); break; case "告警恢复时间": ClearTime = msg.GetValue(key).ToString(); break; case "告警定位信息": Location = msg.GetValue(key).ToString(); break; case "操作员信息LV11": OperatorLV11 = msg.GetValue(key).ToString(); break; case "操作员信息LV12": OperatorLV12 = msg.GetValue(key).ToString(); break; case "操作员信息LV21": OperatorLV21 = msg.GetValue(key).ToString(); break; case "操作员信息LV22": OperatorLV22 = msg.GetValue(key).ToString(); break; case "工程上报信息": ProjectInfo = msg.GetValue(key).ToString(); break; case "工程超时": ProjectTimeOut = msg.GetValue(key).ToString(); break; case "派单人LV1": OrderOperatorLV1 = msg.GetValue(key).ToString(); break; case "派单号LV1": OrderIDLV1 = msg.GetValue(key).ToString(); break; case "派单时间LV1": OrderTimeLV1 = msg.GetValue(key).ToString(); break; case "派单人LV2": OrderOperatorLV2 = msg.GetValue(key).ToString(); break; case "派单号LV2": OrderIDLV2 = msg.GetValue(key).ToString(); break; case "派单时间LV2": OrderTimeLV2 = msg.GetValue(key).ToString(); break; case "OMCName": OMCName = msg.GetValue(key).ToString(); break; case "Reserved2": Reserved2 = msg.GetValue(key).ToString(); break; case "Reserved3": Reserved3 = msg.GetValue(key).ToString(); break; case "接收时间": ReceiveTime = msg.GetValue(key).ToString(); break; default: break; } } } finally { SyncRoot.ReleaseWriterLock(); } }