Es wird überprüft auf den Datenbank version
This commit is contained in:
@@ -53,6 +53,10 @@
|
||||
<Project>{c82bd650-466b-403f-bed9-2b1660771f54}</Project>
|
||||
<Name>KlassenBIB</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SanShared\SanShared.csproj">
|
||||
<Project>{c949087e-20e1-4a17-b021-faead363c1d8}</Project>
|
||||
<Name>SanShared</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Diagnostics;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using ICSharpCode.SharpZipLib.Core;
|
||||
using KlassenBIB;
|
||||
using SanShared.Exceptions;
|
||||
|
||||
namespace Database
|
||||
{
|
||||
@@ -40,8 +41,17 @@ namespace Database
|
||||
if (File.Exists(filepath))
|
||||
{
|
||||
File.Copy(filepath, string.Format("{0}_{1}_{2}.bak", filepath,DateTime.Now.ToShortDateString(),DateTime.Now.Ticks));
|
||||
try
|
||||
{
|
||||
loadedProjekt = XamlServices.Load(filepath) as KlassenBIB.Projekt;
|
||||
}
|
||||
catch(XamlObjectWriterException ex)
|
||||
{
|
||||
string msg = ex.Message;
|
||||
if (msg.ToLower().Contains("kann nicht festgelegt werden"))
|
||||
throw new DataBaseVersionMismatchException();
|
||||
}
|
||||
}
|
||||
else
|
||||
loadedProjekt = new KlassenBIB.Projekt();
|
||||
return true;
|
||||
|
||||
28
SanShared/Exceptions/DataBaseVersionMismatchException.cs
Normal file
28
SanShared/Exceptions/DataBaseVersionMismatchException.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SanShared.Exceptions
|
||||
{
|
||||
public class DataBaseVersionMismatchException : Exception
|
||||
{
|
||||
public DataBaseVersionMismatchException()
|
||||
{
|
||||
}
|
||||
|
||||
public DataBaseVersionMismatchException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public DataBaseVersionMismatchException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
protected DataBaseVersionMismatchException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BilderObject.cs" />
|
||||
<Compile Include="Exceptions\DataBaseVersionMismatchException.cs" />
|
||||
<Compile Include="Exceptions\LangNotFoundException.cs" />
|
||||
<Compile Include="IAuftraggeber.cs" />
|
||||
<Compile Include="ILanguage.cs" />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Database;
|
||||
using FluentFTP;
|
||||
using KlassenBIB;
|
||||
using SanShared.Exceptions;
|
||||
using SchnittstelleImporter;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -31,8 +32,15 @@ namespace SanSystem
|
||||
//Global.Instance.
|
||||
|
||||
if (!Directory.Exists(Global.Instance.Projektpfad)) Directory.CreateDirectory(Global.Instance.Projektpfad);
|
||||
try
|
||||
{
|
||||
Datenbank.Instance.LoadProjekt(Global.Instance.ProjektNummer, Global.Instance.Projektpfad);// Path.Combine(Global.Instance.Projektpfad,"18-850.xaml"));
|
||||
|
||||
}
|
||||
catch(DataBaseVersionMismatchException)
|
||||
{
|
||||
MessageBox.Show("Database version mistmatch\nProgramm wird beendet");
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
//Datenbank.Instance.CreateProjekt("");
|
||||
this.Width = Screen.PrimaryScreen.WorkingArea.Width;
|
||||
|
||||
Reference in New Issue
Block a user