using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using XMLParser.Contract; using XMLParser.Model; namespace XMLParser.Functions { [DebuggerDisplay("{" + nameof(GetDebuggerDisplay) + "(),nq}")] public class TagesUmsatzCSVWriter : CSVWriterBase { public TagesUmsatzCSVWriter() { handle = File.Create("./data.csv"); string WriteHeader = "Inspektionsdatum#Anzahl Straßenablaufe#Länge über 5m#SonstigeLeitungen#Sonstige Länge über 5m#Hauptkanallänge"; writeToFile(WriteHeader); } public void Save() { handle.Close(); } private string GetDebuggerDisplay() { return ToString(); } public override void WriteEntry(Dictionary calculated, List inspektionenAmTag) { int anzahlStraßenablaufe = (int)calculated[ECalculatedResult.STRASSENABLAUFANZAHL]; int sonstigeLeitungen = (int)calculated[ECalculatedResult.SONSTIGEANZAHL]; decimal Strassenablaufzulage = calculated[ECalculatedResult.STRASSENABLAUFLAENGEZULAGEMETER]; decimal Sonstigezulage = calculated[ECalculatedResult.SONSTIGELAENGEZULAGEMETER]; decimal HauptkanalLänge = calculated[ECalculatedResult.GESAMTHAUPTKANAL]; KanalObjekt last = inspektionenAmTag.Last(); string entry = last.Inspektionsdaten.OptischeInspektion.Inspektionsdatum + "#"+anzahlStraßenablaufe+"#"+Strassenablaufzulage+"#"+sonstigeLeitungen+"#"+Sonstigezulage+"#"+HauptkanalLänge; writeToFile(entry); } } }