Beispiel #1
0
 /// <summary>
 /// Read RequestXML To DB
 /// </summary>
 /// <param name="file"></param>
 internal static void ReadRequestXMLToDB(string file, string fileTime, string lineNo)
 {
     try
     {
         XmlDocument xdoc = new XmlDocument();
         xdoc.Load(file);
         XmlNode nodes     = xdoc.SelectSingleNode("root");
         string  typeNo    = string.Empty;
         string  timeStamp = string.Empty;
         //获取当前Request xml文件的TypeNo and timeStamp
         if (nodes != null)
         {
             foreach (XmlNode node in nodes)
             {
                 if (node.Name == "event")
                 {
                     XmlNodeList xmlFeeds = ReadXML_MV.GetChildNodes(node);
                     foreach (XmlNode nodeFeed in xmlFeeds)
                     {
                         typeNo = ReadXML_MV.ReadAttrValue(nodeFeed, "typeNo") ?? string.Empty;
                         if (!string.IsNullOrEmpty(typeNo))
                         {
                             break;
                         }
                     }
                 }
                 if (node.Name == "header")
                 {
                     foreach (System.Xml.XmlAttribute item in node.Attributes)
                     {
                         if (item.Name == "timeStamp")
                         {
                             timeStamp = item.Value;
                             break;
                         }
                     }
                 }
             }
             //插入数据库
             InsertToRequestInfoAndCompare(typeNo, timeStamp, fileTime, lineNo);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Read RequestXML To DB
 /// </summary>
 /// <param name="file"></param>
 internal static void ReadResponseXMLToDB(string file, string fileTime, string lineNo)
 {
     try
     {
         XmlDocument xdoc = new XmlDocument();
         xdoc.Load(file);
         XmlNode nodes     = xdoc.SelectSingleNode("root/body/structArrays/array");
         string  matID     = string.Empty;
         string  partNo    = string.Empty;
         string  timeStamp = string.Empty;
         //获取当前Request xml文件的TypeNo and timeStamp
         if (nodes != null)
         {
             //21号线Response报文不同
             if (lineNo == "21" || lineNo == "32" || lineNo == "26")
             {
                 foreach (XmlNode node in nodes)
                 {
                     if (node.Name == "values")
                     {
                         XmlNodeList xmlFeeds = ReadXML_MV.GetChildNodes(node);
                         foreach (XmlNode nodeFeed in xmlFeeds)
                         {
                             partNo = ReadXML_MV.ReadAttrValue(nodeFeed, "partNo");
                             matID  = ReadXML_MV.ReadAttrValue(nodeFeed, "matID");
                             if (!string.IsNullOrEmpty(partNo) && !string.IsNullOrEmpty(matID))
                             {
                                 break;
                             }
                         }
                     }
                 }
             }
             else
             {
                 foreach (XmlNode node in nodes)
                 {
                     if (node.Name == "values")
                     {
                         XmlNodeList xmlFeeds = ReadXML_MV.GetChildNodes(node);
                         foreach (XmlNode nodeFeed in xmlFeeds)
                         {
                             partNo = ReadXML_MV.ReadAttrValue(nodeFeed, "typeNo");
                             matID  = ReadXML_MV.ReadAttrValue(nodeFeed, "matID");
                             if (!string.IsNullOrEmpty(partNo) && !string.IsNullOrEmpty(matID))
                             {
                                 break;
                             }
                         }
                     }
                 }
             }
             XmlNode nodes_head = xdoc.SelectSingleNode("root");
             //获取当前Request xml文件的TypeNo and timeStamp
             foreach (XmlNode node in nodes_head)
             {
                 if (node.Name == "header")
                 {
                     foreach (System.Xml.XmlAttribute item in node.Attributes)
                     {
                         if (item.Name == "timeStamp")
                         {
                             timeStamp = item.Value;
                             break;
                         }
                     }
                 }
             }
             //插入数据库
             InsertToResponseInfoAndCompare(partNo, matID, timeStamp, fileTime, lineNo);
         }
     }
     catch
     {
         throw;
     }
 }