From ef626d0844aa81738a982bfcb359e857793b5f2c Mon Sep 17 00:00:00 2001 From: Husky Date: Wed, 16 May 2018 21:26:59 +0200 Subject: [PATCH] =?UTF-8?q?XMLParser=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/Database.csproj | 7 + Database/Datenbank.cs | 40 +++ KlassenBIB/KlassenBIB.csproj | 7 - KlassenBIB/Strasse.cs | 5 + KlassenBIB/database.xaml | 10 - SanSystem/Form1.cs | 20 -- SanSystem/Program.cs | 2 +- SanSystem/SanSystem.csproj | 37 ++- ...{Form1.Designer.cs => frmMain.Designer.cs} | 17 +- SanSystem/frmMain.cs | 54 ++++ SanSystem/frmMain.resx | 120 ++++++++ SanSystem/frmObjekteList.Designer.cs | 75 +++++ SanSystem/frmObjekteList.cs | 42 +++ SanSystem/frmObjekteList.resx | 120 ++++++++ SanSystem/frmStrassenList.Designer.cs | 62 ++++ SanSystem/frmStrassenList.cs | 36 +++ SanSystem/frmStrassenList.resx | 120 ++++++++ SanVerwaltung.sln | 6 + .../Properties/AssemblyInfo.cs | 36 +++ .../SchnittstelleImporter.csproj | 56 ++++ .../XML2006/Anschlussdaten.cs | 25 ++ SchnittstelleImporter/XML2006/Enums.cs | 52 ++++ SchnittstelleImporter/XML2006/Functions.cs | 270 ++++++++++++++++++ .../InspizierteAbwassertechnischeAnlage.cs | 65 +++++ SchnittstelleImporter/XML2006/Lage.cs | 42 +++ .../XML2006/OptischeInspektion.cs | 56 ++++ SchnittstelleImporter/XML2006/RGrunddaten.cs | 52 ++++ SchnittstelleImporter/XML2006/RZustand.cs | 51 ++++ SchnittstelleImporter/XML2006/Rohrleitung.cs | 80 ++++++ 29 files changed, 1521 insertions(+), 44 deletions(-) create mode 100644 Database/Datenbank.cs delete mode 100644 KlassenBIB/database.xaml delete mode 100644 SanSystem/Form1.cs rename SanSystem/{Form1.Designer.cs => frmMain.Designer.cs} (63%) create mode 100644 SanSystem/frmMain.cs create mode 100644 SanSystem/frmMain.resx create mode 100644 SanSystem/frmObjekteList.Designer.cs create mode 100644 SanSystem/frmObjekteList.cs create mode 100644 SanSystem/frmObjekteList.resx create mode 100644 SanSystem/frmStrassenList.Designer.cs create mode 100644 SanSystem/frmStrassenList.cs create mode 100644 SanSystem/frmStrassenList.resx create mode 100644 SchnittstelleImporter/Properties/AssemblyInfo.cs create mode 100644 SchnittstelleImporter/SchnittstelleImporter.csproj create mode 100644 SchnittstelleImporter/XML2006/Anschlussdaten.cs create mode 100644 SchnittstelleImporter/XML2006/Enums.cs create mode 100644 SchnittstelleImporter/XML2006/Functions.cs create mode 100644 SchnittstelleImporter/XML2006/InspizierteAbwassertechnischeAnlage.cs create mode 100644 SchnittstelleImporter/XML2006/Lage.cs create mode 100644 SchnittstelleImporter/XML2006/OptischeInspektion.cs create mode 100644 SchnittstelleImporter/XML2006/RGrunddaten.cs create mode 100644 SchnittstelleImporter/XML2006/RZustand.cs create mode 100644 SchnittstelleImporter/XML2006/Rohrleitung.cs diff --git a/Database/Database.csproj b/Database/Database.csproj index 7ca606e..f71398d 100644 --- a/Database/Database.csproj +++ b/Database/Database.csproj @@ -41,7 +41,14 @@ + + + + {c82bd650-466b-403f-bed9-2b1660771f54} + KlassenBIB + + \ No newline at end of file diff --git a/Database/Datenbank.cs b/Database/Datenbank.cs new file mode 100644 index 0000000..bf81677 --- /dev/null +++ b/Database/Datenbank.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xaml; + +namespace Database +{ + public class Datenbank + { + public static readonly Datenbank instance = new Datenbank(); + public static Datenbank Instance + { + get + { + return instance; + } + } + + public KlassenBIB.Projekt loadedProjekt = null; + + private string projektpfad = string.Empty; + public bool LoadProjekt(string filepath) + { + projektpfad = filepath; + if (File.Exists(filepath)) + loadedProjekt = XamlServices.Load(filepath) as KlassenBIB.Projekt; + else + loadedProjekt = new KlassenBIB.Projekt(); + return true; + } + + public void SaveProjekt() + { + XamlServices.Save(projektpfad, loadedProjekt); + } + } +} diff --git a/KlassenBIB/KlassenBIB.csproj b/KlassenBIB/KlassenBIB.csproj index d8c2956..805a334 100644 --- a/KlassenBIB/KlassenBIB.csproj +++ b/KlassenBIB/KlassenBIB.csproj @@ -50,12 +50,5 @@ - - - Designer - MSBuild:Compile - PreserveNewest - - \ No newline at end of file diff --git a/KlassenBIB/Strasse.cs b/KlassenBIB/Strasse.cs index 515fd50..77de5ce 100644 --- a/KlassenBIB/Strasse.cs +++ b/KlassenBIB/Strasse.cs @@ -19,5 +19,10 @@ namespace KlassenBIB { Objekte = new AbwasserTechnischeAnlageCollection(); } + + public override string ToString() + { + return Strassename; + } } } diff --git a/KlassenBIB/database.xaml b/KlassenBIB/database.xaml deleted file mode 100644 index b37a915..0000000 --- a/KlassenBIB/database.xaml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/SanSystem/Form1.cs b/SanSystem/Form1.cs deleted file mode 100644 index 60b92d1..0000000 --- a/SanSystem/Form1.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace SanSystem -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/SanSystem/Program.cs b/SanSystem/Program.cs index 57f75cf..66402b2 100644 --- a/SanSystem/Program.cs +++ b/SanSystem/Program.cs @@ -16,7 +16,7 @@ namespace SanSystem { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); + Application.Run(new frmMain()); } } } diff --git a/SanSystem/SanSystem.csproj b/SanSystem/SanSystem.csproj index 3c76451..0627e9f 100644 --- a/SanSystem/SanSystem.csproj +++ b/SanSystem/SanSystem.csproj @@ -45,14 +45,35 @@ - + Form - - Form1.cs + + frmObjekteList.cs + + + Form + + + frmStrassenList.cs + + + Form + + + frmMain.cs + + frmObjekteList.cs + + + frmStrassenList.cs + + + frmMain.cs + ResXFileCodeGenerator Resources.Designer.cs @@ -75,5 +96,15 @@ + + + {b0227727-6cf9-4e2e-9afe-5dd76deaa9db} + Database + + + {c82bd650-466b-403f-bed9-2b1660771f54} + KlassenBIB + + \ No newline at end of file diff --git a/SanSystem/Form1.Designer.cs b/SanSystem/frmMain.Designer.cs similarity index 63% rename from SanSystem/Form1.Designer.cs rename to SanSystem/frmMain.Designer.cs index 195b541..c878a02 100644 --- a/SanSystem/Form1.Designer.cs +++ b/SanSystem/frmMain.Designer.cs @@ -1,6 +1,6 @@ namespace SanSystem { - partial class Form1 + partial class frmMain { /// /// Erforderliche Designervariable. @@ -28,9 +28,20 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); + this.SuspendLayout(); + // + // frm_main + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Text = "Form1"; + this.ClientSize = new System.Drawing.Size(795, 459); + this.IsMdiContainer = true; + this.Name = "frm_main"; + this.Text = "Kanalsanierungsverwaltung"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frm_main_FormClosing); + this.Load += new System.EventHandler(this.frm_main_Load); + this.ResumeLayout(false); + } #endregion diff --git a/SanSystem/frmMain.cs b/SanSystem/frmMain.cs new file mode 100644 index 0000000..048af5e --- /dev/null +++ b/SanSystem/frmMain.cs @@ -0,0 +1,54 @@ +using Database; +using KlassenBIB; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SanSystem +{ + public partial class frmMain : Form + { + public frmMain() + { + InitializeComponent(); + Datenbank.Instance.LoadProjekt("projekt1.xaml"); + this.Width = Screen.PrimaryScreen.WorkingArea.Width; + this.Height = Screen.PrimaryScreen.WorkingArea.Height; + this.StartPosition = FormStartPosition.Manual; + this.Location = new Point(0, 0); + } + + private void button1_Click(object sender, EventArgs e) + { + + Projekt projekt = Datenbank.Instance.loadedProjekt; + + AdresseCollection adressen = projekt.Adressen; + + adressen[0].Objekte.Add(new Inspektionsobjekt() + { + Objektbezeichnung = "SW01" + }); + + Datenbank.Instance.SaveProjekt(); + } + + private void frm_main_Load(object sender, EventArgs e) + { + frmStrassenList strassenList = new frmStrassenList(); + strassenList.MdiParent = this; + strassenList.Show(); + } + + private void frm_main_FormClosing(object sender, FormClosingEventArgs e) + { + Datenbank.Instance.SaveProjekt(); + } + } +} diff --git a/SanSystem/frmMain.resx b/SanSystem/frmMain.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SanSystem/frmMain.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SanSystem/frmObjekteList.Designer.cs b/SanSystem/frmObjekteList.Designer.cs new file mode 100644 index 0000000..fe1da14 --- /dev/null +++ b/SanSystem/frmObjekteList.Designer.cs @@ -0,0 +1,75 @@ +namespace SanSystem +{ + partial class frmObjekteList + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.dGObjekte = new System.Windows.Forms.DataGridView(); + this.button1 = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.dGObjekte)).BeginInit(); + this.SuspendLayout(); + // + // dGObjekte + // + this.dGObjekte.AllowUserToOrderColumns = true; + this.dGObjekte.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dGObjekte.Location = new System.Drawing.Point(12, 12); + this.dGObjekte.Name = "dGObjekte"; + this.dGObjekte.RowTemplate.Height = 24; + this.dGObjekte.Size = new System.Drawing.Size(348, 163); + this.dGObjekte.TabIndex = 0; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(448, 51); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(136, 124); + this.button1.TabIndex = 1; + this.button1.Text = "button1"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // frmObjekteList + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(639, 253); + this.Controls.Add(this.button1); + this.Controls.Add(this.dGObjekte); + this.Name = "frmObjekteList"; + this.Text = "frmObjekteList"; + ((System.ComponentModel.ISupportInitialize)(this.dGObjekte)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataGridView dGObjekte; + private System.Windows.Forms.Button button1; + } +} \ No newline at end of file diff --git a/SanSystem/frmObjekteList.cs b/SanSystem/frmObjekteList.cs new file mode 100644 index 0000000..2c141c9 --- /dev/null +++ b/SanSystem/frmObjekteList.cs @@ -0,0 +1,42 @@ +using KlassenBIB; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SanSystem +{ + public partial class frmObjekteList : Form + { + ObservableCollection street = new ObservableCollection(); + Strasse strasse = null; + public frmObjekteList(Strasse strasse) + { + InitializeComponent(); + this.strasse = strasse; + + dGObjekte.DataSource = street; //strasse.Objekte; + } + + private void button1_Click(object sender, EventArgs e) + { + street.Add(new Strasse() + { + Strassename = "XSSD" + }); + + /* + strasse.Objekte.Add(new Inspektionsobjekt() + { + Objektbezeichnung = "1229292" + }); + */ + } + } +} diff --git a/SanSystem/frmObjekteList.resx b/SanSystem/frmObjekteList.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SanSystem/frmObjekteList.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SanSystem/frmStrassenList.Designer.cs b/SanSystem/frmStrassenList.Designer.cs new file mode 100644 index 0000000..f7ed684 --- /dev/null +++ b/SanSystem/frmStrassenList.Designer.cs @@ -0,0 +1,62 @@ +namespace SanSystem +{ + partial class frmStrassenList + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lst_strassen = new System.Windows.Forms.ListBox(); + this.SuspendLayout(); + // + // lst_strassen + // + this.lst_strassen.FormattingEnabled = true; + this.lst_strassen.ItemHeight = 16; + this.lst_strassen.Location = new System.Drawing.Point(9, 19); + this.lst_strassen.Name = "lst_strassen"; + this.lst_strassen.Size = new System.Drawing.Size(252, 340); + this.lst_strassen.TabIndex = 0; + this.lst_strassen.SelectedIndexChanged += new System.EventHandler(this.lst_strassen_SelectedIndexChanged); + // + // frmStrassenList + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(282, 392); + this.ControlBox = false; + this.Controls.Add(this.lst_strassen); + this.Name = "frmStrassenList"; + this.Text = "frmStrassenList"; + this.Load += new System.EventHandler(this.frmStrassenList_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ListBox lst_strassen; + } +} \ No newline at end of file diff --git a/SanSystem/frmStrassenList.cs b/SanSystem/frmStrassenList.cs new file mode 100644 index 0000000..bce507b --- /dev/null +++ b/SanSystem/frmStrassenList.cs @@ -0,0 +1,36 @@ +using Database; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SanSystem +{ + public partial class frmStrassenList : Form + { + public frmStrassenList() + { + InitializeComponent(); + } + + private void frmStrassenList_Load(object sender, EventArgs e) + { + lst_strassen.DataSource = Datenbank.Instance.loadedProjekt.Adressen; + } + + private void lst_strassen_SelectedIndexChanged(object sender, EventArgs e) + { + KlassenBIB.Strasse strasse = ((sender as ListBox).SelectedItem as KlassenBIB.Strasse); + if (strasse == null) return; + frmObjekteList objekteList = new frmObjekteList(strasse); + objekteList.MdiParent = this.MdiParent; + objekteList.Show(); + } + } +} diff --git a/SanSystem/frmStrassenList.resx b/SanSystem/frmStrassenList.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SanSystem/frmStrassenList.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SanVerwaltung.sln b/SanVerwaltung.sln index 3ae038a..a995610 100644 --- a/SanVerwaltung.sln +++ b/SanVerwaltung.sln @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KlassenBIB", "KlassenBIB\Kl EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KlassenBIBTests", "KlassenBIBTests\KlassenBIBTests.csproj", "{0FEC903E-6C9F-48AC-A207-0BACA184AAA8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchnittstelleImporter", "SchnittstelleImporter\SchnittstelleImporter.csproj", "{E1564A4D-39FD-489B-8029-AEEF33033EF2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +35,10 @@ Global {0FEC903E-6C9F-48AC-A207-0BACA184AAA8}.Debug|Any CPU.Build.0 = Debug|Any CPU {0FEC903E-6C9F-48AC-A207-0BACA184AAA8}.Release|Any CPU.ActiveCfg = Release|Any CPU {0FEC903E-6C9F-48AC-A207-0BACA184AAA8}.Release|Any CPU.Build.0 = Release|Any CPU + {E1564A4D-39FD-489B-8029-AEEF33033EF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1564A4D-39FD-489B-8029-AEEF33033EF2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1564A4D-39FD-489B-8029-AEEF33033EF2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1564A4D-39FD-489B-8029-AEEF33033EF2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SchnittstelleImporter/Properties/AssemblyInfo.cs b/SchnittstelleImporter/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..12f52c1 --- /dev/null +++ b/SchnittstelleImporter/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("SchnittstelleImporter")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SchnittstelleImporter")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("e1564a4d-39fd-489b-8029-aeef33033ef2")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SchnittstelleImporter/SchnittstelleImporter.csproj b/SchnittstelleImporter/SchnittstelleImporter.csproj new file mode 100644 index 0000000..6c373e6 --- /dev/null +++ b/SchnittstelleImporter/SchnittstelleImporter.csproj @@ -0,0 +1,56 @@ + + + + + Debug + AnyCPU + {E1564A4D-39FD-489B-8029-AEEF33033EF2} + Library + Properties + SchnittstelleImporter + SchnittstelleImporter + v4.6.1 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SchnittstelleImporter/XML2006/Anschlussdaten.cs b/SchnittstelleImporter/XML2006/Anschlussdaten.cs new file mode 100644 index 0000000..63974c4 --- /dev/null +++ b/SchnittstelleImporter/XML2006/Anschlussdaten.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchnittstelleImporter.XML2006 +{ + public class Anschlussdaten + { + string objektbezeichnung; + EKantenTyp kantentyp; + decimal entfernung; + string anschlussArt; + string fixierung; + string kommentar; + + public string Objektbezeichnung { get => objektbezeichnung; set => objektbezeichnung = value; } + public EKantenTyp Kantentyp { get => kantentyp; set => kantentyp = value; } + public decimal Entfernung { get => entfernung; set => entfernung = value; } + public string AnschlussArt { get => anschlussArt; set => anschlussArt = value; } + public string Fixierung { get => fixierung; set => fixierung = value; } + public string Kommentar { get => kommentar; set => kommentar = value; } + } +} diff --git a/SchnittstelleImporter/XML2006/Enums.cs b/SchnittstelleImporter/XML2006/Enums.cs new file mode 100644 index 0000000..e3582ea --- /dev/null +++ b/SchnittstelleImporter/XML2006/Enums.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchnittstelleImporter.XML2006 +{ + public enum EAnlagetyp + { + Haltung = 1, + Anschlussleitung = 2, + Schacht = 3, + Bauwerk = 4 + } + public enum EInspektionverfahren + { + TVUntersuchung, + Begehung, + VomSchacht, + Other + } + public enum EWetter + { + KEINNIEDERSCHLAG = 1, + REGEN = 2, + SCHNEE = 3 + } + public enum ERohrleitungstyp + { + HALTUNG, + LEITUNG + } + public enum EObjektArt + { + KANTE = 1, + KNOTEN = 2 + } + public enum EKnotenTyp + { + SCHACHT = 0, + ANSCHLUSSPUNKT = 1, + BAUWERK = 2 + } + public enum EKantenTyp + { + HALTUNG, + LEITUNG, + RINNE, + GERINNE + } +} diff --git a/SchnittstelleImporter/XML2006/Functions.cs b/SchnittstelleImporter/XML2006/Functions.cs new file mode 100644 index 0000000..020868e --- /dev/null +++ b/SchnittstelleImporter/XML2006/Functions.cs @@ -0,0 +1,270 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace SchnittstelleImporter.XML2006 +{ + public static class XMLParser + { + public static Dictionary anlageInFile = new Dictionary(); + public static List GetList(string xmldatei) + { + List result = new List(); + XmlDocument doc = new XmlDocument(); + doc.Load(xmldatei); + XmlNode rootChild = doc.LastChild; + + XmlNamespaceManager manager = new XmlNamespaceManager(doc.NameTable); + manager.AddNamespace("e", "http://www.ofd-hannover.la/Identifikation"); + XmlNode root = rootChild.SelectSingleNode("//e:Datenkollektive", manager); + + XmlNode zstdk = root.SelectSingleNode("//e:Zustandsdatenkollektiv", manager); + XmlNodeList inspizierteDaten = zstdk.SelectNodes("//e:InspizierteAbwassertechnischeAnlage", manager); + + foreach (XmlNode node in inspizierteDaten) + { + InspizierteAbwassertechnischeAnlage anlage = GetAnlage(node); + result.Add(anlage); + anlageInFile.Add(anlage, xmldatei); + } + return result; + } + private static InspizierteAbwassertechnischeAnlage GetAnlage(XmlNode xml) + { + XmlNode intOptischeInspektion = null; + XmlNode intRohrleitung = null; + XmlNode intRGrunddaten = null; + XmlNode intInspektionsdaten = null; + + InspizierteAbwassertechnischeAnlage result = new InspizierteAbwassertechnischeAnlage(); + + foreach (XmlNode d in xml.ChildNodes) + { + switch (d.Name) + { + case "Objektbezeichnung": + result.Objektbezeichnung = d.InnerText; + break; + case "Anlagentyp": + result.Anlagentyp = (EAnlagetyp)Convert.ToInt32(d.InnerText); //anlagentyp = Convert.ToInt32(d.InnerText); + break; + case "Lage": + //throw new NotImplementedException(); + 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; + default: throw new NotImplementedException(_temp.Name); + } + } + result.Lage = new Lage(strassename, ortname); + break; + case "OptischeInspektion": + intOptischeInspektion = d; + break; + + } + } + + if (intOptischeInspektion == null) + throw new Exception("Es scheint was schief gelaufen zu sein, OptischeInspektion is null"); + + string datum = ""; + string time = ""; + + OptischeInspektion optischeInspektion = new OptischeInspektion(); + + foreach (XmlNode d in intOptischeInspektion) + { + switch (d.Name) + { + case "Inspektionsdatum": + datum = d.InnerText; + break; + case "Uhrzeit": + time = d.InnerText; + break; + case "Rohrleitung": + intRohrleitung = d; + break; + } + } + 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]); + DateTime dt = new DateTime(year, month, day, hour, minute, second); + + optischeInspektion.Inspektionstime = dt; + + if (intRohrleitung == null) + throw new NotImplementedException("Schaechte sind noch nicht implementiert"); + + Rohrleitung rohr = new Rohrleitung(); + foreach (XmlNode d in intRohrleitung) + { + switch (d.Name) + { + case "Rohrleitungstyp": + rohr.Rohrleitungstyp = (ERohrleitungstyp)Convert.ToInt32(d.InnerText); + break; + case "Inspektionslaenge": + rohr.Inspektionslaenge = Convert.ToDecimal(d.InnerText.Replace('.', ',')); + break; + case "Inspektionsrichtung": + rohr.Inspektionsrichtung = d.InnerText; + break; + case "RGrunddaten": + intRGrunddaten = d; + break; + case "Inspektionsdaten": + intInspektionsdaten = d; + break; + } + } + + //List rzustand = ParseRZustand(intInspektionsdaten); + + rohr.Grunddaten = ParseGrundDaten(intRGrunddaten); + rohr.Zustaende = ParseRZustand(intInspektionsdaten); + optischeInspektion.Rohrleitung = rohr; + result.OptischeInspektion = optischeInspektion; + + return result; + } + + 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 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; + default: Trace.WriteLine(d.Name); break; + } + } + return result; + } + + private static List ParseRZustand(XmlNode node) + { + List result = new List(); + + 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": 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; + default: throw new NotImplementedException(d.Name); + + } + } + result.Add(rZustand); + } + + + return result; + } + } +} diff --git a/SchnittstelleImporter/XML2006/InspizierteAbwassertechnischeAnlage.cs b/SchnittstelleImporter/XML2006/InspizierteAbwassertechnischeAnlage.cs new file mode 100644 index 0000000..648bc29 --- /dev/null +++ b/SchnittstelleImporter/XML2006/InspizierteAbwassertechnischeAnlage.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchnittstelleImporter.XML2006 +{ + public sealed class InspizierteAbwassertechnischeAnlage + { + string objektbezeichnung; + Lage lage; + EAnlagetyp anlagentyp; + OptischeInspektion optischeInspektion; + + public string Objektbezeichnung + { + get + { + return objektbezeichnung; + } + set + { + objektbezeichnung = value; + } + } + public EAnlagetyp Anlagentyp + { + get + { + return anlagentyp; + } + set + { + anlagentyp = value; + } + } + public OptischeInspektion OptischeInspektion + { + get + { + return optischeInspektion; + } + set + { + optischeInspektion = value; + } + } + public Lage Lage + { + get + { + return lage; + } + set + { + lage = value; + } + } + public override string ToString() + { + return objektbezeichnung; + } + } +} diff --git a/SchnittstelleImporter/XML2006/Lage.cs b/SchnittstelleImporter/XML2006/Lage.cs new file mode 100644 index 0000000..1b9249d --- /dev/null +++ b/SchnittstelleImporter/XML2006/Lage.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchnittstelleImporter.XML2006 +{ + public class Lage + { + string strassename; + string ortname; + + public string Strassename + { + get + { + return strassename; + } + set + { + strassename = value; + } + } + public string Ortname + { + get + { + return ortname; + } + set + { + ortname = value; + } + } + public Lage(string strassename, string ortname) + { + this.strassename = strassename; + this.ortname = ortname; + } + } +} diff --git a/SchnittstelleImporter/XML2006/OptischeInspektion.cs b/SchnittstelleImporter/XML2006/OptischeInspektion.cs new file mode 100644 index 0000000..bdeb1f1 --- /dev/null +++ b/SchnittstelleImporter/XML2006/OptischeInspektion.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchnittstelleImporter.XML2006 +{ + public class OptischeInspektion + { + DateTime inspektionstime; + Rohrleitung rohrleitung; + + public DateTime Inspektionstime + { + set + { + inspektionstime = value; + } + get + { + return inspektionstime; + } + } + public string Inspektionsdatum + { + get + { + return inspektionstime.ToShortDateString(); + } + /*set + { + throw new NotImplementedException(); + //inspektionsdatum = value; + }*/ + } + public string Inspektionszeit + { + get + { + return inspektionstime.ToShortTimeString(); + } + } + public Rohrleitung Rohrleitung + { + get + { + return rohrleitung; + } + set + { + rohrleitung = value; + } + } + } +} diff --git a/SchnittstelleImporter/XML2006/RGrunddaten.cs b/SchnittstelleImporter/XML2006/RGrunddaten.cs new file mode 100644 index 0000000..90f0fa9 --- /dev/null +++ b/SchnittstelleImporter/XML2006/RGrunddaten.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchnittstelleImporter.XML2006 +{ + public class RGrunddaten + { + string knotenZulauf; + EKnotenTyp knotenZulaufTyp; + string knotenAblauf; + EKnotenTyp knotenAblaufTyp; + int profilhoehe; + int profilbreite; + int profilart; + string material; + string kanalart; + Anschlussdaten anschlussddaten = null; + int herkunftProfilmasse; + int herkunftMaterial; + decimal regeleinzelrohrlaenge; + int artAuskleidung; + string innenschutz; + + public string KnotenZulauf { get => knotenZulauf; set => knotenZulauf = value; } + public EKnotenTyp KnotenZulaufTyp { get => knotenZulaufTyp; set => knotenZulaufTyp = value; } + public string KnotenAblauf { get => knotenAblauf; set => knotenAblauf = value; } + public EKnotenTyp KnotenAblaufTyp { get => knotenAblaufTyp; set => knotenAblaufTyp = value; } + public int Profilhoehe { get => profilhoehe; set => profilhoehe = value; } + public int Profilbreite { get => profilbreite; set => profilbreite = value; } + public int Profilart { get => profilart; set => profilart = value; } + public string Material { get => material; set => material = value; } + public string Kanalart { get => kanalart; set => kanalart = value; } + public Anschlussdaten Anschlussddaten { get => anschlussddaten; set => anschlussddaten = value; } + public int HerkunftProfilmasse { get => herkunftProfilmasse; set => herkunftProfilmasse = value; } + public int HerkunftMaterial { get => herkunftMaterial; set => herkunftMaterial = value; } + public decimal Regeleinzelrohrlaenge { get => regeleinzelrohrlaenge; set => regeleinzelrohrlaenge = value; } + public int ArtAuskleidung { get => artAuskleidung; set => artAuskleidung = value; } + + public bool HasGrundleitung + { + get + { + return anschlussddaten != null; + } + } + + public string Innenschutz { get => innenschutz; set => innenschutz = value; } + } +} diff --git a/SchnittstelleImporter/XML2006/RZustand.cs b/SchnittstelleImporter/XML2006/RZustand.cs new file mode 100644 index 0000000..a5c4be8 --- /dev/null +++ b/SchnittstelleImporter/XML2006/RZustand.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchnittstelleImporter.XML2006 +{ + public struct Quantifizierung + { + public decimal Numerisch; + public string Text; + + public override string ToString() + { + if (Text != null) + return Text; + if (Numerisch == 0) + return ""; + return Numerisch.ToString(); + } + } + public class RZustand + { + decimal station; + string inspektionskode; + string charakterisierung1; + string charakterisierung2; + bool verbindung; + Quantifizierung quantifizierung1; + Quantifizierung quantifizierung2; + string streckenschaden; + int streckenschadennr; + int positionVon; + int positionBis; + string kommentar; + + public decimal Station { get => station; set => station = value; } + public string Inspektionskode { get => inspektionskode; set => inspektionskode = value; } + public string Charakterisierung1 { get => charakterisierung1; set => charakterisierung1 = value; } + public string Charakterisierung2 { get => charakterisierung2; set => charakterisierung2 = value; } + public bool Verbindung { get => verbindung; set => verbindung = value; } + public Quantifizierung Quantifizierung1 { get => quantifizierung1; set => quantifizierung1 = value; } + public Quantifizierung Quantifizierung2 { get => quantifizierung2; set => quantifizierung2 = value; } + public string Streckenschaden { get => streckenschaden; set => streckenschaden = value; } + public int Streckenschadennr { get => streckenschadennr; set => streckenschadennr = value; } + public int PositionVon { get => positionVon; set => positionVon = value; } + public int PositionBis { get => positionBis; set => positionBis = value; } + public string Kommentar { get => kommentar; set => kommentar = value; } + } +} diff --git a/SchnittstelleImporter/XML2006/Rohrleitung.cs b/SchnittstelleImporter/XML2006/Rohrleitung.cs new file mode 100644 index 0000000..f87af0a --- /dev/null +++ b/SchnittstelleImporter/XML2006/Rohrleitung.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SchnittstelleImporter.XML2006 +{ + public class Rohrleitung + { + ERohrleitungstyp rohrleitungstyp; + decimal inspektionslaenge; + string inspektionsrichtung; + RGrunddaten grunddaten = null; + List zustaende = null; + + public ERohrleitungstyp Rohrleitungstyp + { + get + { + return rohrleitungstyp; + } + set + { + rohrleitungstyp = value; + } + } + + public decimal Inspektionslaenge + { + get + { + return inspektionslaenge; + } + set + { + inspektionslaenge = value; + } + } + public string Inspektionsrichtung + { + get + { + switch (inspektionsrichtung) + { + case "U": return "Gegen Fliessrichtung"; + case "O": return "In Fliessrichtung"; + default: return "Fliessrichtungangabe nicht bekannt(" + inspektionsrichtung + ")"; + } + + } + set + { + inspektionsrichtung = value; + } + } + public List Zustaende + { + get + { + return zustaende; + } + set + { + zustaende = value; + } + } + public RGrunddaten Grunddaten + { + get + { + return grunddaten; + } + set + { + grunddaten = value; + } + } + } +}