private void CreateXML() { int index = 0; //DataTable row index int tableNumberRows = ds.Tables[0].Rows.Count; //counts number of rows in DataTable CreditTransferTransactionInformation10[] crdtTransTransacInfoTransactions = new CreditTransferTransactionInformation10[tableNumberRows]; foreach (DataRow row in ds.Tables[0].Rows) { CreditTransferTransactionInformation10 crdtTransTransacInfo = new CreditTransferTransactionInformation10(); PaymentIdentification1 paymentIndNum = new PaymentIdentification1(); paymentIndNum.EndToEndId = index.ToString(); EquivalentAmount2 eqvAmount = new EquivalentAmount2(); ActiveOrHistoricCurrencyAndAmount curAndAmnt = new ActiveOrHistoricCurrencyAndAmount(); curAndAmnt.Ccy = row[10].ToString();//Currency curAndAmnt.Value = decimal.Parse(row[9].ToString());//Transaction ammount eqvAmount.Amt = curAndAmnt; AmountType3Choice amntType = new AmountType3Choice(); amntType.Item = eqvAmount; crdtTransTransacInfo.PmtId = paymentIndNum; crdtTransTransacInfo.Amt = amntType; crdtTransTransacInfoTransactions[index] = crdtTransTransacInfo; index++; } PaymentInstructionInformation3[] pmntInstrInf = new PaymentInstructionInformation3[1]; PaymentInstructionInformation3 pmntInstrInfIteam = new PaymentInstructionInformation3(); pmntInstrInfIteam.CdtTrfTxInf = crdtTransTransacInfoTransactions; pmntInstrInf[0] = pmntInstrInfIteam; Authorisation1Choice[] authChoiceArray = new Authorisation1Choice[1]; Authorisation1Choice authChoice = new Authorisation1Choice(); authChoice.Item = "Sergei"; authChoiceArray[0] = authChoice; GroupHeader32 grpHdr = new GroupHeader32(); grpHdr.Authstn = authChoiceArray; CustomerCreditTransferInitiationV03 cctiv = new CustomerCreditTransferInitiationV03(); cctiv.GrpHdr = grpHdr; cctiv.PmtInf = pmntInstrInf; Document document = new Document(); document.CstmrCdtTrfInitn = cctiv; var data = document; var serializer = new XmlSerializer(typeof(Document)); using (var stream = new StreamWriter("C:\\Users\\yulya\\Desktop\\test.xml")) serializer.Serialize(stream, data); }
public GroupHeader39( string messageID, System.DateTime creationDateTime, Authorisation1Choice[] authorisationChoice, string numberOfTransactions, decimal controlSum, bool controlSumSpecified, PartyIdentification32 initiatingParty, BranchAndFinancialInstitutionIdentification4 forwardingAgent) { this.msgIdField = messageID; this.creDtTmField = creationDateTime; this.authstnField = (Authorisation1Choice[])authorisationChoice.Clone(); this.nbOfTxsField = numberOfTransactions; this.ctrlSumField = controlSum; this.ctrlSumFieldSpecified = controlSumSpecified; this.initgPtyField = initiatingParty; this.fwdgAgtField = forwardingAgent; }
private void CreateXML() { int index = 0; //DataTable row index int tableNumberRows = ds.Tables[0].Rows.Count; //counts number of rows in DataTable CreditTransferTransactionInformation10[] crdtTransTransacInfoTransactions = new CreditTransferTransactionInformation10[tableNumberRows]; foreach (DataRow row in ds.Tables[0].Rows) { CreditTransferTransactionInformation10 crdtTransTransacInfo = new CreditTransferTransactionInformation10(); PaymentIdentification1 paymentIndNum = new PaymentIdentification1(); paymentIndNum.EndToEndId = index.ToString(); EquivalentAmount2 eqvAmount = new EquivalentAmount2(); ActiveOrHistoricCurrencyAndAmount curAndAmnt = new ActiveOrHistoricCurrencyAndAmount(); curAndAmnt.Ccy = row[10].ToString(); //Currency curAndAmnt.Value = decimal.Parse(row[9].ToString()); //Transaction ammount eqvAmount.Amt = curAndAmnt; AmountType3Choice amntType = new AmountType3Choice(); amntType.Item = eqvAmount; crdtTransTransacInfo.PmtId = paymentIndNum; crdtTransTransacInfo.Amt = amntType; crdtTransTransacInfoTransactions[index] = crdtTransTransacInfo; index++; } PaymentInstructionInformation3[] pmntInstrInf = new PaymentInstructionInformation3[1]; PaymentInstructionInformation3 pmntInstrInfIteam = new PaymentInstructionInformation3(); pmntInstrInfIteam.CdtTrfTxInf = crdtTransTransacInfoTransactions; pmntInstrInf[0] = pmntInstrInfIteam; Authorisation1Choice[] authChoiceArray = new Authorisation1Choice[1]; Authorisation1Choice authChoice = new Authorisation1Choice(); authChoice.Item = "Sergei"; authChoiceArray[0] = authChoice; GroupHeader32 grpHdr = new GroupHeader32(); grpHdr.Authstn = authChoiceArray; CustomerCreditTransferInitiationV03 cctiv = new CustomerCreditTransferInitiationV03(); cctiv.GrpHdr = grpHdr; cctiv.PmtInf = pmntInstrInf; Document document = new Document(); document.CstmrCdtTrfInitn = cctiv; var data = document; var serializer = new XmlSerializer(typeof(Document)); using (var stream = new StreamWriter("C:\\Users\\yulya\\Desktop\\test.xml")) serializer.Serialize(stream, data); }