Guids werden hinzugefügt
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Datenbank.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="UpdateDatabase.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\KlassenBIB\KlassenBIB.csproj">
|
||||
|
||||
@@ -54,6 +54,8 @@ namespace Database
|
||||
}
|
||||
else
|
||||
loadedProjekt = new KlassenBIB.Projekt();
|
||||
|
||||
UpdateDatabase.UpdateNewGuids();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
30
Database/UpdateDatabase.cs
Normal file
30
Database/UpdateDatabase.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Database
|
||||
{
|
||||
class UpdateDatabase
|
||||
{
|
||||
public static void UpdateNewGuids()
|
||||
{
|
||||
if (Datenbank.Instance.loadedProjekt == null) return;
|
||||
foreach(var entries in Datenbank.Instance.loadedProjekt.Objekte)
|
||||
{
|
||||
|
||||
if(entries.Guid.Equals(Guid.Empty))
|
||||
entries.Guid = Guid.NewGuid();
|
||||
|
||||
|
||||
foreach(var sanierungen in entries.Sanierung)
|
||||
{
|
||||
if (sanierungen.Guid.Equals(Guid.Empty))
|
||||
sanierungen.Guid = Guid.NewGuid();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user