Bewertungen werden nun gelesen
This commit is contained in:
14
ConsoleApp1/ConsoleApp1.csproj
Normal file
14
ConsoleApp1/ConsoleApp1.csproj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Schnittstelle\Schnittstelle.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
6
ConsoleApp1/Program.cs
Normal file
6
ConsoleApp1/Program.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
using Schnittstelle.Import.XML.v2006;
|
||||
using System.Diagnostics;
|
||||
|
||||
XML2006 xml = new XML2006("../../../../test_code.xml");
|
||||
Debugger.Break();
|
||||
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.5.33530.505
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Schnittstelle", "Schnittstelle\Schnittstelle.csproj", "{94F52E13-5A5C-444D-8F65-8C61867DF247}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{8B8B0D9B-F90B-420F-A460-B8585DB35CCF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -15,6 +17,10 @@ Global
|
||||
{94F52E13-5A5C-444D-8F65-8C61867DF247}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{94F52E13-5A5C-444D-8F65-8C61867DF247}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{94F52E13-5A5C-444D-8F65-8C61867DF247}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8B8B0D9B-F90B-420F-A460-B8585DB35CCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8B8B0D9B-F90B-420F-A460-B8585DB35CCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8B8B0D9B-F90B-420F-A460-B8585DB35CCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8B8B0D9B-F90B-420F-A460-B8585DB35CCF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class AbwassertechnischeAnlage
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Anschlussdaten
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Anschlusspunkt
|
||||
{
|
||||
23
Schnittstelle/Import/XML/v2013/Model/Bewertung.cs
Normal file
23
Schnittstelle/Import/XML/v2013/Model/Bewertung.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Bewertung
|
||||
{
|
||||
uint bewertungsverfahren;
|
||||
string bewertungsdatum = "";
|
||||
uint zahlVorlaeufig;
|
||||
uint zusatzpunkte;
|
||||
uint klasseAutomatisch;
|
||||
uint klasseManuell;
|
||||
string massgebenderSchaden = "";
|
||||
string massgebendeQuantifizierung = "";
|
||||
|
||||
public uint Bewertungsverfahren { get => bewertungsverfahren; set => bewertungsverfahren = value; }
|
||||
public string Bewertungsdatum { get => bewertungsdatum; set => bewertungsdatum = value; }
|
||||
public uint ZahlVorlaeufig { get => zahlVorlaeufig; set => zahlVorlaeufig = value; }
|
||||
public uint Zusatzpunkte { get => zusatzpunkte; set => zusatzpunkte = value; }
|
||||
public uint KlasseAutomatisch { get => klasseAutomatisch; set => klasseAutomatisch = value; }
|
||||
public uint KlasseManuell { get => klasseManuell; set => klasseManuell = value; }
|
||||
public string MassgebenderSchaden { get => massgebenderSchaden; set => massgebenderSchaden = value; }
|
||||
public string MassgebendeQuantifizierung { get => massgebendeQuantifizierung; set => massgebendeQuantifizierung = value; }
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public enum EAnlagetyp
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Geometrie
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Geometriedaten
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public sealed class InspizierteAbwassertechnischeAnlage
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class KanalObjekt
|
||||
{
|
||||
@@ -1,11 +1,11 @@
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Kante
|
||||
{
|
||||
decimal sohlhoeheZulauf;
|
||||
decimal sohlhoeheAblauf;
|
||||
Knoten knotenZulauf;
|
||||
Knoten knotenAblauf;
|
||||
Knoten? knotenZulauf;
|
||||
Knoten? knotenAblauf;
|
||||
int knotenAblaufTyp;
|
||||
int knotenZulaufTyp;
|
||||
bool isFiktiveLeitung = true;
|
||||
@@ -16,8 +16,8 @@ namespace XMLParser.Model
|
||||
|
||||
public decimal SohlhoeheZulauf { get => sohlhoeheZulauf; set => sohlhoeheZulauf = value; }
|
||||
public decimal SohlhoeheAblauf { get => sohlhoeheAblauf; set => sohlhoeheAblauf = value; }
|
||||
public Knoten KnotenZulauf { get => knotenZulauf; set => knotenZulauf = value; }
|
||||
public Knoten KnotenAblauf { get => knotenAblauf; set => knotenAblauf = value; }
|
||||
public Knoten? KnotenZulauf { get => knotenZulauf; set => knotenZulauf = value; }
|
||||
public Knoten? KnotenAblauf { get => knotenAblauf; set => knotenAblauf = value; }
|
||||
public int KnotenAblaufTyp { get => knotenAblaufTyp; set => knotenAblaufTyp = value; }
|
||||
public int KnotenZulaufTyp { get => knotenZulaufTyp; set => knotenZulaufTyp = value; }
|
||||
public bool IsFiktiveLeitung { get => isFiktiveLeitung; set => isFiktiveLeitung = value; }
|
||||
16
Schnittstelle/Import/XML/v2013/Model/Klassifizierung.cs
Normal file
16
Schnittstelle/Import/XML/v2013/Model/Klassifizierung.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Klassifizierung
|
||||
{
|
||||
public Klassifizierung_Betriebssicherheit? Betriebssicherheit;
|
||||
public Klassifizierung_Dichtheit? Dichtheit;
|
||||
public Klassifizierung_Standsicherheit? Standsicherheit;
|
||||
public uint MaxSZeAuto;
|
||||
public uint MaxSKeAuto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Klassifizierung_Betriebssicherheit
|
||||
{
|
||||
public uint SKBvAuto;
|
||||
public uint SKBvManu;
|
||||
public uint SZBvAuto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Klassifizierung_Dichtheit
|
||||
{
|
||||
public uint SKDvAuto;
|
||||
public uint SKDvManu;
|
||||
public uint SZDvAuto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Klassifizierung_Standsicherheit
|
||||
{
|
||||
public uint SKSvAuto;
|
||||
public uint SKSvManu;
|
||||
public uint SZSvAuto;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Knoten
|
||||
{
|
||||
@@ -1,5 +1,6 @@
|
||||
namespace XMLParser.Model
|
||||
{
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
|
||||
public class Lage
|
||||
{
|
||||
string strassename;
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class OptischeInspektion
|
||||
{
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class PolyKante
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Profil
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class RGrunddaten
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public struct Quantifizierung
|
||||
{
|
||||
@@ -28,6 +28,7 @@ namespace XMLParser.Model
|
||||
int positionVon;
|
||||
int positionBis;
|
||||
string kommentar;
|
||||
Klassifizierung? klassifizierung;
|
||||
|
||||
public decimal Station { get => station; set => station = value; }
|
||||
public string Inspektionskode { get => inspektionskode; set => inspektionskode = value; }
|
||||
@@ -41,5 +42,6 @@ namespace XMLParser.Model
|
||||
public int PositionVon { get => positionVon; set => positionVon = value; }
|
||||
public int PositionBis { get => positionBis; set => positionBis = value; }
|
||||
public string Kommentar { get => kommentar; set => kommentar = value; }
|
||||
public Klassifizierung? Klassifizierung { get => klassifizierung; set => klassifizierung = value; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Rohrleitung
|
||||
{
|
||||
@@ -8,6 +8,7 @@ namespace XMLParser.Model
|
||||
decimal inspektionslaenge;
|
||||
string inspektionsrichtung;
|
||||
RGrunddaten grunddaten = null;
|
||||
Bewertung? bewertung;
|
||||
List<RZustand> zustaende = null;
|
||||
|
||||
public ERohrleitungstyp Rohrleitungstyp
|
||||
@@ -72,5 +73,7 @@ namespace XMLParser.Model
|
||||
grunddaten = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Bewertung? Bewertung { get => bewertung; set => bewertung = value; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace XMLParser.Model
|
||||
namespace Schnittstelle.Import.XML.v2013.Model
|
||||
{
|
||||
public class Schacht
|
||||
{
|
||||
559
Schnittstelle/Import/XML/v2013/XML2006.cs
Normal file
559
Schnittstelle/Import/XML/v2013/XML2006.cs
Normal file
@@ -0,0 +1,559 @@
|
||||
using Schnittstelle.Import.XML.v2013.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
|
||||
namespace Schnittstelle.Import.XML.v2013
|
||||
{
|
||||
public class XML2013
|
||||
{
|
||||
private string xmlFile;
|
||||
private List<AbwassertechnischeAnlage> stammdaten = null;
|
||||
private List<InspizierteAbwassertechnischeAnlage> inspektionsdaten = null;
|
||||
private XmlNamespaceManager manager = null;
|
||||
private XmlNode rootChild = null;
|
||||
private List<KanalObjekt> kanalObjekte = null;
|
||||
private Queue<AbwassertechnischeAnlage> QueueToRebuild = new Queue<AbwassertechnischeAnlage>();
|
||||
|
||||
public List<KanalObjekt> KanalObjekte { get => kanalObjekte; private set => kanalObjekte = value; }
|
||||
public string XmlFile { get => xmlFile; private set => xmlFile = value; }
|
||||
|
||||
public XML2013(string xmltoparse)
|
||||
{
|
||||
XmlFile = xmltoparse;
|
||||
KanalObjekte = new List<KanalObjekt>();
|
||||
stammdaten = new List<AbwassertechnischeAnlage>();
|
||||
inspektionsdaten = new List<InspizierteAbwassertechnischeAnlage>();
|
||||
ParseFile();
|
||||
RebuildStammdaten();
|
||||
}
|
||||
|
||||
private void RebuildStammdaten()
|
||||
{
|
||||
// liste an knoten
|
||||
List<AbwassertechnischeAnlage> knoten = stammdaten.FindAll(x => x.ObjektArt == EObjektArt.KNOTEN);
|
||||
List<string> notFoundKnoten = new List<string>();
|
||||
while (QueueToRebuild.Count > 0)
|
||||
{
|
||||
AbwassertechnischeAnlage anlage = QueueToRebuild.Dequeue();
|
||||
anlage.Kante.KnotenZulauf = knoten.First(x => x.Objektbezeichnung.Equals(anlage.Kante.knotenZulaufTemp)).Knoten;
|
||||
var d = knoten.FirstOrDefault(x => x.Objektbezeichnung.Equals(anlage.Kante.knotenAblaufTemp));
|
||||
if (d == null)
|
||||
{
|
||||
notFoundKnoten.Add(anlage.Kante.knotenAblaufTemp);
|
||||
}
|
||||
else
|
||||
{
|
||||
anlage.Kante.KnotenAblauf = d.Knoten;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseFile()
|
||||
{
|
||||
Tuple<List<AbwassertechnischeAnlage>, List<InspizierteAbwassertechnischeAnlage>> src = LoadRawFile();
|
||||
stammdaten = src.Item1;
|
||||
inspektionsdaten = src.Item2;
|
||||
foreach (InspizierteAbwassertechnischeAnlage iat in inspektionsdaten)
|
||||
{
|
||||
AbwassertechnischeAnlage stammdatens = stammdaten.Find(x => x.Objektbezeichnung.Equals(iat.Objektbezeichnung));//;
|
||||
string[] filepathsplited = this.XmlFile.Split(Path.DirectorySeparatorChar);
|
||||
|
||||
KanalObjekte.Add(new KanalObjekt()
|
||||
{
|
||||
XmlFileName = filepathsplited[filepathsplited.Count() - 1],
|
||||
Stammdaten = stammdatens,
|
||||
Inspektionsdaten = iat,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
private Tuple<List<AbwassertechnischeAnlage>, List<InspizierteAbwassertechnischeAnlage>> LoadRawFile()
|
||||
{
|
||||
List<AbwassertechnischeAnlage> Stammdaten = new List<AbwassertechnischeAnlage>();
|
||||
List<InspizierteAbwassertechnischeAnlage> Inspektionsdaten = new List<InspizierteAbwassertechnischeAnlage>();
|
||||
|
||||
if (!File.Exists(XmlFile)) throw new FileNotFoundException(string.Format("XML Datei mit den Pfad {0} wurde nicht gefunden", XmlFile));
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(XmlFile);
|
||||
rootChild = doc.LastChild;
|
||||
|
||||
manager = new XmlNamespaceManager(doc.NameTable);
|
||||
manager.AddNamespace("e", "http://www.ofd-hannover.la/Identifikation");
|
||||
rootChild = rootChild.SelectSingleNode("//e:Datenkollektive", manager);
|
||||
|
||||
Stammdaten = LoadStammdatenCollectiv();
|
||||
Inspektionsdaten = LoadInspektionsdatenCollectiv();
|
||||
return new Tuple<List<AbwassertechnischeAnlage>, List<InspizierteAbwassertechnischeAnlage>>(Stammdaten, Inspektionsdaten);
|
||||
}
|
||||
|
||||
private List<InspizierteAbwassertechnischeAnlage> LoadInspektionsdatenCollectiv()
|
||||
{
|
||||
List<InspizierteAbwassertechnischeAnlage> result = new List<InspizierteAbwassertechnischeAnlage>();
|
||||
XmlNode zstdk = rootChild.SelectSingleNode("//e:Zustandsdatenkollektiv", manager);
|
||||
XmlNodeList Inspektionsdaten = zstdk.SelectNodes("//e:InspizierteAbwassertechnischeAnlage", manager);
|
||||
|
||||
foreach (XmlNode node in Inspektionsdaten)
|
||||
{
|
||||
result.Add(ParseInspektion(node));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static InspizierteAbwassertechnischeAnlage ParseInspektion(XmlNode node)
|
||||
{
|
||||
InspizierteAbwassertechnischeAnlage result = new InspizierteAbwassertechnischeAnlage();
|
||||
foreach (XmlNode d in node.ChildNodes)
|
||||
{
|
||||
switch (d.Name)
|
||||
{
|
||||
case "Objektbezeichnung": result.Objektbezeichnung = d.InnerText; break;
|
||||
case "Anlagentyp": result.Anlagentyp = (EAnlagetyp)Convert.ToInt32(d.InnerText); break;
|
||||
case "Lage":
|
||||
if (!d.HasChildNodes) break;
|
||||
string strassename = "";
|
||||
string ortname = "";
|
||||
foreach (XmlNode _temp in d.ChildNodes)
|
||||
{
|
||||
switch (_temp.Name)
|
||||
{
|
||||
case "Strassenname": strassename = _temp.InnerText; break;
|
||||
case "Ortsteilname": ortname = _temp.InnerText; break;
|
||||
//case "LageOberflaeche": break;
|
||||
case "Strassenschluessel": break;
|
||||
//case "Ortsteilschluessel": break;
|
||||
default: throw new NotImplementedException(_temp.Name);
|
||||
}
|
||||
}
|
||||
result.Lage = new Lage(strassename, ortname);
|
||||
break;
|
||||
case "OptischeInspektion": result.OptischeInspektion = parseOptischeInspektion(d); break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static OptischeInspektion parseOptischeInspektion(XmlNode d)
|
||||
{
|
||||
OptischeInspektion result = new OptischeInspektion();
|
||||
string datum = "";
|
||||
string time = "";
|
||||
foreach (XmlNode node in d.ChildNodes)
|
||||
{
|
||||
switch (node.Name)
|
||||
{
|
||||
case "Auftragskennung":
|
||||
result.Auftragskennung = Convert.ToInt32(node.InnerText);
|
||||
break;
|
||||
case "Inspektionsdatum": datum = node.InnerText; break;
|
||||
case "Inspektionsverfahren": result.Inspektionsverfahren = (EInspektionverfahren)Convert.ToInt32(node.InnerText); break;
|
||||
case "NameUntersucher": result.NameUntersucher = node.InnerText; break;
|
||||
case "Uhrzeit": time = node.InnerText; break;
|
||||
case "Wetter": result.Wetter = (EWetter)Convert.ToInt32(node.InnerText); break;
|
||||
case "Reinigung": result.Reinigung = node.InnerText.Equals("1") ? true : false; break;
|
||||
case "Wasserhaltung": result.Wasserhaltung = (EWasserhaltung)Convert.ToInt32(node.InnerText); break;
|
||||
case "Rohrleitung": result.Rohrleitung = parseRohrleitung(node); break;
|
||||
case "Videoablagereferenz": break;
|
||||
case "Temperatur": break;
|
||||
case "VideoSpeichermedium": break;
|
||||
case "Knoten": break;
|
||||
default: throw new NotImplementedException(node.Name);
|
||||
}
|
||||
}
|
||||
result.Inspektionstime = makeInspektionstime(datum, time);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Rohrleitung parseRohrleitung(XmlNode node)
|
||||
{
|
||||
Rohrleitung result = new Rohrleitung();
|
||||
foreach (XmlNode d in node)
|
||||
{
|
||||
switch (d.Name)
|
||||
{
|
||||
case "Rohrleitungstyp":
|
||||
result.Rohrleitungstyp = (ERohrleitungstyp)Convert.ToInt32(d.InnerText);
|
||||
break;
|
||||
case "Inspektionslaenge":
|
||||
result.Inspektionslaenge = Convert.ToDecimal(d.InnerText.Replace('.', ','));
|
||||
break;
|
||||
case "Inspektionsrichtung":
|
||||
result.Inspektionsrichtung = d.InnerText;
|
||||
break;
|
||||
case "RGrunddaten":
|
||||
result.Grunddaten = ParseGrundDaten(d);
|
||||
break;
|
||||
case "Inspektionsdaten":
|
||||
result.Zustaende = ParseRZustand(d);
|
||||
break;
|
||||
case "Bewertung": result.Bewertung = ParseBewertung(d); break;
|
||||
|
||||
case "BezugspunktLage":
|
||||
case "Inspektionsart":
|
||||
case "ArtVideoreferenz": break;
|
||||
|
||||
default: throw new NotImplementedException(d.Name);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Bewertung? ParseBewertung(XmlNode intBewertung)
|
||||
{
|
||||
Bewertung result = new Bewertung();
|
||||
foreach(XmlNode d in intBewertung)
|
||||
{
|
||||
switch(d.Name)
|
||||
{
|
||||
case "Bewertungsverfahren": result.Bewertungsverfahren = Convert.ToUInt32(d.InnerText); break;
|
||||
case "Bewertungsdatum": result.Bewertungsdatum = d.InnerText; break;
|
||||
case "ZahlVorlaeufig": result.ZahlVorlaeufig = Convert.ToUInt32(d.InnerText); break;
|
||||
case "Zusatzpunkte": result.Zusatzpunkte = Convert.ToUInt32(d.InnerText); break;
|
||||
case "KlasseAutomatisch": result.KlasseAutomatisch = Convert.ToUInt32(d.InnerText); break;
|
||||
case "KlasseManuell": result.KlasseManuell = Convert.ToUInt32(d.InnerText); break;
|
||||
case "MassgebenderSchaden": result.MassgebenderSchaden = d.InnerText; break;
|
||||
case "MassgebendeQuantifizierung": result.MassgebendeQuantifizierung = d.InnerText; break;
|
||||
default: throw new NotImplementedException(d.Name);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private static List<RZustand> ParseRZustand(XmlNode node)
|
||||
{
|
||||
List<RZustand> result = new List<RZustand>();
|
||||
|
||||
foreach (XmlNode child in node.ChildNodes)
|
||||
{
|
||||
RZustand rZustand = new RZustand();
|
||||
foreach (XmlNode d in child.ChildNodes)
|
||||
{
|
||||
|
||||
switch (d.Name)
|
||||
{
|
||||
case "Station":
|
||||
rZustand.Station = Convert.ToDecimal(d.InnerText.Replace('.', ','));
|
||||
break;
|
||||
case "InspektionsKode":
|
||||
rZustand.Inspektionskode = d.InnerText;
|
||||
break;
|
||||
case "Charakterisierung1":
|
||||
rZustand.Charakterisierung1 = d.InnerText;
|
||||
break;
|
||||
case "Charakterisierung2":
|
||||
rZustand.Charakterisierung2 = d.InnerText;
|
||||
break;
|
||||
case "Verbindung":
|
||||
rZustand.Verbindung = d.InnerText.Equals("0") ? false : true;
|
||||
break;
|
||||
case "PositionVon":
|
||||
rZustand.PositionVon = Convert.ToInt32(d.InnerText);
|
||||
break;
|
||||
case "PositionBis":
|
||||
rZustand.PositionBis = Convert.ToInt32(d.InnerText);
|
||||
break;
|
||||
case "Quantifizierung1Numerisch":
|
||||
Quantifizierung quantifizierung1 = new Quantifizierung();
|
||||
quantifizierung1.Numerisch = Convert.ToDecimal(d.InnerText.Replace('.', ','));
|
||||
rZustand.Quantifizierung1 = quantifizierung1;
|
||||
break;
|
||||
case "Quantifizierung2Numerisch":
|
||||
Quantifizierung quantifizierung2 = new Quantifizierung();
|
||||
quantifizierung2.Numerisch = Convert.ToDecimal(d.InnerText.Replace('.', ','));
|
||||
rZustand.Quantifizierung1 = quantifizierung2;
|
||||
break;
|
||||
case "Quantifizierung1Text":
|
||||
Quantifizierung quantifizierung3 = new Quantifizierung();
|
||||
quantifizierung3.Text = d.InnerText;
|
||||
rZustand.Quantifizierung1 = quantifizierung3;
|
||||
break;
|
||||
case "Quantifizierung2Text":
|
||||
Quantifizierung quantifizierung4 = new Quantifizierung();
|
||||
quantifizierung4.Text = d.InnerText;
|
||||
rZustand.Quantifizierung2 = quantifizierung4;
|
||||
break;
|
||||
case "Frame": break;
|
||||
case "Klassifizierung": rZustand.Klassifizierung = ParseKlassifizierung(d); break;
|
||||
case "Kommentar": rZustand.Kommentar = d.InnerText; break;
|
||||
case "Streckenschaden": rZustand.Streckenschaden = d.InnerText; break;
|
||||
case "StreckenschadenLfdNr": rZustand.Streckenschadennr = Convert.ToInt32(d.InnerText); break;
|
||||
case "BezeichnungSanierung": break;
|
||||
case "RVerfahrenSanierung": break;
|
||||
case "Fotodatei": break;
|
||||
case "FotoSpeichermedium": break;
|
||||
case "Fotonummer": break;
|
||||
case "Timecode": break;
|
||||
case "GrundAbbruch": break;
|
||||
default: throw new NotImplementedException(d.Name);
|
||||
|
||||
}
|
||||
}
|
||||
result.Add(rZustand);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Klassifizierung? ParseKlassifizierung(XmlNode intKlassifizierung)
|
||||
{
|
||||
Klassifizierung klassifizierung = new Klassifizierung();
|
||||
foreach(XmlNode d in intKlassifizierung.ChildNodes)
|
||||
{
|
||||
switch(d.Name)
|
||||
{
|
||||
case "Dichtheit": klassifizierung.Dichtheit = ParseKlassifizierung_Dichtheit(d); break;
|
||||
case "Betriebssicherheit": klassifizierung.Betriebssicherheit = ParseKlassifizierung_Betriebssicherheit(d); break;
|
||||
case "Standsicherheit": klassifizierung.Standsicherheit = ParseKlassifizierung_Standsicherheit(d); break;
|
||||
case "MaxSZeAuto": klassifizierung.MaxSZeAuto = Convert.ToUInt32(d.InnerText); break;
|
||||
case "MaxSKeAuto": klassifizierung.MaxSKeAuto = Convert.ToUInt32(d.InnerText); break;
|
||||
default: throw new NotImplementedException(d.Name);
|
||||
}
|
||||
}
|
||||
return klassifizierung;
|
||||
}
|
||||
|
||||
private static Klassifizierung_Standsicherheit? ParseKlassifizierung_Standsicherheit(XmlNode intKlassifizierung_standsicherheit)
|
||||
{
|
||||
Klassifizierung_Standsicherheit klassifizierung = new Klassifizierung_Standsicherheit();
|
||||
foreach (XmlNode d in intKlassifizierung_standsicherheit)
|
||||
{
|
||||
switch (d.Name)
|
||||
{
|
||||
case "SKSvAuto": klassifizierung.SKSvAuto = Convert.ToUInt32(d.InnerText); break;
|
||||
case "SKSvManu": klassifizierung.SKSvManu = Convert.ToUInt32(d.InnerText); break;
|
||||
case "SZSvAuto": klassifizierung.SZSvAuto = Convert.ToUInt32(d.InnerText); break;
|
||||
default: throw new NotImplementedException(d.Name);
|
||||
}
|
||||
}
|
||||
return klassifizierung;
|
||||
}
|
||||
|
||||
private static Klassifizierung_Betriebssicherheit? ParseKlassifizierung_Betriebssicherheit(XmlNode intKlassifizierung_betriebssicherheit)
|
||||
{
|
||||
Klassifizierung_Betriebssicherheit klassifizierung = new Klassifizierung_Betriebssicherheit();
|
||||
foreach (XmlNode d in intKlassifizierung_betriebssicherheit)
|
||||
{
|
||||
switch (d.Name)
|
||||
{
|
||||
case "SKBvAuto": klassifizierung.SKBvAuto = Convert.ToUInt32(d.InnerText); break;
|
||||
case "SKBvManu": klassifizierung.SKBvManu = Convert.ToUInt32(d.InnerText); break;
|
||||
case "SZBvAuto": klassifizierung.SZBvAuto = Convert.ToUInt32(d.InnerText); break;
|
||||
default: throw new NotImplementedException(d.Name);
|
||||
}
|
||||
}
|
||||
return klassifizierung;
|
||||
}
|
||||
|
||||
private static Klassifizierung_Dichtheit? ParseKlassifizierung_Dichtheit(XmlNode intKlassifizierung_dichtheit)
|
||||
{
|
||||
Klassifizierung_Dichtheit klassifizierung = new Klassifizierung_Dichtheit();
|
||||
foreach(XmlNode d in intKlassifizierung_dichtheit)
|
||||
{
|
||||
switch(d.Name)
|
||||
{
|
||||
case "SKDvAuto": klassifizierung.SKDvAuto = Convert.ToUInt32(d.InnerText); break;
|
||||
case "SKDvManu": klassifizierung.SKDvManu = Convert.ToUInt32(d.InnerText); break;
|
||||
case "SZDvAuto": klassifizierung.SZDvAuto = Convert.ToUInt32(d.InnerText);break;
|
||||
default: throw new NotImplementedException(d.Name);
|
||||
}
|
||||
}
|
||||
return klassifizierung;
|
||||
}
|
||||
|
||||
private static RGrunddaten ParseGrundDaten(XmlNode intRGrunddaten)
|
||||
{
|
||||
RGrunddaten grunddaten = new RGrunddaten();
|
||||
foreach (XmlNode d in intRGrunddaten.ChildNodes)
|
||||
{
|
||||
switch (d.Name)
|
||||
{
|
||||
case "KnotenZulauf": grunddaten.KnotenZulauf = d.InnerText; break;
|
||||
case "KnotenZulaufTyp": grunddaten.KnotenZulaufTyp = (EKnotenTyp)Convert.ToInt32(d.InnerText); break;
|
||||
case "KnotenAblauf": grunddaten.KnotenAblauf = d.InnerText; break;
|
||||
case "KnotenAblaufTyp": grunddaten.KnotenAblaufTyp = (EKnotenTyp)Convert.ToInt32(d.InnerText); break;
|
||||
case "HerkunftProfilmasse": grunddaten.HerkunftProfilmasse = Convert.ToInt32(d.InnerText); break;
|
||||
case "Profilhoehe": grunddaten.Profilhoehe = Convert.ToInt32(d.InnerText); break;
|
||||
case "Profilbreite": grunddaten.Profilbreite = Convert.ToInt32(d.InnerText); break;
|
||||
case "Profilart": grunddaten.Profilart = Convert.ToInt32(d.InnerText); break;
|
||||
case "HerkunftMaterial": grunddaten.HerkunftMaterial = Convert.ToInt32(d.InnerText); break;
|
||||
case "Material": grunddaten.Material = d.InnerText; break;
|
||||
case "Regeleinzelrohrlaenge": grunddaten.Regeleinzelrohrlaenge = Convert.ToDecimal(d.InnerText.Replace('.', ',')); break;
|
||||
case "ArtAuskleidung": grunddaten.ArtAuskleidung = Convert.ToInt32(d.InnerText); break;
|
||||
case "Kanalart": grunddaten.Kanalart = d.InnerText; break;
|
||||
case "Anschlussdaten": grunddaten.Anschlussddaten = ParseAnschlussdaten(d); break;
|
||||
case "Innenschutz": grunddaten.Innenschutz = d.InnerText; break;
|
||||
default: throw new NotImplementedException(d.Name);
|
||||
}
|
||||
}
|
||||
return grunddaten;
|
||||
}
|
||||
private static DateTime makeInspektionstime(string datum, string time)
|
||||
{
|
||||
if (datum.Equals("") && time.Equals("")) return DateTime.Now;
|
||||
string[] parseddatum = datum.Split('-');
|
||||
int year = Convert.ToInt32(parseddatum[0]);
|
||||
int month = Convert.ToInt32(parseddatum[1]);
|
||||
int day = Convert.ToInt32(parseddatum[2]);
|
||||
|
||||
string[] parsedtime = time.Split(':');
|
||||
int hour = Convert.ToInt32(parsedtime[0]);
|
||||
int minute = Convert.ToInt32(parsedtime[1]);
|
||||
int second = Convert.ToInt32(parsedtime[2]);
|
||||
return new DateTime(year, month, day, hour, minute, second);
|
||||
}
|
||||
private static Anschlussdaten ParseAnschlussdaten(XmlNode anschlussdaten)
|
||||
{
|
||||
Anschlussdaten result = new Anschlussdaten();
|
||||
foreach (XmlNode d in anschlussdaten.ChildNodes)
|
||||
{
|
||||
switch (d.Name)
|
||||
{
|
||||
case "Objektbezeichnung": result.Objektbezeichnung = d.InnerText; break;
|
||||
case "Kantentyp": result.Kantentyp = (EKantenTyp)Convert.ToInt32(d.InnerText); break;
|
||||
case "Entfernung": result.Entfernung = Convert.ToDecimal(d.InnerText.Replace('.', ',')); break;
|
||||
case "Fixierung": result.Fixierung = d.InnerText; break;
|
||||
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<AbwassertechnischeAnlage> LoadStammdatenCollectiv()
|
||||
{
|
||||
List<AbwassertechnischeAnlage> result = new List<AbwassertechnischeAnlage>();
|
||||
XmlNode zstdk = rootChild.SelectSingleNode("//e:Stammdatenkollektiv", manager);
|
||||
XmlNodeList Stammdaten = zstdk.SelectNodes("//e:AbwassertechnischeAnlage", manager);
|
||||
|
||||
foreach (XmlNode node in Stammdaten)
|
||||
{
|
||||
result.Add(ParseStammdaten(node));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private AbwassertechnischeAnlage ParseStammdaten(XmlNode node)
|
||||
{
|
||||
AbwassertechnischeAnlage result = new AbwassertechnischeAnlage();
|
||||
foreach (XmlNode aktuell in node.ChildNodes)
|
||||
{
|
||||
switch (aktuell.Name)
|
||||
{
|
||||
case "Objektbezeichnung": result.Objektbezeichnung = aktuell.InnerText; break;
|
||||
case "Objektart": result.ObjektArt = (EObjektArt)Convert.ToInt32(aktuell.InnerText); break;
|
||||
case "Entwaesserungsart": result.Entwaesserungsart = aktuell.InnerText; break;
|
||||
case "Knoten": result.Knoten = parseStammdatenKnoten(aktuell); break;
|
||||
case "Kante":
|
||||
result.Kante = parseKante(aktuell);
|
||||
QueueToRebuild.Enqueue(result);
|
||||
break;
|
||||
case "Lage":
|
||||
break;
|
||||
case "AlteObjektbezeichnung": break;
|
||||
case "Status": break;
|
||||
case "Baujahr": break;
|
||||
case "Umweltparameter": break;
|
||||
case "Kommentar": break;
|
||||
case "Geometrie": result.Geometrie = parseGeometrie(aktuell); break;
|
||||
case "Sanierung": break;
|
||||
default: throw new NotImplementedException(aktuell.Name);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private Geometrie parseGeometrie(XmlNode aktuell)
|
||||
{
|
||||
|
||||
return new Geometrie();
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Kante parseKante(XmlNode aktuell)
|
||||
{
|
||||
/*
|
||||
KantenTyp
|
||||
KnotenZulauf
|
||||
KnotenZulaufTyp
|
||||
KnotenAblauf
|
||||
KnotenAblaufTyp
|
||||
SohlhoeheZulauf
|
||||
SohlhoeheAblauf
|
||||
Laenge
|
||||
Material
|
||||
Profil
|
||||
Haltung
|
||||
*/
|
||||
Kante result = new Kante();
|
||||
|
||||
foreach (XmlNode s in aktuell.ChildNodes)
|
||||
{
|
||||
switch (s.Name)
|
||||
{
|
||||
case "KnotenZulauf": result.knotenZulaufTemp = s.InnerText; break;
|
||||
case "KnotenAblauf": result.knotenAblaufTemp = s.InnerText; break;
|
||||
case "Profil": result.Profil = getProfil(s); break;
|
||||
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Profil getProfil(XmlNode s)
|
||||
{
|
||||
int Profilart = 0, Profilbreite = 0, Profilhoehe = 0;
|
||||
foreach (XmlNode d in s.ChildNodes)
|
||||
{
|
||||
switch (d.Name)
|
||||
{
|
||||
case "SonderprofilVorhanden": break;
|
||||
case "Profilart": Profilart = Convert.ToInt32(s.InnerText); break;
|
||||
case "Profilbreite": Profilbreite = Convert.ToInt32(s.InnerText); break;
|
||||
case "Profilhoehe": Profilhoehe = Convert.ToInt32(s.InnerText); break;
|
||||
default: throw new NotImplementedException(d.Name);
|
||||
}
|
||||
}
|
||||
return new Profil(Profilart, Profilbreite, Profilhoehe);
|
||||
}
|
||||
|
||||
private static Knoten parseStammdatenKnoten(XmlNode aktuell)
|
||||
{
|
||||
Knoten result = new Knoten();
|
||||
foreach (XmlNode s in aktuell.ChildNodes)
|
||||
{
|
||||
switch (s.Name)
|
||||
{
|
||||
case "KnotenTyp": result.KnotenTyp = (EKnotenTyp)Convert.ToInt32(s.InnerText); break;
|
||||
case "Anschlusspunkt": result.Anschlusspunkt = new Anschlusspunkt() { Punktkennung = s.InnerText }; break;
|
||||
case "Schacht": result.Schacht = parseSchacht(s); break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Schacht parseSchacht(XmlNode s)
|
||||
{
|
||||
Schacht result = new Schacht();
|
||||
foreach (XmlNode n in s.ChildNodes)
|
||||
{
|
||||
switch (n.Name)
|
||||
{
|
||||
case "SchachtFunktion": result.SchachtFunktion = (ESchachtFunktion)Convert.ToInt32(n.InnerText); break;
|
||||
case "Schachttiefe": result.SchachtTiefe = Convert.ToDecimal(n.InnerText); break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,8 +5,4 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Import\XML\v2006\Model\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
18
SchnittstelleTests/Import/XML/v2006/XML2006Tests.cs
Normal file
18
SchnittstelleTests/Import/XML/v2006/XML2006Tests.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Schnittstelle.Import.XML.v2006;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Schnittstelle.Import.XML.v2006.Tests
|
||||
{
|
||||
[TestClass()]
|
||||
public class XML2006Tests
|
||||
{
|
||||
[TestMethod()]
|
||||
public void XML2006Test()
|
||||
{
|
||||
XML2006 xml = new XML2006("../../../../test_code.xml");
|
||||
}
|
||||
}
|
||||
}
|
||||
24
SchnittstelleTests/SchnittstelleTests.csproj
Normal file
24
SchnittstelleTests/SchnittstelleTests.csproj
Normal file
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.4" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.0.4" />
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Schnittstelle\Schnittstelle.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
71419
test_code.xml
Normal file
71419
test_code.xml
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user