diff --git a/src/BreCalClient/EditShipcallControl.xaml.cs b/src/BreCalClient/EditShipcallControl.xaml.cs
index 65ae975..fd42086 100644
--- a/src/BreCalClient/EditShipcallControl.xaml.cs
+++ b/src/BreCalClient/EditShipcallControl.xaml.cs
@@ -207,12 +207,14 @@ namespace BreCalClient
isEnabled &= this.datePickerETD.Value.HasValue;
if(this.datePickerETD.Value.HasValue)
isEnabled &= (this.datePickerETD.Value.Value > DateTime.Now);
+ isEnabled &= !this.datePickerETD.Value.IsTooFar();
break;
case ShipcallType.Arrival:
isEnabled &= this.comboBoxArrivalBerth.SelectedItem != null;
isEnabled &= this.datePickerETA.Value.HasValue;
if(this.datePickerETA.Value.HasValue)
isEnabled &= (this.datePickerETA.Value.Value > DateTime.Now);
+ isEnabled &= !this.datePickerETA.Value.IsTooFar();
break;
case ShipcallType.Shifting:
isEnabled &= ((this.comboBoxDepartureBerth.SelectedItem != null) && (this.comboBoxArrivalBerth.SelectedItem != null));
@@ -222,6 +224,10 @@ namespace BreCalClient
isEnabled &= (this.datePickerETD.Value.Value > DateTime.Now);
if (this.datePickerETA.Value.HasValue)
isEnabled &= (this.datePickerETA.Value.Value > DateTime.Now);
+ if (this.datePickerETA.Value.HasValue && this.datePickerETD.Value.HasValue)
+ isEnabled &= (this.datePickerETA.Value.Value > this.datePickerETD.Value.Value);
+ isEnabled &= !this.datePickerETD.Value.IsTooFar();
+ isEnabled &= !this.datePickerETA.Value.IsTooFar();
break;
}
}
diff --git a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs
index b1eba3b..db03b11 100644
--- a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs
+++ b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs
@@ -133,6 +133,18 @@ namespace BreCalClient
return false;
}
+ if((this.datePickerTidalWindowFrom.Value.HasValue && !this.datePickerTidalWindowTo.Value.HasValue) || (!this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue))
+ {
+ message = BreCalClient.Resources.Resources.textTidalBothValues;
+ return false;
+ }
+
+ if(this.datePickerETA.Value.IsTooFar() || this.datePickerETA_End.Value.IsTooFar() || this.datePickerTidalWindowFrom.Value.IsTooFar() || this.datePickerTidalWindowTo.Value.IsTooFar())
+ {
+ message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
+ return false;
+ }
+
return true;
}
diff --git a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs
index 7258006..b05ec49 100644
--- a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs
+++ b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs
@@ -143,6 +143,18 @@ namespace BreCalClient
return false;
}
+ if ((this.datePickerTidalWindowFrom.Value.HasValue && !this.datePickerTidalWindowTo.Value.HasValue) || (!this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue))
+ {
+ message = BreCalClient.Resources.Resources.textTidalBothValues;
+ return false;
+ }
+
+ if (this.datePickerETD.Value.IsTooFar() || this.datePickerETD_End.Value.IsTooFar() || this.datePickerTidalWindowFrom.Value.IsTooFar() || this.datePickerTidalWindowTo.Value.IsTooFar())
+ {
+ message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
+ return false;
+ }
+
return true;
}
diff --git a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs
index e8398ce..fdf8619 100644
--- a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs
+++ b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs
@@ -151,6 +151,19 @@ namespace BreCalClient
return false;
}
+ if ((this.datePickerTidalWindowFrom.Value.HasValue && !this.datePickerTidalWindowTo.Value.HasValue) || (!this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue))
+ {
+ message = BreCalClient.Resources.Resources.textTidalBothValues;
+ return false;
+ }
+
+ if (this.datePickerETA.Value.IsTooFar() || this.datePickerETA_End.Value.IsTooFar() || this.datePickerTidalWindowFrom.Value.IsTooFar() || this.datePickerTidalWindowTo.Value.IsTooFar() ||
+ this.datePickerETD.Value.IsTooFar() || this.datePickerETD_End.Value.IsTooFar())
+ {
+ message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
+ return false;
+ }
+
return true;
}
diff --git a/src/BreCalClient/EditTimesControl.xaml.cs b/src/BreCalClient/EditTimesControl.xaml.cs
index b6c23a0..3ce8417 100644
--- a/src/BreCalClient/EditTimesControl.xaml.cs
+++ b/src/BreCalClient/EditTimesControl.xaml.cs
@@ -5,6 +5,7 @@
using BreCalClient.misc.Model;
using System;
+using System.Runtime.Serialization;
using System.Windows;
using System.Windows.Media.Imaging;
using Xceed.Wpf.Toolkit;
@@ -125,7 +126,14 @@ namespace BreCalClient
{
message = BreCalClient.Resources.Resources.textZoneEntryInThePast;
return false;
- }
+ }
+
+ if(this.datePickerATA.Value.IsTooFar() || this.datePickerATD.Value.IsTooFar() || this.datePickerETABerth.Value.IsTooFar() || this.datePickerETABerth_End.Value.IsTooFar() ||
+ this.datePickerETDBerth.Value.IsTooFar() || this.datePickerETDBerth_End.Value.IsTooFar() || this.datePickerLockTime.Value.IsTooFar() || this.datePickerZoneEntry.Value.IsTooFar())
+ {
+ message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
+ return false;
+ }
return true;
}
@@ -236,6 +244,7 @@ namespace BreCalClient
if (this.Times.ParticipantId != App.Participant.Id)
{
this.buttonFixedOrder.IsEnabled = false;
+ this.buttonOK.IsEnabled = false;
return; // if this is not "my" entry, there is no editing!
}
diff --git a/src/BreCalClient/EditTimesTerminalControl.xaml.cs b/src/BreCalClient/EditTimesTerminalControl.xaml.cs
index 6e9af6a..1b43b18 100644
--- a/src/BreCalClient/EditTimesTerminalControl.xaml.cs
+++ b/src/BreCalClient/EditTimesTerminalControl.xaml.cs
@@ -144,6 +144,12 @@ namespace BreCalClient
return false;
}
+ if(this.datePickerOperationEnd.Value.IsTooFar() || this.datePickerOperationEnd_End.Value.IsTooFar() || this.datePickerOperationStart.Value.IsTooFar() || this.datePickerOperationStart_End.Value.IsTooFar())
+ {
+ message = BreCalClient.Resources.Resources.textTooFarInTheFuture;
+ return false;
+ }
+
return true;
}
@@ -208,7 +214,11 @@ namespace BreCalClient
private void EnableControls()
{
- if (this.Times.ParticipantId != App.Participant.Id) return;
+ if (this.Times.ParticipantId != App.Participant.Id)
+ {
+ this.buttonOK.IsEnabled = false;
+ return;
+ }
this.datePickerOperationStart.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival;
this.datePickerOperationStart_End.IsEnabled = ShipcallModel.Shipcall?.Type == ShipcallType.Arrival;
diff --git a/src/BreCalClient/Extensions.cs b/src/BreCalClient/Extensions.cs
index f341598..54fedb3 100644
--- a/src/BreCalClient/Extensions.cs
+++ b/src/BreCalClient/Extensions.cs
@@ -3,10 +3,8 @@
//
using BreCalClient.misc.Model;
-using Newtonsoft.Json.Linq;
using System;
using System.ComponentModel;
-using System.Runtime.CompilerServices;
namespace BreCalClient
{
@@ -60,6 +58,17 @@ namespace BreCalClient
#region public helper
+ public static bool IsTooFar(this DateTime datetime)
+ {
+ return datetime > DateTime.Now.AddYears(1);
+ }
+
+ public static bool IsTooFar(this DateTime? datetime)
+ {
+ if (datetime == null) return false;
+ return datetime > DateTime.Now.AddYears(1);
+ }
+
public static bool IsTypeFlagSet(this Participant participant, ParticipantType flag)
{
return (participant.Type & (uint)flag) != 0;
diff --git a/src/BreCalClient/Resources/Resources.Designer.cs b/src/BreCalClient/Resources/Resources.Designer.cs
index aeada56..3537740 100644
--- a/src/BreCalClient/Resources/Resources.Designer.cs
+++ b/src/BreCalClient/Resources/Resources.Designer.cs
@@ -1208,6 +1208,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to For a tidal window both values must be set.
+ ///
+ public static string textTidalBothValues {
+ get {
+ return ResourceManager.GetString("textTidalBothValues", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Tidal window.
///
@@ -1244,6 +1253,15 @@ namespace BreCalClient.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to A time value is too far in the future.
+ ///
+ public static string textTooFarInTheFuture {
+ get {
+ return ResourceManager.GetString("textTooFarInTheFuture", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Set as a fixed order.
///
diff --git a/src/BreCalClient/Resources/Resources.de.resx b/src/BreCalClient/Resources/Resources.de.resx
index 18947eb..5cf59e7 100644
--- a/src/BreCalClient/Resources/Resources.de.resx
+++ b/src/BreCalClient/Resources/Resources.de.resx
@@ -541,4 +541,10 @@
Zeit Reviereintritt liegt in der Vergangenheit
+
+ Für das Tidenfenster müssen beide Zeiten angegeben werden
+
+
+ Eine Zeiteingabe ist zu weit in der Zukunft
+
\ No newline at end of file
diff --git a/src/BreCalClient/Resources/Resources.resx b/src/BreCalClient/Resources/Resources.resx
index 14cf0f9..0b1de64 100644
--- a/src/BreCalClient/Resources/Resources.resx
+++ b/src/BreCalClient/Resources/Resources.resx
@@ -487,6 +487,9 @@
Terminal
+
+ For a tidal window both values must be set
+
Tidal window
@@ -499,6 +502,9 @@
to
+
+ A time value is too far in the future
+
Set as a fixed order