Esempio n. 1
0
        private static Tuple<DateTime, DateTime> getMinAndMaxRecordTime(IEnumerable<NetBankRecordRead> records, Configuration config)
        {
            var maxRecordTime = records.Select(read => read.Buchungstag).Where(time => time < DateTime.Today).Max();
            var minRecordTime = config.LastWrite ?? DateTime.MinValue;

            return new Tuple<DateTime, DateTime>(minRecordTime, maxRecordTime);
        }
Esempio n. 2
0
        private static void generateRecordWrites(IEnumerable<NetBankRecordRead> records, Configuration config, 
			Action<NetBankRecordWrite> continueForCompleteItems, Action<NetBankRecordWrite> continueForIncompleteItems)
        {
            foreach (var record in records
                .Select(netBankRecord => new { netBankRecord, kategory = GetCategoryAndEmpfänger(config, netBankRecord) })
                .Select(@t => new NetBankRecordWrite(@t.netBankRecord, @t.kategory.Item1, @t.kategory.Item2)))
            {
                if (String.IsNullOrEmpty(record.Empfänger))
                    continueForIncompleteItems(record);
                else
                    continueForCompleteItems(record);
            }
        }
Esempio n. 3
0
        private static Tuple<string, string> GetCategoryAndEmpfänger(Configuration config, NetBankRecordRead netBankRecordRead)
        {
            foreach (var category in config.Categories
                .Where(category => category.Keywords
                    .Any(keyword => netBankRecordRead.Verwendungszweck.ToLower().Contains(keyword.Name.ToLower()))))
            {
                return new Tuple<string, string>(category.Name,
                    category.Keywords.Where(keyword => netBankRecordRead.Verwendungszweck.ToLower().Contains(keyword.Name.ToLower()))
                        .Select(keyword => keyword.Empfänger ?? keyword.Name)
                        .Single());
            }

            return new Tuple<string, string>("", "");
        }
Esempio n. 4
0
 private static void writeMaxRecordTimeToConfig(Configuration config, DateTime maxRecordTime)
 {
     config.LastWrite = maxRecordTime;
     var serializer = new XmlSerializer(typeof(Configuration));
     using (var writer = new XmlTextWriter(_configurationPath, Encoding.UTF8))
     {
         serializer.Serialize(writer, config);
     }
 }