From ee071d6b9d0bdb1d42720fcda943975f80111b33 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Thu, 7 Dec 2023 10:49:32 +0100 Subject: [PATCH] Pflichtfelder bei Neuanlage gefixt --- src/BreCalClient/EditShipcallControl.xaml.cs | 28 ++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/BreCalClient/EditShipcallControl.xaml.cs b/src/BreCalClient/EditShipcallControl.xaml.cs index 2456bd9..80a033a 100644 --- a/src/BreCalClient/EditShipcallControl.xaml.cs +++ b/src/BreCalClient/EditShipcallControl.xaml.cs @@ -145,8 +145,32 @@ namespace BreCalClient isEnabled &= this.comboBoxShip.SelectedItem != null; isEnabled &= this.comboBoxCategories.SelectedItem != null; - isEnabled &= ((this.comboBoxArrivalBerth.SelectedItem != null) || (this.comboBoxDepartureBerth.SelectedItem != null)); - isEnabled &= (this.datePickerETA.Value.HasValue || this.datePickerETD.Value.HasValue); + + if (comboBoxCategories.SelectedItem == null) + { + isEnabled = false; + } + else + { + TypeEnum callType = (TypeEnum)comboBoxCategories.SelectedItem; + switch (callType) + { + case TypeEnum.Outgoing: + isEnabled &= this.comboBoxDepartureBerth.SelectedItem != null; + isEnabled &= this.datePickerETD.Value.HasValue; + break; + case TypeEnum.Incoming: + isEnabled &= this.comboBoxArrivalBerth.SelectedItem != null; + isEnabled &= this.datePickerETA.Value.HasValue; + break; + case TypeEnum.Shifting: + isEnabled &= ((this.comboBoxDepartureBerth.SelectedItem != null) && (this.comboBoxArrivalBerth.SelectedItem != null)); + isEnabled &= this.datePickerETD.Value.HasValue; + isEnabled &= this.datePickerETA.Value.HasValue; + break; + } + } + isEnabled &= this.comboBoxAgency.SelectedItem != null; this.buttonOK.IsEnabled = isEnabled;