From ea3352db793c05e0f9094b64208e21ef63a7f557 Mon Sep 17 00:00:00 2001 From: HuskyTeufel Date: Mon, 20 Sep 2021 13:45:24 +0200 Subject: [PATCH] Enum verschoben zur Domain Datenbank converter angefangen --- .../DaSaSo.DatabaseConverter.csproj | 15 + DaSaSo.DatabaseConverter/Program.cs | 61 + DaSaSo.DatabaseConverter/TeufelDB.xaml | 6344 +++++++++++++++++ .../Enums/EMainWindowViewType.cs | 8 +- DaSaSo.Domain/Enums/EPointType.cs | 16 + DaSaSo.Domain/Model/SewerObject.cs | 12 +- DaSaSo.Domain/Model/SewerPoint.cs | 7 + .../20210920062903_transfertoenum.Designer.cs | 271 + .../20210920062903_transfertoenum.cs | 134 + .../DaSaSoDbContextModelSnapshot.cs | 45 +- .../InMemoryObjecteListView.cs | 12 +- .../Commands/UpdateCurrentViewModelCommand.cs | 3 +- .../Factories/MainWindowViewModelFactory.cs | 10 +- .../Interface/IViewModelAbstractFactory.cs | 7 +- .../Window/MainWindowViewModel.cs | 3 +- .../Controls/MainWindowNavigationBar.xaml | 2 +- .../Sampledata/SewerObjectListSampleData.cs | 8 +- DaSaSo.sln | 14 +- 18 files changed, 6925 insertions(+), 47 deletions(-) create mode 100644 DaSaSo.DatabaseConverter/DaSaSo.DatabaseConverter.csproj create mode 100644 DaSaSo.DatabaseConverter/Program.cs create mode 100644 DaSaSo.DatabaseConverter/TeufelDB.xaml rename {DaSaSo.ViewModel => DaSaSo.Domain}/Enums/EMainWindowViewType.cs (51%) create mode 100644 DaSaSo.Domain/Enums/EPointType.cs create mode 100644 DaSaSo.Domain/Model/SewerPoint.cs create mode 100644 DaSaSo.EntityFramework/Migrations/20210920062903_transfertoenum.Designer.cs create mode 100644 DaSaSo.EntityFramework/Migrations/20210920062903_transfertoenum.cs diff --git a/DaSaSo.DatabaseConverter/DaSaSo.DatabaseConverter.csproj b/DaSaSo.DatabaseConverter/DaSaSo.DatabaseConverter.csproj new file mode 100644 index 0000000..a83b8b3 --- /dev/null +++ b/DaSaSo.DatabaseConverter/DaSaSo.DatabaseConverter.csproj @@ -0,0 +1,15 @@ + + + + Exe + net6.0 + enable + + + + + Always + + + + diff --git a/DaSaSo.DatabaseConverter/Program.cs b/DaSaSo.DatabaseConverter/Program.cs new file mode 100644 index 0000000..eb31a8c --- /dev/null +++ b/DaSaSo.DatabaseConverter/Program.cs @@ -0,0 +1,61 @@ +// See https://aka.ms/new-console-template for more information + +using System.Collections; +using System.Diagnostics; +using System.Xml; + +Console.WriteLine("Hello, World!"); +await ReadXML(); + +Console.ReadLine(); + + +static async Task ReadXML() +{ + + XmlReaderSettings setting = new XmlReaderSettings(); + setting.Async = true; + HashSet hashtable = new HashSet(); + using (XmlReader m_reader = XmlReader.Create("./TeufelDB.xaml",setting)) + { + while (await m_reader.ReadAsync()) + { + if(m_reader.IsStartElement()) + { + if (m_reader.Name.Equals("Auftraggeber")) Debugger.Break(); + hashtable.Add(m_reader.Name); + if (m_reader.IsEmptyElement) + { + Console.WriteLine("<{0}/>", m_reader.Name); + } + else + { + + Console.Write("<{0}> ", m_reader.Name); + m_reader.Read(); + if (m_reader.IsStartElement()) + { + Console.Write("\r\n<{0}>", m_reader.Name); + } + } + if (m_reader.HasAttributes) + { + Console.WriteLine("Attributes of {0}", m_reader.Name); + while (m_reader.MoveToNextAttribute()) + { + Console.WriteLine(" {0} = {1}", m_reader.Name, m_reader.Value); + } + m_reader.MoveToElement(); + } + + } + else + { + Console.WriteLine("Ende"); + } + + + } + } + Debugger.Break(); +} \ No newline at end of file diff --git a/DaSaSo.DatabaseConverter/TeufelDB.xaml b/DaSaSo.DatabaseConverter/TeufelDB.xaml new file mode 100644 index 0000000..18aeb0e --- /dev/null +++ b/DaSaSo.DatabaseConverter/TeufelDB.xaml @@ -0,0 +1,6344 @@ + + + + __ReferenceID295 + __ReferenceID84 + __ReferenceID296 + __ReferenceID297 + __ReferenceID298 + __ReferenceID299 + __ReferenceID300 + __ReferenceID133 + + __ReferenceID301 + __ReferenceID137 + __ReferenceID281 + + + + + + + + + + + + __ReferenceID61 + __ReferenceID80 + __ReferenceID302 + __ReferenceID87 + __ReferenceID94 + __ReferenceID103 + __ReferenceID108 + __ReferenceID123 + __ReferenceID135 + __ReferenceID130 + __ReferenceID138 + __ReferenceID174 + __ReferenceID183 + __ReferenceID143 + __ReferenceID176 + __ReferenceID164 + __ReferenceID238 + __ReferenceID241 + __ReferenceID246 + __ReferenceID265 + __ReferenceID267 + __ReferenceID278 + __ReferenceID289 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DaSaSo.ViewModel/Enums/EMainWindowViewType.cs b/DaSaSo.Domain/Enums/EMainWindowViewType.cs similarity index 51% rename from DaSaSo.ViewModel/Enums/EMainWindowViewType.cs rename to DaSaSo.Domain/Enums/EMainWindowViewType.cs index 85f4501..857593a 100644 --- a/DaSaSo.ViewModel/Enums/EMainWindowViewType.cs +++ b/DaSaSo.Domain/Enums/EMainWindowViewType.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DaSaSo.ViewModel.Enums +namespace DaSaSo.Domain.Enums { public enum EMainWindowViewType { diff --git a/DaSaSo.Domain/Enums/EPointType.cs b/DaSaSo.Domain/Enums/EPointType.cs new file mode 100644 index 0000000..74dac44 --- /dev/null +++ b/DaSaSo.Domain/Enums/EPointType.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DaSaSo.Domain.Enums +{ + public enum EPointType + { + Leitung, + Haltung, + Schacht, + Anschlusspunkt + } +} diff --git a/DaSaSo.Domain/Model/SewerObject.cs b/DaSaSo.Domain/Model/SewerObject.cs index 498e575..d94ca75 100644 --- a/DaSaSo.Domain/Model/SewerObject.cs +++ b/DaSaSo.Domain/Model/SewerObject.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations.Schema; +using DaSaSo.Domain.Enums; +using System.ComponentModel.DataAnnotations.Schema; namespace DaSaSo.Domain.Model { @@ -7,8 +8,10 @@ namespace DaSaSo.Domain.Model public Buildingsite BuildingSite { get; set; } public string StreetName { get; set; } public string ObjektName { get; set; } - public string PointFrom { get; set; } - public string PointTo { get; set; } + public SewerPoint PunktOben { get; set; } + public EPointType PunktObenType { get; set; } + public SewerPoint PunktUnten { get; set; } + public EPointType PunktUntenType { get; set; } public string Material { get; set; } public int DN { get; set; } public decimal SewerLength { get; set; } @@ -24,4 +27,5 @@ namespace DaSaSo.Domain.Model public bool IsSelected { get; set; } } -} \ No newline at end of file +} + diff --git a/DaSaSo.Domain/Model/SewerPoint.cs b/DaSaSo.Domain/Model/SewerPoint.cs new file mode 100644 index 0000000..d00213c --- /dev/null +++ b/DaSaSo.Domain/Model/SewerPoint.cs @@ -0,0 +1,7 @@ +namespace DaSaSo.Domain.Model +{ + public class SewerPoint : DomainObject + { + public string Objektnummer { get; set; } + } +} \ No newline at end of file diff --git a/DaSaSo.EntityFramework/Migrations/20210920062903_transfertoenum.Designer.cs b/DaSaSo.EntityFramework/Migrations/20210920062903_transfertoenum.Designer.cs new file mode 100644 index 0000000..b0db00f --- /dev/null +++ b/DaSaSo.EntityFramework/Migrations/20210920062903_transfertoenum.Designer.cs @@ -0,0 +1,271 @@ +// +using System; +using DaSaSo.EntityFramework; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace DaSaSo.EntityFramework.Migrations +{ + [DbContext(typeof(DaSaSoDbContext))] + [Migration("20210920062903_transfertoenum")] + partial class transfertoenum + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 63) + .HasAnnotation("ProductVersion", "6.0.0-preview.7.21378.4") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BuildingSiteNumber") + .HasColumnType("text"); + + b.Property("ContactPerson") + .HasColumnType("text"); + + b.Property("Country") + .HasColumnType("text"); + + b.Property("ProjectId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Buildingsites"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Country") + .HasColumnType("text"); + + b.Property("Firstname") + .HasColumnType("text"); + + b.Property("LastName") + .HasColumnType("text"); + + b.Property("Postcode") + .HasColumnType("text"); + + b.Property("Street") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("ClientId") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.SewerDamage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("DamageType") + .HasColumnType("integer"); + + b.Property("Distance") + .HasColumnType("numeric"); + + b.Property("PreparationType") + .HasColumnType("integer"); + + b.Property("SewerObjectId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("SewerObjectId"); + + b.ToTable("SewerDamages"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.SewerObject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("BuildingSiteId") + .HasColumnType("integer"); + + b.Property("BuildingsiteBarier") + .HasColumnType("boolean"); + + b.Property("DN") + .HasColumnType("integer"); + + b.Property("Material") + .HasColumnType("text"); + + b.Property("ObjektName") + .HasColumnType("text"); + + b.Property("PermitNeeded") + .HasColumnType("boolean"); + + b.Property("PunktObenId") + .HasColumnType("integer"); + + b.Property("PunktObenType") + .HasColumnType("integer"); + + b.Property("PunktUntenId") + .HasColumnType("integer"); + + b.Property("PunktUntenType") + .HasColumnType("integer"); + + b.Property("SewerActivated") + .HasColumnType("boolean"); + + b.Property("SewerCleaned") + .HasColumnType("boolean"); + + b.Property("SewerLength") + .HasColumnType("numeric"); + + b.Property("StreetName") + .HasColumnType("text"); + + b.Property("WaterBarrier") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("BuildingSiteId"); + + b.HasIndex("PunktObenId"); + + b.HasIndex("PunktUntenId"); + + b.ToTable("SewerObjects"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.SewerPoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Objektnummer") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("SewerPoint"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b => + { + b.HasOne("DaSaSo.Domain.Model.Project", "Project") + .WithMany("BuildingSites") + .HasForeignKey("ProjectId"); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.Project", b => + { + b.HasOne("DaSaSo.Domain.Model.Client", "Client") + .WithMany("Projects") + .HasForeignKey("ClientId"); + + b.Navigation("Client"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.SewerDamage", b => + { + b.HasOne("DaSaSo.Domain.Model.SewerObject", "SewerObject") + .WithMany("SewerDamages") + .HasForeignKey("SewerObjectId"); + + b.Navigation("SewerObject"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.SewerObject", b => + { + b.HasOne("DaSaSo.Domain.Model.Buildingsite", "BuildingSite") + .WithMany("SewerObjects") + .HasForeignKey("BuildingSiteId"); + + b.HasOne("DaSaSo.Domain.Model.SewerPoint", "PunktOben") + .WithMany() + .HasForeignKey("PunktObenId"); + + b.HasOne("DaSaSo.Domain.Model.SewerPoint", "PunktUnten") + .WithMany() + .HasForeignKey("PunktUntenId"); + + b.Navigation("BuildingSite"); + + b.Navigation("PunktOben"); + + b.Navigation("PunktUnten"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b => + { + b.Navigation("SewerObjects"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.Client", b => + { + b.Navigation("Projects"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.Project", b => + { + b.Navigation("BuildingSites"); + }); + + modelBuilder.Entity("DaSaSo.Domain.Model.SewerObject", b => + { + b.Navigation("SewerDamages"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DaSaSo.EntityFramework/Migrations/20210920062903_transfertoenum.cs b/DaSaSo.EntityFramework/Migrations/20210920062903_transfertoenum.cs new file mode 100644 index 0000000..7f02cc4 --- /dev/null +++ b/DaSaSo.EntityFramework/Migrations/20210920062903_transfertoenum.cs @@ -0,0 +1,134 @@ +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +namespace DaSaSo.EntityFramework.Migrations +{ + public partial class transfertoenum : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "PointFrom", + table: "SewerObjects"); + + migrationBuilder.DropColumn( + name: "PointTo", + table: "SewerObjects"); + + migrationBuilder.AddColumn( + name: "PunktObenId", + table: "SewerObjects", + type: "integer", + nullable: true); + + migrationBuilder.AddColumn( + name: "PunktObenType", + table: "SewerObjects", + type: "integer", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "PunktUntenId", + table: "SewerObjects", + type: "integer", + nullable: true); + + migrationBuilder.AddColumn( + name: "PunktUntenType", + table: "SewerObjects", + type: "integer", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "SewerPoint", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Objektnummer = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_SewerPoint", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_SewerObjects_PunktObenId", + table: "SewerObjects", + column: "PunktObenId"); + + migrationBuilder.CreateIndex( + name: "IX_SewerObjects_PunktUntenId", + table: "SewerObjects", + column: "PunktUntenId"); + + migrationBuilder.AddForeignKey( + name: "FK_SewerObjects_SewerPoint_PunktObenId", + table: "SewerObjects", + column: "PunktObenId", + principalTable: "SewerPoint", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_SewerObjects_SewerPoint_PunktUntenId", + table: "SewerObjects", + column: "PunktUntenId", + principalTable: "SewerPoint", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_SewerObjects_SewerPoint_PunktObenId", + table: "SewerObjects"); + + migrationBuilder.DropForeignKey( + name: "FK_SewerObjects_SewerPoint_PunktUntenId", + table: "SewerObjects"); + + migrationBuilder.DropTable( + name: "SewerPoint"); + + migrationBuilder.DropIndex( + name: "IX_SewerObjects_PunktObenId", + table: "SewerObjects"); + + migrationBuilder.DropIndex( + name: "IX_SewerObjects_PunktUntenId", + table: "SewerObjects"); + + migrationBuilder.DropColumn( + name: "PunktObenId", + table: "SewerObjects"); + + migrationBuilder.DropColumn( + name: "PunktObenType", + table: "SewerObjects"); + + migrationBuilder.DropColumn( + name: "PunktUntenId", + table: "SewerObjects"); + + migrationBuilder.DropColumn( + name: "PunktUntenType", + table: "SewerObjects"); + + migrationBuilder.AddColumn( + name: "PointFrom", + table: "SewerObjects", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "PointTo", + table: "SewerObjects", + type: "text", + nullable: true); + } + } +} diff --git a/DaSaSo.EntityFramework/Migrations/DaSaSoDbContextModelSnapshot.cs b/DaSaSo.EntityFramework/Migrations/DaSaSoDbContextModelSnapshot.cs index a254825..383f633 100644 --- a/DaSaSo.EntityFramework/Migrations/DaSaSoDbContextModelSnapshot.cs +++ b/DaSaSo.EntityFramework/Migrations/DaSaSoDbContextModelSnapshot.cs @@ -143,11 +143,17 @@ namespace DaSaSo.EntityFramework.Migrations b.Property("PermitNeeded") .HasColumnType("boolean"); - b.Property("PointFrom") - .HasColumnType("text"); + b.Property("PunktObenId") + .HasColumnType("integer"); - b.Property("PointTo") - .HasColumnType("text"); + b.Property("PunktObenType") + .HasColumnType("integer"); + + b.Property("PunktUntenId") + .HasColumnType("integer"); + + b.Property("PunktUntenType") + .HasColumnType("integer"); b.Property("SewerActivated") .HasColumnType("boolean"); @@ -168,9 +174,28 @@ namespace DaSaSo.EntityFramework.Migrations b.HasIndex("BuildingSiteId"); + b.HasIndex("PunktObenId"); + + b.HasIndex("PunktUntenId"); + b.ToTable("SewerObjects"); }); + modelBuilder.Entity("DaSaSo.Domain.Model.SewerPoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + + b.Property("Objektnummer") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("SewerPoint"); + }); + modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b => { b.HasOne("DaSaSo.Domain.Model.Project", "Project") @@ -204,7 +229,19 @@ namespace DaSaSo.EntityFramework.Migrations .WithMany("SewerObjects") .HasForeignKey("BuildingSiteId"); + b.HasOne("DaSaSo.Domain.Model.SewerPoint", "PunktOben") + .WithMany() + .HasForeignKey("PunktObenId"); + + b.HasOne("DaSaSo.Domain.Model.SewerPoint", "PunktUnten") + .WithMany() + .HasForeignKey("PunktUntenId"); + b.Navigation("BuildingSite"); + + b.Navigation("PunktOben"); + + b.Navigation("PunktUnten"); }); modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b => diff --git a/DaSaSo.InMemoryProvider/InMemoryObjecteListView.cs b/DaSaSo.InMemoryProvider/InMemoryObjecteListView.cs index b5cf874..f97873c 100644 --- a/DaSaSo.InMemoryProvider/InMemoryObjecteListView.cs +++ b/DaSaSo.InMemoryProvider/InMemoryObjecteListView.cs @@ -19,18 +19,18 @@ namespace DaSaSo.InMemoryProvider { DN = 200, Material = "STZ", - ObjektName = "SW01", - PointFrom = "SW01", - PointTo = "SW02" + ObjektName = "SW01" + //PointFrom = "SW01", + //PointTo = "SW02" }); _sewerObjects.Add( new SewerObject() { DN = 200, Material = "STZ", - ObjektName = "SW01", - PointFrom = "SW01", - PointTo = "SW02" + ObjektName = "SW01" + //PointFrom = "SW01", + //PointTo = "SW02" }); } } diff --git a/DaSaSo.ViewModel/Commands/UpdateCurrentViewModelCommand.cs b/DaSaSo.ViewModel/Commands/UpdateCurrentViewModelCommand.cs index fb5ca7a..b996b73 100644 --- a/DaSaSo.ViewModel/Commands/UpdateCurrentViewModelCommand.cs +++ b/DaSaSo.ViewModel/Commands/UpdateCurrentViewModelCommand.cs @@ -1,4 +1,5 @@ -using DaSaSo.ViewModel.Enums; +using DaSaSo.Domain.Enums; +using DaSaSo.ViewModel.Enums; using DaSaSo.ViewModel.Interface; using System.Windows.Input; diff --git a/DaSaSo.ViewModel/Factories/MainWindowViewModelFactory.cs b/DaSaSo.ViewModel/Factories/MainWindowViewModelFactory.cs index a933d79..22b8ef2 100644 --- a/DaSaSo.ViewModel/Factories/MainWindowViewModelFactory.cs +++ b/DaSaSo.ViewModel/Factories/MainWindowViewModelFactory.cs @@ -1,13 +1,5 @@ -using DaSaSo.Domain.Model; -using DaSaSo.EntityFramework; -using DaSaSo.EntityFramework.Services; -using DaSaSo.ViewModel.Enums; +using DaSaSo.Domain.Enums; using DaSaSo.ViewModel.Interface; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace DaSaSo.ViewModel.Factories { diff --git a/DaSaSo.ViewModel/Interface/IViewModelAbstractFactory.cs b/DaSaSo.ViewModel/Interface/IViewModelAbstractFactory.cs index 69fc65c..872af65 100644 --- a/DaSaSo.ViewModel/Interface/IViewModelAbstractFactory.cs +++ b/DaSaSo.ViewModel/Interface/IViewModelAbstractFactory.cs @@ -1,9 +1,4 @@ -using DaSaSo.ViewModel.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using DaSaSo.Domain.Enums; namespace DaSaSo.ViewModel.Interface { diff --git a/DaSaSo.ViewModel/Window/MainWindowViewModel.cs b/DaSaSo.ViewModel/Window/MainWindowViewModel.cs index f9aba24..8ec9ce6 100644 --- a/DaSaSo.ViewModel/Window/MainWindowViewModel.cs +++ b/DaSaSo.ViewModel/Window/MainWindowViewModel.cs @@ -1,4 +1,5 @@ -using DaSaSo.Domain.Model; +using DaSaSo.Domain.Enums; +using DaSaSo.Domain.Model; using DaSaSo.EntityFramework; using DaSaSo.EntityFramework.Services; using DaSaSo.ViewModel.Commands; diff --git a/DaSaSo.Wpf/Controls/MainWindowNavigationBar.xaml b/DaSaSo.Wpf/Controls/MainWindowNavigationBar.xaml index 1241197..37277c2 100644 --- a/DaSaSo.Wpf/Controls/MainWindowNavigationBar.xaml +++ b/DaSaSo.Wpf/Controls/MainWindowNavigationBar.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:DaSaSo.Wpf.Controls" - xmlns:nav="clr-namespace:DaSaSo.ViewModel.Enums;assembly=DaSaSo.ViewModel" + xmlns:nav="clr-namespace:DaSaSo.Domain.Enums;assembly=DaSaSo.Domain" xmlns:viewmodel="clr-namespace:DaSaSo.ViewModel;assembly=DaSaSo.ViewModel" xmlns:converters="clr-namespace:DaSaSo.Wpf.Converters" diff --git a/DaSaSo.Wpf/Sampledata/SewerObjectListSampleData.cs b/DaSaSo.Wpf/Sampledata/SewerObjectListSampleData.cs index 98f441b..fbb96ed 100644 --- a/DaSaSo.Wpf/Sampledata/SewerObjectListSampleData.cs +++ b/DaSaSo.Wpf/Sampledata/SewerObjectListSampleData.cs @@ -24,8 +24,8 @@ namespace DaSaSo.Wpf.Sampledata DN = 200, Material = "STZ", ObjektName = "SW01", - PointFrom = "SW01", - PointTo = "SW02", + //PointFrom = "SW01", + //PointTo = "SW02", StreetName = "Barenberg" }); _objecte.Add( @@ -34,8 +34,8 @@ namespace DaSaSo.Wpf.Sampledata DN = 200, Material = "STZ", ObjektName = "SW01", - PointFrom = "SW01", - PointTo = "SW02", + //PointFrom = "SW01", + //PointTo = "SW02", StreetName = "Barenberg" }); diff --git a/DaSaSo.sln b/DaSaSo.sln index a512a0f..5d39eab 100644 --- a/DaSaSo.sln +++ b/DaSaSo.sln @@ -7,13 +7,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DaSaSo.Domain", "DaSaSo.Dom EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DaSaSo.EntityFramework", "DaSaSo.EntityFramework\DaSaSo.EntityFramework.csproj", "{E75F15AE-D49B-4768-A5EA-DC05AB60A898}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DaSaSo.ConsoleApp", "DaSaSo.ConsoleApp\DaSaSo.ConsoleApp.csproj", "{F4DE6BE1-860A-4088-96E2-D3852A52FE70}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DaSaSo.ConsoleApp", "DaSaSo.ConsoleApp\DaSaSo.ConsoleApp.csproj", "{F4DE6BE1-860A-4088-96E2-D3852A52FE70}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DaSaSo.Wpf", "DaSaSo.Wpf\DaSaSo.Wpf.csproj", "{0B11DE2B-BBAB-465E-B9D4-9E02B804A9CC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DaSaSo.Wpf", "DaSaSo.Wpf\DaSaSo.Wpf.csproj", "{0B11DE2B-BBAB-465E-B9D4-9E02B804A9CC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DaSaSo.ViewModel", "DaSaSo.ViewModel\DaSaSo.ViewModel.csproj", "{7CC8889C-87AD-4E32-B9AB-C4B322828797}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DaSaSo.ViewModel", "DaSaSo.ViewModel\DaSaSo.ViewModel.csproj", "{7CC8889C-87AD-4E32-B9AB-C4B322828797}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DaSaSo.InMemoryProvider", "DaSaSo.InMemoryProvider\DaSaSo.InMemoryProvider.csproj", "{838B8397-FF4A-4E61-A6A8-B3F8D00D120D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DaSaSo.InMemoryProvider", "DaSaSo.InMemoryProvider\DaSaSo.InMemoryProvider.csproj", "{838B8397-FF4A-4E61-A6A8-B3F8D00D120D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DaSaSo.DatabaseConverter", "DaSaSo.DatabaseConverter\DaSaSo.DatabaseConverter.csproj", "{E0842F1A-E74D-4B84-BD27-3585901B0DE9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -45,6 +47,10 @@ Global {838B8397-FF4A-4E61-A6A8-B3F8D00D120D}.Debug|Any CPU.Build.0 = Debug|Any CPU {838B8397-FF4A-4E61-A6A8-B3F8D00D120D}.Release|Any CPU.ActiveCfg = Release|Any CPU {838B8397-FF4A-4E61-A6A8-B3F8D00D120D}.Release|Any CPU.Build.0 = Release|Any CPU + {E0842F1A-E74D-4B84-BD27-3585901B0DE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E0842F1A-E74D-4B84-BD27-3585901B0DE9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E0842F1A-E74D-4B84-BD27-3585901B0DE9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0842F1A-E74D-4B84-BD27-3585901B0DE9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE