Pflichtfelder bei Neuanlage gefixt

This commit is contained in:
Daniel Schick 2023-12-07 10:49:32 +01:00
parent 08edd7d1d8
commit ee071d6b9d

View File

@ -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;