public List <ITransaction> GetTransactions(IBankAccount account, DateTime start, DateTime end) { var lracc = GetAccountByIdentifier(account.AccountIdentifier) as LRAccount; TextReader reader = new StringReader(LibertyReserve.GetHistory(lracc, start, end, "any")); XDocument xdoc = XDocument.Load(reader); var receipts = from t in xdoc.Descendants("Receipt") select t; var l = new List <ITransaction> (); foreach (XElement rc in receipts) { var t = new LRTransaction(); t.ValutaDate = t.Date = DateTime.Parse(rc.Element("Date").Value); // childnode Transfer var el = rc.Element("Transfer"); t.FromAccount = new LRAccount() { AccountIdentifier = el.Element("Payer").Value }; t.FromAccount.OwnerName.Add(rc.Element("PayerName").Value); //if (el.Element ("Anonymous").Value == "true") // t.ToAccount = t.FromAccount; t.ToAccount = new LRAccount() { AccountIdentifier = el.Element("Payee").Value }; t.ToAccount.OwnerName.Add(rc.Element("PayeeName").Value); t.Amount = float.Parse(el.Element("Amount").Value); t.Currency = el.Element("CurrencyId").Value; t.Purposes.Add(el.Element("Memo").Value); l.Add(t); } return(l); }
public List<ITransaction> GetTransactions(IBankAccount account, DateTime start, DateTime end) { var lracc = GetAccountByIdentifier (account.AccountIdentifier) as LRAccount; TextReader reader = new StringReader (LibertyReserve.GetHistory (lracc, start, end, "any")); XDocument xdoc = XDocument.Load (reader); var receipts = from t in xdoc.Descendants ("Receipt") select t; var l = new List<ITransaction> (); foreach (XElement rc in receipts) { var t = new LRTransaction (); t.ValutaDate = t.Date = DateTime.Parse (rc.Element ("Date").Value); // childnode Transfer var el = rc.Element ("Transfer"); t.FromAccount = new LRAccount (){ AccountIdentifier = el.Element("Payer").Value }; t.FromAccount.OwnerName.Add (rc.Element ("PayerName").Value); //if (el.Element ("Anonymous").Value == "true") // t.ToAccount = t.FromAccount; t.ToAccount = new LRAccount () { AccountIdentifier = el.Element("Payee").Value }; t.ToAccount.OwnerName.Add (rc.Element ("PayeeName").Value); t.Amount = float.Parse (el.Element ("Amount").Value); t.Currency = el.Element ("CurrencyId").Value; t.Purposes.Add (el.Element ("Memo").Value); l.Add (t); } return l; }