コード例 #1
0
        public static IEnumerable<Entry> ConvertToEntries(this IEnumerable<QIFTransaction> transactions)
        {
            var contentTypes = QIFContentType.GetAll().ToList();
            foreach (var transaction in transactions)
            {
                var entry = new Entry
                    {
                        IsHeader = transaction.Records.Any(x => x.RecordType.IsHeader),
                        IsAccountHeader = transaction.Records.Any(x => x.RecordType == QIFRecordType.AccountHeader)
                    };

                foreach (var record in transaction.Records.Where(x => x.RecordType == QIFRecordType.Content))
                {
                    var record1 = record;
                    var contentType = contentTypes.FirstOrDefault(x => x.IsMatch(entry, record1));
                    if (contentType == null)
                    {
                        throw new ArgumentException("Don't know how to handle: " + record1.Data);
                    }
                    try
                    {
                        contentType.Update(entry, record1);
                    }
                    catch (Exception e)
                    {
                        throw new ArgumentException("Unable to convert the following to a value on Entry: " + record1.Data, e);
                    }
                }
                yield return entry;
            }
        }
コード例 #2
0
 public void Before_first_test()
 {
     _record = new QIFRecord(QIFRecordType.Content, Input);
     _entry = new Entry
         {
             IsAccountHeader = true
         };
     _contentType = QIFContentType.AccountName;
 }
コード例 #3
0
                public void Before_first_test()
                {
                    _record = new QIFRecord(QIFRecordType.Content, Input);

                    _entry = new Entry();
                    _contentType = QIFContentType.TransferAmount;
                }
コード例 #4
0
                public void Before_first_test()
                {
                    _record = new QIFRecord(QIFRecordType.Content, Input);

                    _entry = new Entry();
                    _contentType = QIFContentType.Quantity;
                }
コード例 #5
0
 public void Before_first_test()
 {
     _record = new QIFRecord(QIFRecordType.Content, Input);
     _entry = new Entry
         {
             IsAccountHeader = false
         };
     _contentType = QIFContentType.ItemDescription;
 }
コード例 #6
0
                public void Before_first_test()
                {
                    _record = new QIFRecord(QIFRecordType.Content, Input);

                    _entry = new Entry();
                    _contentType = QIFContentType.ClearedStatus;
                }