protected override void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo) { if (aMessageInfo.MessageType != SepaMessageType.DirectDebitPaymentInitiation) { throw new ArgumentException(); } base.WritePmtIdXml(aXmlWriter); base.WriteInstdAmtXml(aXmlWriter); aXmlWriter.WriteStartElement("DrctDbtTx"); aXmlWriter.WriteStartElement("MndtRltdInf"); aXmlWriter.WriteElementString("MndtId", this.m_sMndtId); SepaUtil.WriteDtXml(aXmlWriter, "DtOfSgntr", this.m_dtMndtDtOfSgntr); if ((((this.m_sOrgnlMndtId != null) && (this.m_sOrgnlMndtId != "")) || ((this.m_sOrgnlCdtrNm != null) && (this.m_sOrgnlCdtrNm != ""))) || (((this.m_sOrgnlCdtrSchmeId != null) && (this.m_sOrgnlCdtrSchmeId != "")) || (!this.m_tOrgnlDbtrAcctIBAN.IsNull || this.m_fSMNDA))) { aXmlWriter.WriteElementString("AmdmntInd", "true"); aXmlWriter.WriteStartElement("AmdmntInfDtls"); if ((this.m_sOrgnlMndtId != null) && (this.m_sOrgnlMndtId != "")) { aXmlWriter.WriteElementString("OrgnlMndtId", this.m_sOrgnlMndtId); } if (((this.m_sOrgnlCdtrNm != null) && (this.m_sOrgnlCdtrNm != "")) || ((this.m_sOrgnlCdtrSchmeId != null) && (this.m_sOrgnlCdtrSchmeId != ""))) { aXmlWriter.WriteStartElement("OrgnlCdtrSchmeId"); if ((this.m_sOrgnlCdtrNm != null) && (this.m_sOrgnlCdtrNm != "")) { aXmlWriter.WriteElementString("Nm", this.m_sOrgnlCdtrNm); } if ((this.m_sOrgnlCdtrSchmeId != null) && (this.m_sOrgnlCdtrSchmeId != "")) { SepaUtil.WriteSepaIdXml(aXmlWriter, this.m_sOrgnlCdtrSchmeId, aMessageInfo.Version == 1); } aXmlWriter.WriteEndElement(); } if (!this.m_tOrgnlDbtrAcctIBAN.IsNull) { SepaUtil.WriteAcctXml(aXmlWriter, "OrgnlDbtrAcct", this.m_tOrgnlDbtrAcctIBAN, null); } if (this.m_fSMNDA) { aXmlWriter.WriteStartElement("OrgnlDbtrAgt"); aXmlWriter.WriteStartElement("FinInstnId"); aXmlWriter.WriteStartElement("Othr"); aXmlWriter.WriteElementString("Id", "SMNDA"); aXmlWriter.WriteEndElement(); aXmlWriter.WriteEndElement(); aXmlWriter.WriteEndElement(); } aXmlWriter.WriteEndElement(); } else { aXmlWriter.WriteElementString("AmdmntInd", "false"); } aXmlWriter.WriteEndElement(); if (aMessageInfo.Version == 1) { SepaDirectDebitPaymentInformation paymentInformation = (SepaDirectDebitPaymentInformation)base.PaymentInformation; if (paymentInformation == null) { throw new InvalidOperationException(); } string creditorSchemeIdentification = paymentInformation.CreditorSchemeIdentification; switch (creditorSchemeIdentification) { case null: case "": throw new InvalidOperationException(); } SepaUtil.WriteCdtrSchmeIdXml(aXmlWriter, creditorSchemeIdentification, true); } aXmlWriter.WriteEndElement(); SepaUtil.WriteAgtBIC(aXmlWriter, "DbtrAgt", this.m_tDbtrAgtBIC); this.m_aDbtr.WriteXml(aXmlWriter, aMessageInfo); SepaUtil.WriteAcctXml(aXmlWriter, "DbtrAcct", this.m_tDbtrAcctIBAN, null); if (!this.m_aUltmtDbtr.IsEmpty()) { this.m_aUltmtDbtr.WriteXml(aXmlWriter, aMessageInfo); } if (aMessageInfo.XmlNamespace != "urn:sepade:xsd:pain.008.001.01") { base.WritePurpXml(aXmlWriter); } base.WriteRmtInfXml(aXmlWriter); }