Fixed situation where end time was reset after from time left 24h window

This commit is contained in:
Daniel Schick 2024-11-11 11:01:31 +01:00
parent 2576127b79
commit 9bb847242c
5 changed files with 163 additions and 179 deletions

View File

@ -1,6 +1,6 @@
// Copyright (c) 2023 schick Informatik
// Description: Input control for incoming shipcalls
//
//
using BreCalClient.misc.Model;
using System;
@ -33,14 +33,14 @@ namespace BreCalClient
public ShipcallControlModel ShipcallModel { get; set; } = new();
public Times Times { get; set; } = new();
public Times Times { get; set; } = new();
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
{
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
{
@ -51,9 +51,9 @@ namespace BreCalClient
this.comboBoxTug.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TUG);
this.comboBoxTerminal.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TERMINAL);
}
this.CopyToControls();
this.Title = this.ShipcallModel?.Title;
Participant? p = null;
@ -73,7 +73,7 @@ namespace BreCalClient
(App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD);
this.EnableControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
@ -101,49 +101,43 @@ namespace BreCalClient
#region private methods
private bool CheckValues(out string message)
{
{
message = "";
if (this.datePickerETA.Value.IsTooOld() && (this.datePickerETA.Value != this.Times.EtaBerth))
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
if(this.datePickerETA_End.Value.IsTooOld() && (this.datePickerETA_End.Value != this.Times.EtaIntervalEnd))
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
if(this.datePickerETA.Value.HasValue && this.datePickerETA_End.Value.HasValue && this.datePickerETA.Value > this.datePickerETA_End.Value)
if ((this.datePickerETA.Value != this.Times.EtaBerth) || (this.datePickerETA_End.Value != this.Times.EtaBerth)) // something has changed
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
if (datePickerETA.Value.IsTooOld() || datePickerETA_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
if (this.datePickerETA.Value.HasValue && this.datePickerETA_End.Value.HasValue && this.datePickerETA.Value > this.datePickerETA_End.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
}
if (this.datePickerTidalWindowFrom.Value.IsTooOld() && (this.datePickerTidalWindowTo.Value == null) && (this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom))
if((this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom) || (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo)) // something has changed
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
if(datePickerTidalWindowTo.Value.IsTooOld() || this.datePickerTidalWindowFrom.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
if (this.datePickerTidalWindowTo.Value.IsTooOld() && (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo))
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
if (this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue && this.datePickerTidalWindowFrom.Value > this.datePickerTidalWindowTo.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
return false;
}
if (this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue && this.datePickerTidalWindowFrom.Value > this.datePickerTidalWindowTo.Value)
{
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
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.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())
@ -152,6 +146,12 @@ namespace BreCalClient
return false;
}
if((this.datePickerETA_End.Value.HasValue && !this.datePickerETA.Value.HasValue) || (this.datePickerTidalWindowTo.Value.HasValue && !this.datePickerTidalWindowFrom.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}
@ -161,7 +161,7 @@ namespace BreCalClient
{
this.Times.EtaBerth = this.datePickerETA.Value;
this.Times.EtaIntervalEnd = this.datePickerETA_End.Value;
if (this.comboBoxPierside.SelectedIndex >= 0)
{
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0);
@ -171,8 +171,8 @@ namespace BreCalClient
this.ShipcallModel.Shipcall.PierSide = null;
}
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
this.Times.BerthId = (int?)this.comboBoxArrivalBerth.SelectedValue;
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
this.Times.BerthId = (int?)this.comboBoxArrivalBerth.SelectedValue;
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
@ -180,9 +180,9 @@ namespace BreCalClient
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
this.ShipcallModel.Shipcall.Anchored = this.checkBoxAnchored.IsChecked;
this.ShipcallModel.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
this.ShipcallModel.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
this.ShipcallModel.Shipcall.Bunkering = this.checkBoxBunkering.IsChecked;
this.ShipcallModel.Shipcall.ReplenishingTerminal = this.checkBoxReplenishingTerminal.IsChecked;
@ -194,7 +194,7 @@ namespace BreCalClient
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
if (participant != null)
{
ParticipantAssignment participantAssignment = new() {
ParticipantAssignment participantAssignment = new() {
ParticipantId = participant.Id,
Type = (int)Extensions.ParticipantType.MOORING
};
@ -242,14 +242,14 @@ namespace BreCalClient
if(this.Times.EtaBerth.HasValue)
{
this.datePickerETA.Value = this.Times.EtaBerth.Value;
}
}
else
{
// if not set through times use value of BSMD entry
if (this.ShipcallModel.Shipcall.Eta != DateTime.MinValue)
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
}
this.datePickerETA_End.Value = this.Times.EtaIntervalEnd;
if (Times.BerthId.HasValue)
@ -269,12 +269,12 @@ namespace BreCalClient
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
this.checkBoxAnchored.IsChecked = this.ShipcallModel.Shipcall.Anchored ?? false;
this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
this.checkBoxBunkering.IsChecked = this.ShipcallModel.Shipcall.Bunkering ?? false;
this.checkBoxReplenishingLock.IsChecked = this.ShipcallModel.Shipcall.ReplenishingLock ?? false;
this.checkBoxReplenishingTerminal.IsChecked = this.ShipcallModel.Shipcall.ReplenishingTerminal ?? false;
@ -284,7 +284,7 @@ namespace BreCalClient
else
this.labelETA.Content = string.Format("ETA {0}", BreCalLists.TimeRefs[this.ShipcallModel.Shipcall.TimeRefPoint ?? 0]);
if(!string.IsNullOrEmpty(this.Times.Remarks))
if(!string.IsNullOrEmpty(this.Times.Remarks))
this.textBoxRemarks.Text = this.Times.Remarks;
if (this.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.MOORING))
@ -317,8 +317,8 @@ namespace BreCalClient
{
this.comboBoxTug.SelectedValue = this.ShipcallModel.AssignedParticipants[ParticipantType.TUG].ParticipantId;
}
}
}
}
}
@ -335,10 +335,10 @@ namespace BreCalClient
this.checkBoxCanceled.IsEnabled = _editing;
this.checkBoxAnchored.IsEnabled = _editing;
this.comboBoxTug.IsEnabled = _editing;
this.integerUpDownRecommendedTugs.IsEnabled = _editing;
this.comboBoxPilot.IsEnabled = _editing;
this.comboBoxMooring.IsEnabled = _editing;
this.checkBoxMooredLock.IsEnabled = _editing;
@ -400,17 +400,17 @@ namespace BreCalClient
{
this.comboBoxTerminal.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TERMINAL);
}
}
private void contextMenuItemClearPierside_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPierside.SelectedIndex = -1;
}
}
private void doubleUpDownDraft_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckOKButton();
}
}
private void datePickerETA_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
@ -420,7 +420,7 @@ namespace BreCalClient
private void comboBoxArrivalBerth_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
this.CheckOKButton();
}
}
private void datePickerETA_End_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{

View File

@ -1,18 +1,11 @@
// Copyright (c) 2023 schick Informatik
// Description: Input control for outgoing shipcalls
//
//
using BreCalClient.misc.Model;
using System;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Controls;
using Xceed.Wpf.Toolkit;
using static BreCalClient.Extensions;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Media;
namespace BreCalClient
{
@ -41,14 +34,14 @@ namespace BreCalClient
public ShipcallControlModel ShipcallModel { get; set; } = new();
public Times Times { get; set; } = new();
public Times Times { get; set; } = new();
#endregion
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
{
if ((this.ShipcallModel != null) && (this.ShipcallModel.Shipcall != null))
{
@ -59,7 +52,7 @@ namespace BreCalClient
this.comboBoxTug.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TUG);
this.comboBoxTerminal.ItemsSource = BreCalLists.GetParticipants(portId, ParticipantType.TERMINAL);
}
this.CopyToControls();
this.Title = this.ShipcallModel?.Title;
@ -80,10 +73,10 @@ namespace BreCalClient
(App.Participant.IsTypeFlagSet(ParticipantType.BSMD) && allowBSMD);
this.EnableControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
@ -114,16 +107,13 @@ namespace BreCalClient
{
message = "";
if (this.datePickerETD.Value.IsTooOld() && (this.datePickerETD.Value != this.Times.EtdBerth))
if((this.datePickerETD.Value != this.Times.EtdBerth) || (this.datePickerETD_End.Value != this.Times.EtdIntervalEnd))
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
if (this.datePickerETD_End.Value.IsTooOld() && (this.datePickerETD_End.Value != this.Times.EtdIntervalEnd))
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
if (datePickerETD.Value.IsTooOld() || datePickerETD_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
}
if (this.datePickerETD.Value.HasValue && this.datePickerETD_End.Value.HasValue && this.datePickerETD.Value > this.datePickerETD_End.Value)
@ -132,16 +122,13 @@ namespace BreCalClient
return false;
}
if (this.datePickerTidalWindowFrom.Value.IsTooOld() && (this.datePickerTidalWindowTo.Value == null) && (this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom))
if((this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom) || (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo))
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
if (this.datePickerTidalWindowTo.Value.IsTooOld() && (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo))
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
if (this.datePickerTidalWindowTo.Value.IsTooOld() || this.datePickerTidalWindowFrom.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
}
if (this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue && this.datePickerTidalWindowFrom.Value > this.datePickerTidalWindowTo.Value)
@ -162,6 +149,12 @@ namespace BreCalClient
return false;
}
if((this.datePickerETD_End.Value.HasValue && !this.datePickerETD.Value.HasValue) || (this.datePickerTidalWindowTo.Value.HasValue && !this.datePickerTidalWindowFrom.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}
@ -182,16 +175,16 @@ namespace BreCalClient
}
this.Times.BerthId = (int?)this.comboBoxDepartureBerth.SelectedValue;
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
this.ShipcallModel.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
this.ShipcallModel.Shipcall.Canceled = this.checkBoxCanceled.IsChecked;
this.ShipcallModel.Shipcall.RecommendedTugs = this.integerUpDownRecommendedTugs.Value;
this.ShipcallModel.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
this.ShipcallModel.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
if(!string.IsNullOrEmpty(this.textBoxRemarks.Text.Trim()))
@ -255,7 +248,7 @@ namespace BreCalClient
if (this.ShipcallModel.Shipcall.Etd != DateTime.MinValue)
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
}
this.datePickerETD_End.Value = this.Times.EtdIntervalEnd;
if (this.Times.BerthId.HasValue)
@ -273,10 +266,10 @@ namespace BreCalClient
this.datePickerTidalWindowFrom.Value = this.ShipcallModel.Shipcall.TidalWindowFrom;
this.datePickerTidalWindowTo.Value = this.ShipcallModel.Shipcall.TidalWindowTo;
this.checkBoxCanceled.IsChecked = this.ShipcallModel.Shipcall.Canceled ?? false;
this.integerUpDownRecommendedTugs.Value = this.ShipcallModel.Shipcall.RecommendedTugs;
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock ?? false;
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo ?? false;
@ -284,7 +277,7 @@ namespace BreCalClient
if ((this.ShipcallModel.Shipcall.TimeRefPoint ?? 0) == 0)
this.labelETD.Content = BreCalClient.Resources.Resources.textETDBerth;
else
this.labelETD.Content = string.Format("ETD {0}", BreCalLists.TimeRefs[this.ShipcallModel.Shipcall.TimeRefPoint ?? 0]);
this.labelETD.Content = string.Format("ETD {0}", BreCalLists.TimeRefs[this.ShipcallModel.Shipcall.TimeRefPoint ?? 0]);
if (!string.IsNullOrEmpty(this.Times.Remarks))
this.textBoxRemarks.Text = this.Times.Remarks;
@ -335,9 +328,9 @@ namespace BreCalClient
this.datePickerTidalWindowTo.IsEnabled = _editing;
this.checkBoxCanceled.IsEnabled = _editing;
this.comboBoxTug.IsEnabled = _editing;
this.integerUpDownRecommendedTugs.IsEnabled = _editing;
this.integerUpDownRecommendedTugs.IsEnabled = _editing;
this.comboBoxPilot.IsEnabled = _editing;
this.comboBoxMooring.IsEnabled = _editing;
this.checkBoxMooredLock.IsEnabled = _editing;
@ -397,12 +390,12 @@ namespace BreCalClient
{
this.comboBoxTerminal.SelectedIndex = -1;
this.ShipcallModel.AssignedParticipants.Remove(Extensions.ParticipantType.TERMINAL);
}
}
private void contextMenuItemClearPierside_Click(object sender, RoutedEventArgs e)
{
this.comboBoxPierside.SelectedIndex = -1;
}
}
private void datePickerETD_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
@ -419,7 +412,7 @@ namespace BreCalClient
CheckOKButton();
}
#endregion
#endregion
}
}

View File

@ -108,17 +108,15 @@ namespace BreCalClient
{
message = "";
if (this.datePickerETA.Value.IsTooOld() && (this.datePickerETA.Value != this.Times.EtaBerth))
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
if (this.datePickerETA_End.Value.IsTooOld() && (this.datePickerETA_End.Value != this.Times.EtaIntervalEnd))
if((this.datePickerETA.Value != this.Times.EtaBerth) || (this.datePickerETA_End.Value != this.Times.EtaIntervalEnd))
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
if (this.datePickerETA.Value.IsTooOld() && this.datePickerETA_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
}
if (this.datePickerETA.Value.HasValue && this.datePickerETA_End.Value.HasValue && this.datePickerETA.Value > this.datePickerETA_End.Value)
{
@ -126,17 +124,14 @@ namespace BreCalClient
return false;
}
if (this.datePickerETD.Value.IsTooOld() && (this.datePickerETD.Value != this.Times.EtdBerth))
if((this.datePickerETD.Value != this.Times.EtdBerth) || (this.datePickerETD_End.Value != this.Times.EtdIntervalEnd))
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
if (this.datePickerETD_End.Value.IsTooOld() && (this.datePickerETD_End.Value != this.Times.EtdIntervalEnd))
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
if (this.datePickerETD.Value.IsTooOld() || this.datePickerETD_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
}
if (this.datePickerETD.Value.HasValue && this.datePickerETD_End.Value.HasValue && this.datePickerETD.Value > this.datePickerETD_End.Value)
{
@ -144,17 +139,14 @@ namespace BreCalClient
return false;
}
if (this.datePickerTidalWindowFrom.Value.IsTooOld() && (this.datePickerTidalWindowTo.Value == null) && (this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom))
if((this.datePickerTidalWindowFrom.Value != this.ShipcallModel.Shipcall?.TidalWindowFrom) || (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo))
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
if (this.datePickerTidalWindowTo.Value.IsTooOld() && (this.datePickerTidalWindowTo.Value != this.ShipcallModel.Shipcall?.TidalWindowTo))
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
if (this.datePickerTidalWindowFrom.Value.IsTooOld() && this.datePickerTidalWindowTo.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textTideTimesInThePast;
return false;
}
}
if (this.datePickerTidalWindowFrom.Value.HasValue && this.datePickerTidalWindowTo.Value.HasValue && this.datePickerTidalWindowFrom.Value > this.datePickerTidalWindowTo.Value)
{

View File

@ -5,7 +5,6 @@
using BreCalClient.misc.Model;
using System;
using System.Runtime.Serialization;
using System.Windows;
using System.Windows.Media.Imaging;
using Xceed.Wpf.Toolkit;
@ -99,16 +98,13 @@ namespace BreCalClient
message = "";
if (this.datePickerETABerth.Value.IsTooOld() && (this.datePickerETABerth_End.Value == null) && (this.datePickerETABerth.Value != this.Times.EtaBerth))
if ((this.datePickerETABerth.Value != this.Times.EtaBerth) || (this.datePickerETABerth_End.Value != this.Times.EtaIntervalEnd))
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
if (this.datePickerETABerth_End.Value.IsTooOld() && this.datePickerETABerth_End.Value != this.Times.EtaIntervalEnd)
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
if (this.datePickerETABerth.Value.IsTooOld() || this.datePickerETABerth_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETAInThePast;
return false;
}
}
if (this.datePickerETABerth.Value.HasValue && this.datePickerETABerth_End.Value.HasValue && this.datePickerETABerth.Value > this.datePickerETABerth_End.Value)
@ -117,16 +113,13 @@ namespace BreCalClient
return false;
}
if (this.datePickerETDBerth.Value.IsTooOld() && (this.datePickerETDBerth_End.Value == null) && (this.datePickerETDBerth.Value != this.Times.EtdBerth))
if((this.datePickerETDBerth.Value != this.Times.EtdBerth) || (this.datePickerETDBerth_End.Value != this.Times.EtdIntervalEnd))
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
if (this.datePickerETDBerth_End.Value.IsTooOld() && this.datePickerETDBerth_End.Value != this.Times.EtdIntervalEnd)
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
if(this.datePickerETDBerth.Value.IsTooOld() || this.datePickerETDBerth_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textETDInThePast;
return false;
}
}
if (this.datePickerETDBerth.Value.HasValue && this.datePickerETDBerth_End.Value.HasValue && this.datePickerETDBerth.Value > this.datePickerETDBerth_End.Value)
@ -154,6 +147,12 @@ namespace BreCalClient
return false;
}
if((this.datePickerETABerth_End.Value.HasValue && !this.datePickerETABerth.Value.HasValue) || (this.datePickerETDBerth_End.Value.HasValue && !this.datePickerETDBerth.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}

View File

@ -1,6 +1,6 @@
// Copyright (c) 2023 schick Informatik
// Description: Terminals have all different fields so a different dialog
//
//
using BreCalClient.misc.Model;
using System;
@ -111,16 +111,13 @@ namespace BreCalClient
message = "";
if (this.datePickerOperationStart.Value.IsTooOld() && (this.datePickerOperationStart_End.Value == null) && (this.datePickerOperationStart.Value != this.Times.OperationsStart))
if((this.datePickerOperationStart.Value != this.Times.OperationsStart) || (this.datePickerOperationStart_End.Value != this.Times.EtaIntervalEnd))
{
message = BreCalClient.Resources.Resources.textOperationStartInThePast;
return false;
}
if (this.datePickerOperationStart_End.Value.IsTooOld() && (this.datePickerOperationStart_End.Value != this.Times.EtaIntervalEnd))
{
message = BreCalClient.Resources.Resources.textOperationStartInThePast;
return false;
if(this.datePickerOperationStart.Value.IsTooOld() || this.datePickerOperationStart_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textOperationStartInThePast;
return false;
}
}
if (this.datePickerOperationStart.Value.HasValue && this.datePickerOperationStart_End.Value.HasValue && this.datePickerOperationStart.Value > this.datePickerOperationStart_End.Value)
@ -129,16 +126,13 @@ namespace BreCalClient
return false;
}
if (this.datePickerOperationEnd.Value.IsTooOld() && (this.datePickerOperationEnd_End.Value == null) && (this.datePickerOperationEnd.Value != this.Times.OperationsEnd))
if ((this.datePickerOperationEnd.Value != this.Times.OperationsEnd) || (this.datePickerOperationEnd_End.Value != this.Times.EtdIntervalEnd))
{
message = BreCalClient.Resources.Resources.textOperationEndInThePast;
return false;
}
if (this.datePickerOperationEnd_End.Value.IsTooOld() && (this.datePickerOperationEnd_End.Value != this.Times.EtdIntervalEnd))
{
message = BreCalClient.Resources.Resources.textOperationEndInThePast;
return false;
if(this.datePickerOperationEnd.Value.IsTooOld() || this.datePickerOperationEnd_End.Value.IsTooOld())
{
message = BreCalClient.Resources.Resources.textOperationEndInThePast;
return false;
}
}
if (this.datePickerOperationEnd.Value.HasValue && this.datePickerOperationEnd_End.Value.HasValue && this.datePickerOperationEnd.Value > this.datePickerOperationEnd_End.Value)
@ -153,6 +147,12 @@ namespace BreCalClient
return false;
}
if((this.datePickerOperationEnd_End.Value.HasValue && !this.datePickerOperationEnd.Value.HasValue) || (this.datePickerOperationStart_End.Value.HasValue && !this.datePickerOperationStart.Value.HasValue))
{
message = BreCalClient.Resources.Resources.textStartTimeMissing;
return false;
}
return true;
}
@ -190,7 +190,7 @@ namespace BreCalClient
case ShipcallType.Arrival:
this.labelEnd.Visibility = Visibility.Hidden;
this.datePickerOperationEnd.Visibility = Visibility.Hidden;
this.datePickerOperationEnd_End.Visibility = Visibility.Hidden;
this.datePickerOperationEnd_End.Visibility = Visibility.Hidden;
this.rowEnd.Height = new(0);
break;
case ShipcallType.Departure:
@ -203,7 +203,7 @@ namespace BreCalClient
this.textBoxBerthRemarks.Visibility = Visibility.Hidden;
break;
case ShipcallType.Shifting:
this.rowStart.Height = new(0);
this.rowStart.Height = new(0);
this.labelBerth.Visibility = Visibility.Hidden;
this.comboBoxBerth.Visibility = Visibility.Hidden;
this.labelPierside.Visibility = Visibility.Hidden;
@ -232,10 +232,10 @@ namespace BreCalClient
this.textBoxBerthRemarks.IsReadOnly = ShipcallModel.Shipcall?.Type != ShipcallType.Arrival;
this.textBoxRemarks.IsReadOnly = false;
this.buttonClearAll.IsEnabled = true;
}
#endregion
}
}