HTML styles hinzugefügt

This commit is contained in:
HuskyTeufel
2021-08-16 12:41:01 +02:00
parent c2fdd2fe7b
commit 81253eff65
5 changed files with 30 additions and 12 deletions

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
*/bin/* */bin/*
*/obj/* */obj/*
data.csv data.csv
data.html
.vs/XMLParser/DesignTimeBuild/.dtbcache.v2 .vs/XMLParser/DesignTimeBuild/.dtbcache.v2
.vs/XMLParser/v16/.suo .vs/XMLParser/v16/.suo
.vs/XMLParser/v16/TestStore/* .vs/XMLParser/v16/TestStore/*

View File

@@ -36,12 +36,13 @@ namespace XMLParser.Functions
if(length > 7.0m) SOOverlength += length - 7.0m; if(length > 7.0m) SOOverlength += length - 7.0m;
}); });
result.Add(ECalculatedResult.STRASSENABLAUFANZAHL,SEs.Count);
result.Add(ECalculatedResult.SONSTIGEANZAHL,SOs.Count); result.Add(ECalculatedResult.SONSTIGEANZAHL,SOs.Count);
result.Add(ECalculatedResult.STRASSENABLAUFLAENGEZULAGEMETER,SEOverlength);
result.Add(ECalculatedResult.SONSTIGELAENGEZULAGEMETER,SOOverlength); result.Add(ECalculatedResult.SONSTIGELAENGEZULAGEMETER,SOOverlength);
result.Add(ECalculatedResult.STRASSENABLAUFANZAHL,SEs.Count);
result.Add(ECalculatedResult.STRASSENABLAUFLAENGEZULAGEMETER,SEOverlength);
decimal HauptkanalLaenge =0.0m; decimal HauptkanalLaenge =0.0m;
List<int> ranges = new List<int>() List<int> ranges = new List<int>()

View File

@@ -4,6 +4,8 @@ using XMLParser.Contract;
using XMLParser.Model; using XMLParser.Model;
using System; using System;
using System.Text; using System.Text;
using System.Linq;
using System.Diagnostics;
namespace XMLParser.Functions.ProtokollWriter namespace XMLParser.Functions.ProtokollWriter
{ {
@@ -11,8 +13,14 @@ namespace XMLParser.Functions.ProtokollWriter
{ {
FileStream handle = null; FileStream handle = null;
Dictionary<ECalculatedResult,string> headertitles = null; Dictionary<ECalculatedResult,string> headertitles = null;
Dictionary<string,string> Entwaesserung = null;
public HTMLProtkollWriter(Dictionary<ECalculatedResult, string> headertitles) public HTMLProtkollWriter(Dictionary<ECalculatedResult, string> headertitles)
{ {
Entwaesserung = new Dictionary<string, string>();
Entwaesserung.Add("KR","Regenwasser");
Entwaesserung.Add("KS","Schmutzwasser");
Entwaesserung.Add("KM","Mischwasser");
handle = File.Create("./data.html"); handle = File.Create("./data.html");
this.headertitles = headertitles; this.headertitles = headertitles;
} }
@@ -28,12 +36,17 @@ namespace XMLParser.Functions.ProtokollWriter
{ {
writeToFile("<html>"); writeToFile("<html>");
writeToFile("<head>"); writeToFile("<head>");
writeToFile("<style>#subject { margin-top: 120px; margin-left: auto; margin-right: auto; width: 50%; }</style>");
writeToFile("</head>"); writeToFile("</head>");
writeToFile("<body>"); writeToFile("<body>");
writeToFile("<div id='root'>");
writeToFile("<div id='page'>");
writeToFile("<div id='banner'><img src='briefkopf.png' width='100%' /></div>");
} }
void writeHTMLFooter() void writeHTMLFooter()
{ {
writeToFile("</div></div>");
writeToFile("</body>"); writeToFile("</body>");
writeToFile("</html>"); writeToFile("</html>");
} }
@@ -41,6 +54,12 @@ namespace XMLParser.Functions.ProtokollWriter
public void WriteEntry(Dictionary<ECalculatedResult, decimal> calculated, List<KanalObjekt> inspektionenAmTag) public void WriteEntry(Dictionary<ECalculatedResult, decimal> calculated, List<KanalObjekt> inspektionenAmTag)
{ {
writeHTMLHeader(); writeHTMLHeader();
KanalObjekt objekt = inspektionenAmTag.Last();
//Debugger.Break();
writeToFile("<div id='subject'>");
writeToFile("<h1>"+objekt.Inspektionsdaten.Lage.Strassename+"</h1>");
writeToFile("<h1>"+Entwaesserung[objekt.Inspektionsdaten.OptischeInspektion.Rohrleitung.Grunddaten.Kanalart]+"</h1>");
writeToFile("</div>");
writeToFile("<table border='2'>"); writeToFile("<table border='2'>");
List<ECalculatedResult> avaibleHeaders = new List<ECalculatedResult>(); List<ECalculatedResult> avaibleHeaders = new List<ECalculatedResult>();
@@ -64,9 +83,7 @@ namespace XMLParser.Functions.ProtokollWriter
writeToFile("<tr>"); writeToFile("<tr>");
foreach(ECalculatedResult s in avaibleHeaders) foreach(ECalculatedResult s in avaibleHeaders)
{ {
writeToFile("<td>"); writeToFile(string.Format("<th>{0}</th>",headertitles[s]));
writeToFile(headertitles[s]);
writeToFile("</td>");
} }
writeToFile("</tr>"); writeToFile("</tr>");
} }

View File

@@ -15,21 +15,20 @@ namespace XMLProgramm
static void Main(string[] args) static void Main(string[] args)
{ {
Dictionary<ECalculatedResult,string> headertitles = new Dictionary<ECalculatedResult, string>(); Dictionary<ECalculatedResult,string> headertitles = new Dictionary<ECalculatedResult, string>();
headertitles.Add(ECalculatedResult.DN150DN250, "DN150 - DN250 [m]");
headertitles.Add(ECalculatedResult.DN300DN400, "DN300 - DN400 [m]"); headertitles.Add(ECalculatedResult.DN300DN400, "DN300 - DN400 [m]");
headertitles.Add(ECalculatedResult.DN450DN600, "DN450 - DN600 [m]"); headertitles.Add(ECalculatedResult.DN450DN600, "DN450 - DN600 [m]");
headertitles.Add(ECalculatedResult.DN650DN800, "DN650 - DN800 [m]"); headertitles.Add(ECalculatedResult.DN650DN800, "DN650 - DN800 [m]");
headertitles.Add(ECalculatedResult.DN850DN1000,"DN850 - DN1000 [m]"); headertitles.Add(ECalculatedResult.DN850DN1000,"DN850 - DN1000 [m]");
headertitles.Add(ECalculatedResult.GESAMTHAUPTKANAL,"Hauptkanal Gesamt [m]"); headertitles.Add(ECalculatedResult.GESAMTHAUPTKANAL,"Hauptkanal Gesamt [m]");
headertitles.Add(ECalculatedResult.STRASSENABLAUFANZAHL, "Straßenablauf [Stk]"); headertitles.Add(ECalculatedResult.STRASSENABLAUFANZAHL, "Straßenablauf [Stk]");
headertitles.Add(ECalculatedResult.STRASSENABLAUFLAENGEZULAGEMETER,"Straßenablauf > 5m [m]"); headertitles.Add(ECalculatedResult.STRASSENABLAUFLAENGEZULAGEMETER,"Zulage Länge Straßenablauf über 5m [m]");
headertitles.Add(ECalculatedResult.SONSTIGEANZAHL,"Anschlussleitung [Stk]"); headertitles.Add(ECalculatedResult.SONSTIGEANZAHL,"Anschlussleitung [Stk]");
headertitles.Add(ECalculatedResult.SONSTIGELAENGEZULAGEMETER,"Anschlussleitung > 7m [m]"); headertitles.Add(ECalculatedResult.SONSTIGELAENGEZULAGEMETER,"Zulage Länge Anschlussleitung über 7m [m]");
headertitles.Add(ECalculatedResult.DN150DN250, "DN150 - DN250 [m]");
//ICSVWriter csvWriter = new StrassenUmsatzCSVWriter(); //ICSVWriter csvWriter = new StrassenUmsatzCSVWriter();
IProtokollWriter protokollWriter = new XMLParser.Functions.ProtokollWriter.HTMLProtkollWriter(headertitles); IProtokollWriter protokollWriter = new XMLParser.Functions.ProtokollWriter.HTMLProtkollWriter(headertitles);
XMLParse ser = new XMLParse("2021-07-29_KR_H_L_Oldenburg_Eichenstraße.xml"); XMLParse ser = new XMLParse("2021-08-12_KS_H_L_Oldenburg_Hüllsteder-Straße.xml");
IUmsatzCalculator calculator = new XMLParser.Functions.UmsatzCalculator.StrassenUmsatz(); IUmsatzCalculator calculator = new XMLParser.Functions.UmsatzCalculator.StrassenUmsatz();
calculator.Calculate(protokollWriter,ser.KanalObjekte); calculator.Calculate(protokollWriter,ser.KanalObjekte);

BIN
briefkopf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB