Datenbank wird convertiert
This commit is contained in:
@@ -29,10 +29,18 @@ namespace Database
|
|||||||
|
|
||||||
public KlassenBIB.Projekt loadedProjekt = null;
|
public KlassenBIB.Projekt loadedProjekt = null;
|
||||||
public KlassenBIB.MainDataBase MainDatenbank = null;
|
public KlassenBIB.MainDataBase MainDatenbank = null;
|
||||||
|
public KlassenBIB.DB TeufelDB = null;
|
||||||
|
|
||||||
public Datenbank()
|
public Datenbank()
|
||||||
{
|
{
|
||||||
string filepath = Path.Combine("./projekte","MainDatenbank.xaml");
|
TeufelDB = new KlassenBIB.DB();
|
||||||
|
string filepath = "";
|
||||||
|
filepath = Path.Combine("./projekte", "TeufelDB.xaml");
|
||||||
|
if(File.Exists(filepath))
|
||||||
|
TeufelDB = XamlServices.Load("./projekte/TeufelDB.xaml") as KlassenBIB.DB;
|
||||||
|
|
||||||
|
//Debugger.Break();
|
||||||
|
filepath = Path.Combine("./projekte","MainDatenbank.xaml");
|
||||||
if(File.Exists(filepath))
|
if(File.Exists(filepath))
|
||||||
{
|
{
|
||||||
MainDatenbank = XamlServices.Load(filepath) as KlassenBIB.MainDataBase;
|
MainDatenbank = XamlServices.Load(filepath) as KlassenBIB.MainDataBase;
|
||||||
@@ -71,6 +79,7 @@ namespace Database
|
|||||||
|
|
||||||
UpdateDatabase.UpdateNewGuids();
|
UpdateDatabase.UpdateNewGuids();
|
||||||
UpdateDatabase.TransferAuftraggeber();
|
UpdateDatabase.TransferAuftraggeber();
|
||||||
|
UpdateDatabase.MakeNewDatabaseSystem();
|
||||||
UpdateDatabase.TransferSanierteObjekte();
|
UpdateDatabase.TransferSanierteObjekte();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -211,6 +220,7 @@ namespace Database
|
|||||||
{
|
{
|
||||||
XamlServices.Save("./projekte/MainDatenbank.xaml", MainDatenbank);
|
XamlServices.Save("./projekte/MainDatenbank.xaml", MainDatenbank);
|
||||||
XamlServices.Save(projektpfad, loadedProjekt);
|
XamlServices.Save(projektpfad, loadedProjekt);
|
||||||
|
XamlServices.Save("./projekte/TeufelDB.xaml", TeufelDB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,69 @@ namespace Database
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void MakeNewDatabaseSystem()
|
||||||
|
{
|
||||||
|
List<string> projekte = new List<string>();
|
||||||
|
|
||||||
|
Projekt tempProjekt = null;
|
||||||
|
foreach (DirectoryInfo projekt in (new DirectoryInfo("./projekte").GetDirectories()))
|
||||||
|
{
|
||||||
|
projekte.Add(projekt.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (string t in projekte)
|
||||||
|
{
|
||||||
|
string filepath = Path.Combine("projekte", t, string.Format("{0}.xaml", t));
|
||||||
|
if (!File.Exists(filepath)) continue;
|
||||||
|
tempProjekt = XamlServices.Load(filepath) as KlassenBIB.Projekt;
|
||||||
|
Datenbank.Instance.TeufelDB.Projekte.Add(tempProjekt);
|
||||||
|
|
||||||
|
//var x = Datenbank.Instance.MainDatenbank.AuftraggeberListe;
|
||||||
|
}
|
||||||
|
Datenbank.Instance.TeufelDB.Auftraggeber = Datenbank.Instance.MainDatenbank.AuftraggeberListe;
|
||||||
|
Datenbank.Instance.TeufelDB.Imprägnierungen = Datenbank.Instance.MainDatenbank.ImprägnierBerichtListe;
|
||||||
|
|
||||||
|
ClearImprägnierungen();
|
||||||
|
GenerateNewBeziehungen();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ClearImprägnierungen()
|
||||||
|
{
|
||||||
|
foreach(var x in Datenbank.Instance.TeufelDB.Imprägnierungen)
|
||||||
|
{
|
||||||
|
if (x.MitLinerSanierteObjekte == null) continue;
|
||||||
|
x.MitLinerSanierteObjekte.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GenerateNewBeziehungen()
|
||||||
|
{
|
||||||
|
string imprägnierungsnummer = "";
|
||||||
|
foreach(Projekt projekt in Datenbank.Instance.TeufelDB.Projekte)
|
||||||
|
{
|
||||||
|
foreach(Inspektionsobjekt inspektionsobjekt in projekt.Objekte)
|
||||||
|
{
|
||||||
|
if(inspektionsobjekt.Sanierung.Count > 0)
|
||||||
|
{
|
||||||
|
foreach(var sanierung in inspektionsobjekt.Sanierung)
|
||||||
|
{
|
||||||
|
if(sanierung is KlassenBIB.InlinerSanierung)
|
||||||
|
{
|
||||||
|
KlassenBIB.InlinerSanierung san = (sanierung as KlassenBIB.InlinerSanierung);
|
||||||
|
if (!(san.Imprägnierungsbericht is KlassenBIB.WerkseitigImprägniert)) continue;
|
||||||
|
KlassenBIB.WerkseitigImprägniert werkseitigImprägniert = (KlassenBIB.WerkseitigImprägniert)san.Imprägnierungsbericht;
|
||||||
|
imprägnierungsnummer = werkseitigImprägniert.Imprägniernummer;
|
||||||
|
//san.Imprägnierungsbericht = null;
|
||||||
|
san.Imprägnierungsbericht = Datenbank.Instance.TeufelDB.Imprägnierungen.Find(x => x.Imprägniernummer.Equals(imprägnierungsnummer));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Debugger.Break();
|
||||||
|
}
|
||||||
|
|
||||||
public static void TransferAuftraggeber()
|
public static void TransferAuftraggeber()
|
||||||
{
|
{
|
||||||
List<string> projekte = new List<string>();
|
List<string> projekte = new List<string>();
|
||||||
|
|||||||
12
KlassenBIB/Collections/Projekte.cs
Normal file
12
KlassenBIB/Collections/Projekte.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace KlassenBIB.Collections
|
||||||
|
{
|
||||||
|
public class Projekte : List<Projekt>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
22
KlassenBIB/DB.cs
Normal file
22
KlassenBIB/DB.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace KlassenBIB
|
||||||
|
{
|
||||||
|
public class DB
|
||||||
|
{
|
||||||
|
public Collections.Projekte Projekte { get; set; }
|
||||||
|
public Collections.AuftraggeberList Auftraggeber { get; set; }
|
||||||
|
public Collections.ImprägnierBericht Imprägnierungen { get; set; }
|
||||||
|
|
||||||
|
public DB()
|
||||||
|
{
|
||||||
|
Projekte = new Collections.Projekte();
|
||||||
|
Auftraggeber = new Collections.AuftraggeberList();
|
||||||
|
Imprägnierungen = new Collections.ImprägnierBericht();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -45,6 +45,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Collections\ImprägnierBericht.cs" />
|
<Compile Include="Collections\ImprägnierBericht.cs" />
|
||||||
|
<Compile Include="Collections\Projekte.cs" />
|
||||||
|
<Compile Include="DB.cs" />
|
||||||
<Compile Include="Sanierung\Renovation\AbstractImprägnier.cs" />
|
<Compile Include="Sanierung\Renovation\AbstractImprägnier.cs" />
|
||||||
<Compile Include="Collections\AbwasserTechnischeAnlage.cs" />
|
<Compile Include="Collections\AbwasserTechnischeAnlage.cs" />
|
||||||
<Compile Include="Sanierung\Renovation\UVAnlagenTyp.cs" />
|
<Compile Include="Sanierung\Renovation\UVAnlagenTyp.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user