Enter Agency Time as highlighted suggestion for other participants (not terminal)

This commit is contained in:
Daniel Schick 2024-06-25 08:22:25 +02:00
parent 9a6c51c0b3
commit d768288f4e
2 changed files with 23 additions and 3 deletions

View File

@ -7,6 +7,7 @@ using BreCalClient.misc.Model;
using System;
using System.Windows;
using System.Windows.Media.Imaging;
using Xceed.Wpf.Toolkit;
namespace BreCalClient
{
@ -27,7 +28,9 @@ namespace BreCalClient
#region Properties
public Times Times { get; set; } = new();
public Times Times { get; set; } = new();
public Times? AgencyTimes { get; set; } = new();
public ShipcallControlModel ShipcallModel { get; set; } = new();
@ -36,9 +39,9 @@ namespace BreCalClient
#region event handler
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.CopyToControls();
{
this.EnableControls();
this.CopyToControls();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
@ -93,7 +96,20 @@ namespace BreCalClient
{
this.textBoxRemarks.Text = this.Times.Remarks;
this.datePickerETABerth.Value = this.Times.EtaBerth;
if(this.datePickerETABerth.IsEnabled && (this.Times.EtaBerth == null) && (this.AgencyTimes?.EtaBerth != null) && (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival))
{
this.datePickerETABerth.Value = this.AgencyTimes.EtaBerth;
WatermarkTextBox? tb = this.datePickerETABerth.Template.FindName("PART_TextBox", this.datePickerETABerth) as WatermarkTextBox;
if (tb != null) { tb.Focus(); tb.SelectAll(); }
}
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)))
{
this.datePickerETDBerth.Value = this.AgencyTimes.EtdBerth;
WatermarkTextBox? tb = this.datePickerETDBerth.Template.FindName("PART_TextBox", this.datePickerETDBerth) as WatermarkTextBox;
if (tb != null) tb.SelectAll();
}
this.datePickerLockTime.Value = this.Times.LockTime;
this.datePickerZoneEntry.Value = this.Times.ZoneEntry;
this.datePickerATA.Value = this.Times.Ata;

View File

@ -854,10 +854,14 @@ namespace BreCalClient
if( obj.ShipcallControlModel == null) { return; }
if (!obj.ShipcallControlModel.AssignedParticipants.ContainsKey(participantType)) return; // no assigment means no dialog my friend
Times? agencyTimes = obj.ShipcallControlModel.GetTimesForParticipantType(ParticipantType.AGENCY);
// show a dialog that lets the user create / update times for the given shipcall
IEditTimesControl etc = (participantType == ParticipantType.TERMINAL) ? new EditTimesTerminalControl() : new EditTimesControl();
etc.Title = obj.ShipcallControlModel.Title;
etc.ShipcallModel = obj.ShipcallControlModel;
if (etc is EditTimesControl control)
control.AgencyTimes = agencyTimes;
bool wasEdit = false;
if (times != null)