From a75b69175cf27413b6b3598c6334402e0741e98d Mon Sep 17 00:00:00 2001 From: Husky Date: Fri, 12 Jul 2019 08:27:09 +0200 Subject: [PATCH 1/4] =?UTF-8?q?Auftraggeber=20Datenbank=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/Datenbank.cs | 15 ++++++++++++++ KlassenBIB/AuftraggeberListCollection.cs | 15 ++++++++++++++ KlassenBIB/KlassenBIB.csproj | 2 ++ KlassenBIB/MainDataBase.cs | 25 ++++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 KlassenBIB/AuftraggeberListCollection.cs create mode 100644 KlassenBIB/MainDataBase.cs diff --git a/Database/Datenbank.cs b/Database/Datenbank.cs index edfbadf..33e74f2 100644 --- a/Database/Datenbank.cs +++ b/Database/Datenbank.cs @@ -28,6 +28,20 @@ namespace Database } public KlassenBIB.Projekt loadedProjekt = null; + public KlassenBIB.MainDataBase MainDatenbank = null; + + public Datenbank() + { + string filepath = Path.Combine("./projekte","MainDatenbank.xaml"); + if(File.Exists(filepath)) + { + MainDatenbank = XamlServices.Load(filepath) as KlassenBIB.MainDataBase; + } + else + { + MainDatenbank = new MainDataBase(); + } + } private string projektpfad = string.Empty; public bool LoadProjekt(string projekt, string projektpfad) @@ -193,6 +207,7 @@ namespace Database public void SaveProjekt() { + XamlServices.Save("./projekte/MainDatenbank.xaml", MainDatenbank); XamlServices.Save(projektpfad, loadedProjekt); } } diff --git a/KlassenBIB/AuftraggeberListCollection.cs b/KlassenBIB/AuftraggeberListCollection.cs new file mode 100644 index 0000000..23f3a8c --- /dev/null +++ b/KlassenBIB/AuftraggeberListCollection.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KlassenBIB +{ + /// + /// + /// + public class AuftraggeberListCollection : List + { + } +} diff --git a/KlassenBIB/KlassenBIB.csproj b/KlassenBIB/KlassenBIB.csproj index 23f005c..8f143d2 100644 --- a/KlassenBIB/KlassenBIB.csproj +++ b/KlassenBIB/KlassenBIB.csproj @@ -45,12 +45,14 @@ + + diff --git a/KlassenBIB/MainDataBase.cs b/KlassenBIB/MainDataBase.cs new file mode 100644 index 0000000..8eee451 --- /dev/null +++ b/KlassenBIB/MainDataBase.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Markup; + +namespace KlassenBIB +{ + /// + /// + /// + [ContentProperty("AuftraggeberListe")] + public class MainDataBase + { + /// + /// + /// + public AuftraggeberListCollection AuftraggeberListe { get; set; } + public MainDataBase() + { + AuftraggeberListe = new AuftraggeberListCollection(); + } + } +} From 7e40ad185048fdb5a3040aa532b419d9848f8226 Mon Sep 17 00:00:00 2001 From: Husky Date: Fri, 12 Jul 2019 08:27:09 +0200 Subject: [PATCH 2/4] =?UTF-8?q?Auftraggeber=20Datenbank=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/Datenbank.cs | 15 ++++++++++++++ KlassenBIB/AuftraggeberListCollection.cs | 15 ++++++++++++++ KlassenBIB/KlassenBIB.csproj | 2 ++ KlassenBIB/MainDataBase.cs | 25 ++++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 KlassenBIB/AuftraggeberListCollection.cs create mode 100644 KlassenBIB/MainDataBase.cs diff --git a/Database/Datenbank.cs b/Database/Datenbank.cs index edfbadf..33e74f2 100644 --- a/Database/Datenbank.cs +++ b/Database/Datenbank.cs @@ -28,6 +28,20 @@ namespace Database } public KlassenBIB.Projekt loadedProjekt = null; + public KlassenBIB.MainDataBase MainDatenbank = null; + + public Datenbank() + { + string filepath = Path.Combine("./projekte","MainDatenbank.xaml"); + if(File.Exists(filepath)) + { + MainDatenbank = XamlServices.Load(filepath) as KlassenBIB.MainDataBase; + } + else + { + MainDatenbank = new MainDataBase(); + } + } private string projektpfad = string.Empty; public bool LoadProjekt(string projekt, string projektpfad) @@ -193,6 +207,7 @@ namespace Database public void SaveProjekt() { + XamlServices.Save("./projekte/MainDatenbank.xaml", MainDatenbank); XamlServices.Save(projektpfad, loadedProjekt); } } diff --git a/KlassenBIB/AuftraggeberListCollection.cs b/KlassenBIB/AuftraggeberListCollection.cs new file mode 100644 index 0000000..23f3a8c --- /dev/null +++ b/KlassenBIB/AuftraggeberListCollection.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KlassenBIB +{ + /// + /// + /// + public class AuftraggeberListCollection : List + { + } +} diff --git a/KlassenBIB/KlassenBIB.csproj b/KlassenBIB/KlassenBIB.csproj index 23f005c..8f143d2 100644 --- a/KlassenBIB/KlassenBIB.csproj +++ b/KlassenBIB/KlassenBIB.csproj @@ -45,12 +45,14 @@ + + diff --git a/KlassenBIB/MainDataBase.cs b/KlassenBIB/MainDataBase.cs new file mode 100644 index 0000000..8eee451 --- /dev/null +++ b/KlassenBIB/MainDataBase.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Markup; + +namespace KlassenBIB +{ + /// + /// + /// + [ContentProperty("AuftraggeberListe")] + public class MainDataBase + { + /// + /// + /// + public AuftraggeberListCollection AuftraggeberListe { get; set; } + public MainDataBase() + { + AuftraggeberListe = new AuftraggeberListCollection(); + } + } +} From 9a77ae650d277dc8bf05af428ff8d63895998a33 Mon Sep 17 00:00:00 2001 From: Husky Date: Thu, 8 Aug 2019 08:58:29 +0200 Subject: [PATCH 3/4] =?UTF-8?q?Anlagen=20hersteller=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KlassenBIB/AnlagenType.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 KlassenBIB/AnlagenType.cs diff --git a/KlassenBIB/AnlagenType.cs b/KlassenBIB/AnlagenType.cs new file mode 100644 index 0000000..a9ea849 --- /dev/null +++ b/KlassenBIB/AnlagenType.cs @@ -0,0 +1,21 @@ +namespace KlassenBIB +{ + /// + /// + /// + public class AnlagenType + { + /// + /// + /// + public string Name { get; set; } + /// + /// + /// + public string Hersteller { get; set; } + /// + /// + /// + public string Seriennummer { get; set; } + } +} From 471ff95d0ba0f87a078e8665fdac0986c244ddd3 Mon Sep 17 00:00:00 2001 From: Husky Date: Thu, 8 Aug 2019 08:59:16 +0200 Subject: [PATCH 4/4] Auftraggber werden nun raussortiert und eingespeichert in globale Datenbank --- Database/Datenbank.cs | 1 + Database/UpdateDatabase.cs | 35 +++++++++++++++++++++++- KlassenBIB/AuftraggeberListCollection.cs | 5 ++-- KlassenBIB/KlassenBIB.csproj | 1 + KlassenBIB/MainDataBase.cs | 3 ++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/Database/Datenbank.cs b/Database/Datenbank.cs index 33e74f2..04e236d 100644 --- a/Database/Datenbank.cs +++ b/Database/Datenbank.cs @@ -70,6 +70,7 @@ namespace Database loadedProjekt = new KlassenBIB.Projekt(); UpdateDatabase.UpdateNewGuids(); + UpdateDatabase.TransferAuftraggeber(); return true; } diff --git a/Database/UpdateDatabase.cs b/Database/UpdateDatabase.cs index e934827..744aafe 100644 --- a/Database/UpdateDatabase.cs +++ b/Database/UpdateDatabase.cs @@ -1,8 +1,12 @@ -using System; +using KlassenBIB; +using SanShared; +using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xaml; namespace Database { @@ -26,5 +30,34 @@ namespace Database } return; } + + public static void TransferAuftraggeber() + { + List projekte = new List(); + List auftraggebers = new List(); + Projekt tempProjekt = null; + foreach(DirectoryInfo projekt in (new DirectoryInfo("./projekte").GetDirectories())) + { + projekte.Add(projekt.Name); + } + + foreach(string t in projekte) + { + tempProjekt = XamlServices.Load(Path.Combine("projekte", t,string.Format("{0}.xaml",t))) as KlassenBIB.Projekt; + + //auftraggebers.Add(tempProjekt.Auftraggeber); + if (Datenbank.Instance.MainDatenbank.AuftraggeberListe.Contains(tempProjekt.Auftraggeber)) + { + + continue; + } + + Datenbank.Instance.MainDatenbank.AuftraggeberListe.Add(tempProjekt.Auftraggeber); + + + + + } + } } } diff --git a/KlassenBIB/AuftraggeberListCollection.cs b/KlassenBIB/AuftraggeberListCollection.cs index 23f3a8c..05ce1b9 100644 --- a/KlassenBIB/AuftraggeberListCollection.cs +++ b/KlassenBIB/AuftraggeberListCollection.cs @@ -1,4 +1,5 @@ -using System; +using SanShared; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -9,7 +10,7 @@ namespace KlassenBIB /// /// /// - public class AuftraggeberListCollection : List + public class AuftraggeberListCollection : List { } } diff --git a/KlassenBIB/KlassenBIB.csproj b/KlassenBIB/KlassenBIB.csproj index 8f143d2..e691d3b 100644 --- a/KlassenBIB/KlassenBIB.csproj +++ b/KlassenBIB/KlassenBIB.csproj @@ -44,6 +44,7 @@ + diff --git a/KlassenBIB/MainDataBase.cs b/KlassenBIB/MainDataBase.cs index 8eee451..5b27721 100644 --- a/KlassenBIB/MainDataBase.cs +++ b/KlassenBIB/MainDataBase.cs @@ -17,6 +17,9 @@ namespace KlassenBIB /// /// public AuftraggeberListCollection AuftraggeberListe { get; set; } + /// + /// + /// public MainDataBase() { AuftraggeberListe = new AuftraggeberListCollection();