private void GetCustomRecord(XElement sub, FileTransaction ftr) { foreach (XElement cr in sub.Descendants("CustomRecords").Descendants("Record")) { if (cr.Element("Name") != null && cr.Element("Name").Value == "Charge Code Desc") { ftr.CustChargeCode = cr.Element("Name").Value; if (cr.Element("Value") != null) ftr.CustChargeCodeDesc = cr.Element("Value").Value; } } }
public void GetIdValues(XElement src) { foreach (XElement sub in src.Descendants("FileTransactions")) { string id = sub.Element("Identification").Element("IDValue").Value; FileTransaction ftr = new FileTransaction(); ftr.TransId = id; if (sub.Element("TransDate") != null) ftr.TransDate = sub.Element("TransDate").Value; if (sub.Element("TransTypeDesc") != null) ftr.TransTypeDesc = sub.Element("TransTypeDesc").Value; if (sub.Element("TransType") != null) ftr.TransType = sub.Element("TransType").Value; if (sub.Element("TransAmount") != null) ftr.TransAmount = sub.Element("TransAmount").Value; if (sub.Element("OpenAmount") != null) { ftr.OpenAmount = sub.Element("OpenAmount").Value; assignedAmt += Convert.ToDecimal(ftr.OpenAmount); } if (!IdValues.ContainsKey(id)) IdValues.Add(id, ftr); if (sub.Descendants("CustomRecords") != null) { GetCustomRecord(sub, ftr); } } AssignedAmount = assignedAmt.ToString(); }