Пример #1
0
        private void checkAndCalculateProtectedID(XmlDocument message, XmlNode invoice)
        {
            // field ProtectedID is mandatory, but if it is not suplied it is going to be calculated!
              XmlNodeList protectedIDs = (invoice as XmlElement).GetElementsByTagName("fu:ProtectedID");
              if (protectedIDs.Count == 0)
              {
            ProtectiveMark pm = new ProtectiveMark();
            string protectedIDValue = pm.Calculate(invoice as XmlElement, Settings.CryptoProvider);

            invoice.AppendChild(XmlHelperFunctions.CreateElement(message, this.Settings.FursXmlNamespace, "ProtectedID", protectedIDValue));
              }
        }
Пример #2
0
    private void checkAndCalculateProtectedID(XmlDocument message, XmlNode invoice)
    {
      // field ProtectedID is mandatory, but if it is not suplied it is going to be calculated!
      XmlNodeList protectedIDs = (invoice as XmlElement).GetElementsByTagName("fu:ProtectedID");
      if (protectedIDs.Count == 0)
      {
        ProtectiveMark pm = new ProtectiveMark();
        string protectedIDValue = pm.Calculate(invoice as XmlElement, Settings.CryptoProvider);

        // ProtectedID is not the last element in XML Schema, so we must put it in the right spot
        //    we are going from bottom up, searching for the right spot
        XmlNode protectedIDNode = XmlHelperFunctions.CreateElement(message, this.Settings.FursXmlNamespace, "ProtectedID", protectedIDValue);

        XmlNode currentNode = invoice.LastChild;
        while ((currentNode != null) && (this.isNodeAfterProtectedID(currentNode)))
          currentNode = currentNode.PreviousSibling;

        if (currentNode != null)
          invoice.InsertAfter(protectedIDNode, currentNode);
      }
    }