public FormDocument TransformClaimDocumentToFormDocument(ClaimDocument document) { FormDocument form = new FormDocument(); foreach (var claim in document.Claims) { if (claim.Type == ClaimTypeEnum.Professional) { var pages = _professionalTransformation.TransformClaimToClaimFormFoXml(claim); form.Pages.AddRange(pages); } else if (claim.Type == ClaimTypeEnum.Institutional) { var pages = _institutionalTransformation.TransformClaimToClaimFormFoXml(claim); form.Pages.AddRange(pages); } else { form.Pages.AddRange(_dentalTransformation.TransformClaimToClaimFormFoXml(claim)); } } return(form); }
public string TransformClaimDocumentToFoXml(ClaimDocument document) { FormDocument form = new FormDocument(); foreach (var claim in document.Claims) { if (claim.Type == ClaimTypeEnum.Professional) { var pages = _professionalTransformation.TransformClaimToClaimFormFoXml(claim); form.Pages.AddRange(pages); } else if (claim.Type == ClaimTypeEnum.Institutional) { var pages = _institutionalTransformation.TransformClaimToClaimFormFoXml(claim); form.Pages.AddRange(pages); } else { form.Pages.AddRange(_dentalTransformation.TransformClaimToClaimFormFoXml(claim)); } } var xml = form.Serialize(); var transformStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OopFactory.X12.Hipaa.Claims.Services.Xsl.FormDocument-To-FoXml.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; return(new StreamReader(outputStream).ReadToEnd()); }