public ClaimDocument Transform837ToClaimDocument(Interchange interchange)
        {
            var xml = interchange.Serialize();

            var transformStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OopFactory.X12.Hipaa.Claims.Services.Xsl.X12-837-To-ClaimDocument.xslt");

            var transform = new XslCompiledTransform();
            if (transformStream != null) transform.Load(XmlReader.Create(transformStream));

            var outputStream = new MemoryStream();

            transform.Transform(XmlReader.Create(new StringReader(xml)), new XsltArgumentList(), outputStream);
            outputStream.Position = 0;
            xml = new StreamReader(outputStream).ReadToEnd();

            return ClaimDocument.Deserialize(xml);
        }
Пример #2
0
 //reverse engineer from https://raw.githubusercontent.com/mmooney/MMDB.DataService/master/ThirdParty/x12parser/trunk/src/OopFactory.X12.Hipaa/Claims/Services/Xsl/X12-837-To-ClaimDocument.xslt
 private static XmlDocument TransformClaimDocumentTo837(Interchange interchange, Claim claim)
 {
     XmlDocument document = new XmlDocument() { PreserveWhitespace = true } ;
     document.LoadXml(interchange.Serialize());
     var claimLoop2300 = document.SelectNodes("//Loop");
     for (int i = 0; i < claimLoop2300.Count; i++)
     {
         TransformLoopTo837(claimLoop2300[i],claim);
     }
     return document;
 }