allow ATA changes in the past, allow OK click if time values have not been changed
This commit is contained in:
parent
72d3ad05bf
commit
be5859424d
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) 2023 schick Informatik
|
// Copyright (c) 2023 schick Informatik
|
||||||
// Description: Single dialog to edit times for all participant types
|
// Description: Single dialog to edit times for all participant types
|
||||||
// (we might use different controls at a later time)
|
// (we might use different controls at a later time)
|
||||||
//
|
//
|
||||||
|
|
||||||
using BreCalClient.misc.Model;
|
using BreCalClient.misc.Model;
|
||||||
using System;
|
using System;
|
||||||
@ -40,7 +40,7 @@ namespace BreCalClient
|
|||||||
#region event handler
|
#region event handler
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.EnableControls();
|
this.EnableControls();
|
||||||
this.CopyToControls();
|
this.CopyToControls();
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ namespace BreCalClient
|
|||||||
this.DialogResult = true;
|
this.DialogResult = true;
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonCancel_Click(object sender, RoutedEventArgs e)
|
private void buttonCancel_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@ -98,13 +98,13 @@ namespace BreCalClient
|
|||||||
|
|
||||||
message = "";
|
message = "";
|
||||||
|
|
||||||
if (this.datePickerETABerth.Value.HasValue && (this.datePickerETABerth.Value.Value < DateTime.Now) && (this.datePickerETABerth_End.Value == null))
|
if (this.datePickerETABerth.Value.HasValue && (this.datePickerETABerth.Value.Value < DateTime.Now) && (this.datePickerETABerth_End.Value == null) && (this.datePickerETABerth.Value != this.Times.EtaBerth))
|
||||||
{
|
{
|
||||||
message = BreCalClient.Resources.Resources.textETAInThePast;
|
message = BreCalClient.Resources.Resources.textETAInThePast;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.datePickerETABerth_End.Value.HasValue && this.datePickerETABerth_End.Value < DateTime.Now)
|
if (this.datePickerETABerth_End.Value.HasValue && this.datePickerETABerth_End.Value < DateTime.Now && this.datePickerETABerth_End.Value != this.Times.EtaIntervalEnd)
|
||||||
{
|
{
|
||||||
message = BreCalClient.Resources.Resources.textETAInThePast;
|
message = BreCalClient.Resources.Resources.textETAInThePast;
|
||||||
return false;
|
return false;
|
||||||
@ -116,13 +116,31 @@ namespace BreCalClient
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.datePickerLockTime.Value.HasValue && (this.datePickerLockTime.Value.Value < DateTime.Now))
|
if (this.datePickerETDBerth.Value.HasValue && (this.datePickerETDBerth.Value.Value < DateTime.Now) && (this.datePickerETABerth_End.Value == null) && (this.datePickerETDBerth.Value != this.Times.EtdBerth))
|
||||||
|
{
|
||||||
|
message = BreCalClient.Resources.Resources.textETDInThePast;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.datePickerETDBerth_End.Value.HasValue && this.datePickerETDBerth_End.Value < DateTime.Now && this.datePickerETDBerth_End.Value != this.Times.EtdIntervalEnd)
|
||||||
|
{
|
||||||
|
message = BreCalClient.Resources.Resources.textETDInThePast;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.datePickerETDBerth.Value.HasValue && this.datePickerETDBerth_End.Value.HasValue && this.datePickerETDBerth.Value > this.datePickerETDBerth_End.Value)
|
||||||
|
{
|
||||||
|
message = BreCalClient.Resources.Resources.textEndValueBeforeStartValue;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.datePickerLockTime.Value.HasValue && (this.datePickerLockTime.Value.Value < DateTime.Now) && (this.datePickerLockTime.Value != this.Times.LockTime))
|
||||||
{
|
{
|
||||||
message = BreCalClient.Resources.Resources.textLockTimeInThePast;
|
message = BreCalClient.Resources.Resources.textLockTimeInThePast;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.datePickerZoneEntry.Value.HasValue && this.datePickerZoneEntry.Value < DateTime.Now)
|
if (this.datePickerZoneEntry.Value.HasValue && this.datePickerZoneEntry.Value < DateTime.Now && this.datePickerZoneEntry.Value != this.Times.ZoneEntry)
|
||||||
{
|
{
|
||||||
message = BreCalClient.Resources.Resources.textZoneEntryInThePast;
|
message = BreCalClient.Resources.Resources.textZoneEntryInThePast;
|
||||||
return false;
|
return false;
|
||||||
@ -155,13 +173,13 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
this.textBoxRemarks.Text = this.Times.Remarks;
|
this.textBoxRemarks.Text = this.Times.Remarks;
|
||||||
this.datePickerETABerth.Value = this.Times.EtaBerth;
|
this.datePickerETABerth.Value = this.Times.EtaBerth;
|
||||||
if(this.datePickerETABerth.IsEnabled && (this.Times.EtaBerth == null) && (this.AgencyTimes?.EtaBerth != null) && (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival))
|
if(this.datePickerETABerth.IsEnabled && (this.Times.EtaBerth == null) && (this.AgencyTimes?.EtaBerth != null) && (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival) && (this.AgencyTimes?.EtaBerth > DateTime.Now))
|
||||||
{
|
{
|
||||||
this.datePickerETABerth.Value = this.AgencyTimes.EtaBerth;
|
this.datePickerETABerth.Value = this.AgencyTimes.EtaBerth;
|
||||||
if (this.datePickerETABerth.Template.FindName("PART_TextBox", this.datePickerETABerth) is WatermarkTextBox tb) { tb.Focus(); tb.SelectAll(); }
|
if (this.datePickerETABerth.Template.FindName("PART_TextBox", this.datePickerETABerth) is WatermarkTextBox tb) { tb.Focus(); tb.SelectAll(); }
|
||||||
}
|
}
|
||||||
this.datePickerETDBerth.Value = this.Times.EtdBerth;
|
this.datePickerETDBerth.Value = this.Times.EtdBerth;
|
||||||
if(this.datePickerETDBerth.IsEnabled && (this.Times.EtdBerth == null) && (this.AgencyTimes?.EtdBerth != null) && ((ShipcallModel.Shipcall?.Type == ShipcallType.Departure) || (ShipcallModel.Shipcall?.Type == ShipcallType.Shifting)))
|
if(this.datePickerETDBerth.IsEnabled && (this.Times.EtdBerth == null) && (this.AgencyTimes?.EtdBerth != null) && ((ShipcallModel.Shipcall?.Type == ShipcallType.Departure) || (ShipcallModel.Shipcall?.Type == ShipcallType.Shifting)) && (this.AgencyTimes?.EtdBerth > DateTime.Now))
|
||||||
{
|
{
|
||||||
this.datePickerETDBerth.Value = this.AgencyTimes.EtdBerth;
|
this.datePickerETDBerth.Value = this.AgencyTimes.EtdBerth;
|
||||||
if (this.datePickerETDBerth.Template.FindName("PART_TextBox", this.datePickerETDBerth) is WatermarkTextBox tb) tb.SelectAll();
|
if (this.datePickerETDBerth.Template.FindName("PART_TextBox", this.datePickerETDBerth) is WatermarkTextBox tb) tb.SelectAll();
|
||||||
@ -192,13 +210,13 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
this.labelETA.Content = string.Format("ETA {0}", BreCalLists.TimeRefs[displayIndex]);
|
this.labelETA.Content = string.Format("ETA {0}", BreCalLists.TimeRefs[displayIndex]);
|
||||||
this.labelETD.Content = string.Format("ETD {0}", BreCalLists.TimeRefs[displayIndex]);
|
this.labelETD.Content = string.Format("ETD {0}", BreCalLists.TimeRefs[displayIndex]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.labelETA.Content = BreCalClient.Resources.Resources.textETABerth;
|
this.labelETA.Content = BreCalClient.Resources.Resources.textETABerth;
|
||||||
this.labelETD.Content = BreCalClient.Resources.Resources.textETDBerth;
|
this.labelETD.Content = BreCalClient.Resources.Resources.textETDBerth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.SetLockButton(this.Times.EtaBerthFixed ?? false);
|
this.SetLockButton(this.Times.EtaBerthFixed ?? false);
|
||||||
}
|
}
|
||||||
@ -264,11 +282,11 @@ namespace BreCalClient
|
|||||||
case Extensions.ParticipantType.PORT_ADMINISTRATION:
|
case Extensions.ParticipantType.PORT_ADMINISTRATION:
|
||||||
this.datePickerLockTime.IsEnabled = true;
|
this.datePickerLockTime.IsEnabled = true;
|
||||||
break;
|
break;
|
||||||
case Extensions.ParticipantType.TUG:
|
case Extensions.ParticipantType.TUG:
|
||||||
case Extensions.ParticipantType.PILOT:
|
case Extensions.ParticipantType.PILOT:
|
||||||
this.datePickerZoneEntry.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
|
this.datePickerZoneEntry.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetLockButton(bool newValue)
|
private void SetLockButton(bool newValue)
|
||||||
@ -285,7 +303,7 @@ namespace BreCalClient
|
|||||||
this.imageFixedOrder.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/lock_open.png", UriKind.RelativeOrAbsolute));
|
this.imageFixedOrder.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resources/lock_open.png", UriKind.RelativeOrAbsolute));
|
||||||
this.buttonFixedOrder.ToolTip = BreCalClient.Resources.Resources.textTooltipSetFixedOrder;
|
this.buttonFixedOrder.ToolTip = BreCalClient.Resources.Resources.textTooltipSetFixedOrder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -309,17 +327,17 @@ namespace BreCalClient
|
|||||||
private void contextMenuItemClearZoneEntry_Click(object sender, RoutedEventArgs e)
|
private void contextMenuItemClearZoneEntry_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.datePickerZoneEntry.Value = null;
|
this.datePickerZoneEntry.Value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void contextMenuItemClearATA_Click(object sender, RoutedEventArgs e)
|
private void contextMenuItemClearATA_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.datePickerATA.Value = null;
|
this.datePickerATA.Value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void contextMenuItemClearATD_Click(object sender, RoutedEventArgs e)
|
private void contextMenuItemClearATD_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.datePickerATD.Value = null;
|
this.datePickerATD.Value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void contextMenuItemClearETA_End_Click(object sender, RoutedEventArgs e)
|
private void contextMenuItemClearETA_End_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@ -332,6 +350,6 @@ namespace BreCalClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user