From 09f8a9953f3f80b3fce87d4f6b2da5e4d479321e Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Sat, 31 Mar 2018 05:48:00 +0000 Subject: [PATCH] =?UTF-8?q?5.0.7:=20Copy-Funktion=20mit=20Ausl=C3=B6schung?= =?UTF-8?q?=20bestehender=20Anmeldung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs | 30 +++++++++++++++++-- ENI-2/ENI2/ENI2/ENI2.csproj | 2 +- .../ENI2/Properties/Resources.Designer.cs | 9 ++++++ ENI-2/ENI2/ENI2/Properties/Resources.resx | 3 ++ 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index 8f8d7905..ff5b19ef 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -237,13 +237,37 @@ namespace ENI2 if(MessageBox.Show(Properties.Resources.textDeclarationAlreadyExists, Properties.Resources.textCaptionExists, MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK) { + List existingMessages = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(existingCore, DBManager.MessageLoad.ALL); + foreach(Message existingMessage in existingMessages) + { + if((existingMessage.InternalStatus == Message.BSMDStatus.SENT) && + (existingMessage.MessageNotificationClass != Message.NotificationClass.VISIT) && + (existingMessage.MessageNotificationClass != Message.NotificationClass.TRANSIT)) + { + MessageBox.Show(Properties.Resources.textMessagesAlreadySent, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Stop); + return; + } + } + + // delete all existing data of core + existingCore.ETA = newCore.ETA; + existingCore.ETAKielCanal = newCore.ETAKielCanal; + newCore = existingCore; + + foreach (Message existingMessage in existingMessages) + { + if (existingMessage is ISublistContainer) + { + ((ISublistContainer)existingMessage).DeleteElements(); + } + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(existingMessage); + } } else { - - } - return; + return; + } } DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(newCore); diff --git a/ENI-2/ENI2/ENI2/ENI2.csproj b/ENI-2/ENI2/ENI2/ENI2.csproj index c02f6819..f39e35f3 100644 --- a/ENI-2/ENI2/ENI2/ENI2.csproj +++ b/ENI-2/ENI2/ENI2/ENI2.csproj @@ -36,7 +36,7 @@ true publish.html 1 - 5.0.6.%2a + 5.0.7.%2a false true true diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs index 2022f536..3d6da551 100644 --- a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs +++ b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs @@ -2879,6 +2879,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to One or more messages have already been sent. Cannot overwrite target declaration!. + /// + public static string textMessagesAlreadySent { + get { + return ResourceManager.GetString("textMessagesAlreadySent", resourceCulture); + } + } + /// /// Looks up a localized string similar to Message sent at {0}. /// diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.resx b/ENI-2/ENI2/ENI2/Properties/Resources.resx index dc189a16..52d4f6d7 100644 --- a/ENI-2/ENI2/ENI2/Properties/Resources.resx +++ b/ENI-2/ENI2/ENI2/Properties/Resources.resx @@ -1645,4 +1645,7 @@ There is already a declaration with this ID. A new declaration will not be created. Do you want to clear all data? + + One or more messages have already been sent. Cannot overwrite target declaration! + \ No newline at end of file