Esempio n. 1
0
 public GncTransaction(GncBook book, XElement xml)
     : this(book)
 {
     _guid        = xml.ChkElement(GncName.Trn("id")).Value;
     _datePosted  = DateTimeOffset.Parse(xml.ChkElement(GncName.Trn("date-posted")).ChkElement(GncName.Ts("date")).Value).Date.AssumeUtc();
     _dateEntered = DateTimeOffset.Parse(xml.ChkElement(GncName.Trn("date-entered")).ChkElement(GncName.Ts("date")).Value).UtcDateTime;
     _num         = xml.ValueOrDefault(GncName.Trn("num"), "");
     _description = xml.ChkElement(GncName.Trn("description")).Value;
     _commodity   = _book.GetCommodity(GncCommodity.MakeIdentifier(xml.ChkElement(GncName.Trn("currency"))));
     foreach (var el in xml.ChkElement(GncName.Trn("splits")).Elements(GncName.Trn("split")))
     {
         try
         {
             GncSplit split = new GncSplit(this, el);
             _splits.Add(split.Guid, split);
         }
         catch (Exception e)
         {
             throw new Exception($"Could not read split for transaction: {_datePosted}, descr {_description}, {e.Message} ({_guid})", e);
         }
     }
 }
Esempio n. 2
0
 public GncBalsnapParseException(GncSplit split, string offendingValue)
 {
     Split          = split;
     OffendingValue = offendingValue;
 }