Merge branch 'auftraggeberDatenbank'

This commit is contained in:
Husky
2019-08-08 20:45:19 +02:00
6 changed files with 75 additions and 1 deletions

View File

@@ -28,6 +28,20 @@ namespace Database
} }
public KlassenBIB.Projekt loadedProjekt = null; 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; private string projektpfad = string.Empty;
public bool LoadProjekt(string projekt, string projektpfad) public bool LoadProjekt(string projekt, string projektpfad)
@@ -56,6 +70,7 @@ namespace Database
loadedProjekt = new KlassenBIB.Projekt(); loadedProjekt = new KlassenBIB.Projekt();
UpdateDatabase.UpdateNewGuids(); UpdateDatabase.UpdateNewGuids();
UpdateDatabase.TransferAuftraggeber();
return true; return true;
} }
@@ -193,6 +208,7 @@ namespace Database
public void SaveProjekt() public void SaveProjekt()
{ {
XamlServices.Save("./projekte/MainDatenbank.xaml", MainDatenbank);
XamlServices.Save(projektpfad, loadedProjekt); XamlServices.Save(projektpfad, loadedProjekt);
} }
} }

View File

@@ -1,8 +1,12 @@
using System; using KlassenBIB;
using SanShared;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xaml;
namespace Database namespace Database
{ {
@@ -26,5 +30,34 @@ namespace Database
} }
return; return;
} }
public static void TransferAuftraggeber()
{
List<string> projekte = new List<string>();
List<IAuftraggeber> auftraggebers = new List<IAuftraggeber>();
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);
}
}
} }
} }

21
KlassenBIB/AnlagenType.cs Normal file
View File

@@ -0,0 +1,21 @@
namespace KlassenBIB
{
/// <summary>
///
/// </summary>
public class AnlagenType
{
/// <summary>
///
/// </summary>
public string Name { get; set; }
/// <summary>
///
/// </summary>
public string Hersteller { get; set; }
/// <summary>
///
/// </summary>
public string Seriennummer { get; set; }
}
}

View File

View File

@@ -44,13 +44,16 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AbwasserTechnischeAnlageCollection.cs" /> <Compile Include="AbwasserTechnischeAnlageCollection.cs" />
<Compile Include="AnlagenType.cs" />
<Compile Include="Auftraggeber.cs" /> <Compile Include="Auftraggeber.cs" />
<Compile Include="AuftraggeberListCollection.cs" />
<Compile Include="BilderCollection.cs" /> <Compile Include="BilderCollection.cs" />
<Compile Include="ChargeNummerCollection.cs" /> <Compile Include="ChargeNummerCollection.cs" />
<Compile Include="Hutprofil.cs" /> <Compile Include="Hutprofil.cs" />
<Compile Include="IImportedObjekte.cs" /> <Compile Include="IImportedObjekte.cs" />
<Compile Include="InlinerSanierung.cs" /> <Compile Include="InlinerSanierung.cs" />
<Compile Include="Kurzliner.cs" /> <Compile Include="Kurzliner.cs" />
<Compile Include="MainDataBase.cs" />
<Compile Include="Projekt.cs" /> <Compile Include="Projekt.cs" />
<Compile Include="Inspektionskuerzeln.cs" /> <Compile Include="Inspektionskuerzeln.cs" />
<Compile Include="InspektionskuerzelnCollection.cs" /> <Compile Include="InspektionskuerzelnCollection.cs" />

View File

@@ -0,0 +1 @@