diff --git a/BeWo/Core/BeWoUtils.cs b/BeWo/Core/BeWoUtils.cs index c5d964e77..d4e9ad2be 100644 --- a/BeWo/Core/BeWoUtils.cs +++ b/BeWo/Core/BeWoUtils.cs @@ -1677,9 +1677,21 @@ namespace BeWo.Core } break; case ServiceRecordValidationResult.Custom: - MessageBox.Show(result.Message, "Speichern nicht möglich", MessageBoxButton.OK, MessageBoxImage.Error); - lValid = false; - exitLoop = true; + if (result.Allow) + { + if (MessageBox.Show(result.Message, "Speichern", MessageBoxButton.YesNo, MessageBoxImage.Warning).Equals(MessageBoxResult.No)) + { + lValid = false; + exitLoop = true; + } + } + else + { + MessageBox.Show(result.Message, "Speichern nicht möglich", MessageBoxButton.OK, MessageBoxImage.Error); + lValid = false; + exitLoop = true; + } + break; } @@ -1690,14 +1702,64 @@ namespace BeWo.Core return lValid; } - /// - /// Erzeugt einen Report mit Hilfe des ReportServices und zeigt ihn in einem BeWoWindow - /// - /// Titel des Fensters - /// Documentpreview für den Report - /// Dictionary mit Variablen für das ReportObject - /// Der Typ des Reports (z.B. KalenderMonatsformatReport) - public static void ShowReport(string title, DocumentPreview documentPreview, Dictionary variablen, ReportEnum reportType) + public static bool ValidateServiceRecordDeletion(ServiceRecordVM vm) + { + var lValid = true; + + + var dc = vm.CommitToDataContract(); + var emp = BeWoApp.LoggedOnUser.Employee; + + + var r = new List(); + + + //ServiceFacade.DoOperationsServiceSync(o => r = o.ValidateServiceRecord(dc, statistics, maxdays, employeeOids, cb2ScOids)); + + + if (r.Count > 0) + { + var exitLoop = false; + + foreach (var result in r) + { + switch (result.ResultType) + { + + case ServiceRecordValidationResult.Custom: + if (result.Allow) + { + if (MessageBox.Show(result.Message, "Löschen", MessageBoxButton.YesNo, MessageBoxImage.Warning).Equals(MessageBoxResult.No)) + { + lValid = false; + exitLoop = true; + } + } + else + { + MessageBox.Show(result.Message, "Löschen nicht möglich", MessageBoxButton.OK, MessageBoxImage.Error); + lValid = false; + exitLoop = true; + } + + break; + } + + if (exitLoop) break; + } + } + + return lValid; + } + + /// + /// Erzeugt einen Report mit Hilfe des ReportServices und zeigt ihn in einem BeWoWindow + /// + /// Titel des Fensters + /// Documentpreview für den Report + /// Dictionary mit Variablen für das ReportObject + /// Der Typ des Reports (z.B. KalenderMonatsformatReport) + public static void ShowReport(string title, DocumentPreview documentPreview, Dictionary variablen, ReportEnum reportType) { switch (reportType) { diff --git a/BeWo/View/Detail/CustomerView.xaml b/BeWo/View/Detail/CustomerView.xaml index 6e58b5075..7aa43a78e 100644 --- a/BeWo/View/Detail/CustomerView.xaml +++ b/BeWo/View/Detail/CustomerView.xaml @@ -438,25 +438,23 @@ - + - - - - @@ -487,7 +483,7 @@ @@ -1353,7 +1347,7 @@ - @@ -1443,18 +1437,18 @@ - +