Extending Typed5010Document

Index

    Extending Typed5010Document

    Typed5010Document currently supports the loading of the HIPAA 5010 EDI documents. By default any HIPAA 5010 file is supported. However the situation may arise where a custom segment needs to be added or subclassed for custom behavior.

    For example, let’s say that you need to add custom properties to the SVC segment. The SVC class can be subclassed.

    Step 1 – Derive from SVC

    using RDPCrystalEDILibrary.Docs.x5010;
     
        public class MySVC: SVC
        {
            public MySVC()
            {
            }
     
             // new property added
            public string LineItemChargeAmount
            {
                get { return MonetaryAmount1; }
            }
     
            // new property added
            public string LineItemProviderPaymentAmount
            {
                get { return MonetaryAmount2; }
            }
        }

    Step 2 – Derive from Typed5010Document

    public class My5010Document : Typed5010Document
        {
            public My5010Document()
            {
            }
     
            // add support for your custom segment here
            protected override DocumentSegment

    GetDocumentSegment(string segmentName)
            {
                if (segmentName == “SVC”)
                {
                    return new MySVC();
                 }
     
                return base.GetDocumentSegment(segmentName);
            }
        }
    That’s it. Now when Typed5010Document is loaded and the SVC segment is encountered your custom SVC segment will be used instead of the default SVC. Typed4010Document can be overridden in the same manner.
    in Typed Documents
    Did this article answer your question?