Strassen werden nun richtig in csv geschrieben

This commit is contained in:
2021-08-15 13:52:32 +02:00
parent 538ec3d00b
commit 938e03ad67
6 changed files with 166 additions and 65 deletions

View File

@@ -0,0 +1,48 @@
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<ECalculatedResult, decimal> calculated, List<KanalObjekt> 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);
}
}
}