/// <summary> /// The create logic error. /// </summary> /// <param name="errorTypeCode"> /// The error type code. /// </param> /// <param name="code"> /// The code. /// </param> /// <param name="message"> /// The message. /// </param> /// <param name="codeHL7"> /// The code h l 7. /// </param> /// <param name="messageHL7"> /// The message h l 7. /// </param> /// <param name="severityHL7"> /// The severity h l 7. /// </param> /// <param name="reference"> /// The reference. /// </param> /// <param name="xpath"> /// The xpath. /// </param> /// <param name="nodeNumber"> /// The node number. /// </param> /// <returns> /// The <see cref="XElement"/>. /// </returns> internal static XElement CreateLogicError( string errorTypeCode, string code, string message, string codeHL7, string messageHL7, string severityHL7, string reference, string xpath, string nodeNumber) { return(new XElement( XName.Get("ERR", "urn:hl7-org:v2xml"), new object[] { new XElement( XName.Get("ERR.2", "urn:hl7-org:v2xml"), new object[] { new XElement( XName.Get("ERL.1", "urn:hl7-org:v2xml"), xpath.ReplaceInvalidXmlCharacters(XmlVersion.Version_1_0, " ", false)), new XElement( XName.Get("ERL.2", "urn:hl7-org:v2xml"), nodeNumber.ReplaceInvalidXmlCharacters(XmlVersion.Version_1_0, " ", false)) }), new XElement( XName.Get("ERR.3", "urn:hl7-org:v2xml"), new object[] { new XElement( XName.Get("CWE.1", "urn:hl7-org:v2xml"), codeHL7.ReplaceInvalidXmlCharacters(XmlVersion.Version_1_0, " ", false)), new XElement( XName.Get("CWE.2", "urn:hl7-org:v2xml"), messageHL7.ReplaceInvalidXmlCharacters(XmlVersion.Version_1_0, " ", false)), new XElement(XName.Get("CWE.3", "urn:hl7-org:v2xml"), "1.2.643.2.40.5.100.357") }), new XElement( XName.Get("ERR.4", "urn:hl7-org:v2xml"), severityHL7.ReplaceInvalidXmlCharacters(XmlVersion.Version_1_0, " ", false)), new XElement( XName.Get("ERR.5", "urn:hl7-org:v2xml"), new object[] { new XElement( XName.Get("CWE.1", "urn:hl7-org:v2xml"), code.ReplaceInvalidXmlCharacters(XmlVersion.Version_1_0, " ", false)), new XElement( XName.Get("CWE.2", "urn:hl7-org:v2xml"), HL7Helper.AddMessageReference(message, reference) .ReplaceInvalidXmlCharacters(XmlVersion.Version_1_0, " ", false)), new XElement( XName.Get("CWE.3", "urn:hl7-org:v2xml"), errorTypeCode.ReplaceInvalidXmlCharacters(XmlVersion.Version_1_0, " ", false)) }) })); }
/// <summary> /// The add error reference. /// </summary> /// <param name="error"> /// The error. /// </param> /// <param name="reference"> /// The reference. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> internal static bool AddErrorReference(XElement error, string reference) { if ((error != null) && !string.IsNullOrEmpty(reference)) { foreach (var element in error.SelectByLocalName("ERR.5")) { foreach (var element2 in element.SelectByLocalName("CWE.2")) { element2.SetValue(HL7Helper.AddMessageReference(element2.Value, reference)); return(true); } } } return(false); }