Fixes for tests regarding the evaluation functions
This commit is contained in:
parent
1f29aca6d0
commit
9c690a91b0
@ -92,11 +92,9 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
|
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
|
||||||
}
|
}
|
||||||
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
|
|
||||||
if((this.comboBoxArrivalBerth.SelectedValue != null) && ((int?)this.comboBoxArrivalBerth.SelectedValue != this.ShipcallModel.Shipcall.ArrivalBerthId))
|
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
|
||||||
{
|
this.Times.BerthId = (int?)this.comboBoxArrivalBerth.SelectedValue;
|
||||||
this.Times.BerthId = (int?)this.comboBoxArrivalBerth.SelectedValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
|
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
|
||||||
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
|
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
|
||||||
|
|||||||
@ -89,10 +89,9 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
|
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
|
||||||
}
|
}
|
||||||
if ((this.comboBoxDepartureBerth.SelectedValue != null) && ((int?)this.comboBoxDepartureBerth.SelectedValue != this.ShipcallModel.Shipcall.DepartureBerthId))
|
|
||||||
{
|
this.Times.BerthId = (int?)this.comboBoxDepartureBerth.SelectedValue;
|
||||||
this.Times.BerthId = (int?)this.comboBoxDepartureBerth.SelectedValue;
|
|
||||||
}
|
|
||||||
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
|
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
|
||||||
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
|
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
|
||||||
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
|
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
|
||||||
|
|||||||
@ -92,11 +92,9 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPiersideArrival.SelectedIndex == 0) ? true : false;
|
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPiersideArrival.SelectedIndex == 0) ? true : false;
|
||||||
}
|
}
|
||||||
this.Times.BerthInfo = this.textBoxBerthRemarksArrival.Text.Trim();
|
|
||||||
if ((this.comboBoxArrivalBerth.SelectedValue != null) && ((int?)this.comboBoxArrivalBerth.SelectedValue != this.ShipcallModel.Shipcall.ArrivalBerthId))
|
this.Times.BerthInfo = this.textBoxBerthRemarksArrival.Text.Trim();
|
||||||
{
|
this.Times.BerthId = (int?)this.comboBoxArrivalBerth.SelectedValue;
|
||||||
this.Times.BerthId = (int?)this.comboBoxArrivalBerth.SelectedValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
|
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
|
||||||
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
|
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
|
||||||
|
|||||||
@ -507,10 +507,12 @@ namespace BreCalClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region UpdateUI func
|
||||||
|
|
||||||
private void UpdateUI()
|
private void UpdateUI()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -542,6 +544,8 @@ namespace BreCalClient
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region control event handler
|
#region control event handler
|
||||||
|
|
||||||
private async void Sc_EditRequested(ShipcallControl obj)
|
private async void Sc_EditRequested(ShipcallControl obj)
|
||||||
@ -558,6 +562,7 @@ namespace BreCalClient
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
obj.ShipcallControlModel.Shipcall?.Participants.Clear();
|
obj.ShipcallControlModel.Shipcall?.Participants.Clear();
|
||||||
|
obj.ShipcallControlModel.UpdateTimesAssignments(this._api);
|
||||||
foreach(ParticipantAssignment pa in obj.ShipcallControlModel.AssignedParticipants.Values)
|
foreach(ParticipantAssignment pa in obj.ShipcallControlModel.AssignedParticipants.Values)
|
||||||
obj.ShipcallControlModel.Shipcall?.Participants.Add(pa);
|
obj.ShipcallControlModel.Shipcall?.Participants.Add(pa);
|
||||||
await _api.ShipcallsPutAsync(obj.ShipcallControlModel.Shipcall);
|
await _api.ShipcallsPutAsync(obj.ShipcallControlModel.Shipcall);
|
||||||
@ -584,6 +589,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
if(obj.ShipcallControlModel.Shipcall != null)
|
if(obj.ShipcallControlModel.Shipcall != null)
|
||||||
etc.CallType = (TypeEnum) obj.ShipcallControlModel.Shipcall.Type;
|
etc.CallType = (TypeEnum) obj.ShipcallControlModel.Shipcall.Type;
|
||||||
|
|
||||||
bool wasEdit = false;
|
bool wasEdit = false;
|
||||||
if (times != null)
|
if (times != null)
|
||||||
{
|
{
|
||||||
@ -654,12 +660,19 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
editControl.Times = times;
|
editControl.Times = times;
|
||||||
wasEdit = true;
|
wasEdit = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(editControl.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||||
|
editControl.Times.ParticipantId = editControl.ShipcallModel.AssignedParticipants[ParticipantType.AGENCY].ParticipantId;
|
||||||
}
|
}
|
||||||
editControl.Times.ParticipantType = (int)ParticipantType.AGENCY;
|
editControl.Times.ParticipantType = (int)ParticipantType.AGENCY;
|
||||||
if(editControl.ShowDialog() ?? false)
|
if(editControl.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
sc.ShipcallControlModel?.UpdateTimesAssignments(_api); // if the agent changed the assignment of the participant to another
|
||||||
|
|
||||||
// always try to be the agent, even if we are BSMD
|
// always try to be the agent, even if we are BSMD
|
||||||
if (editControl.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
if (editControl.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -48,24 +48,7 @@
|
|||||||
<Label Grid.Column="1" FontSize="12" x:Name="labelShipName" Foreground="White" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" VerticalAlignment="Stretch"
|
<Label Grid.Column="1" FontSize="12" x:Name="labelShipName" Foreground="White" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}" VerticalAlignment="Stretch"
|
||||||
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewMouseUp="Image_PreviewMouseUp"/>
|
HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" PreviewMouseUp="Image_PreviewMouseUp"/>
|
||||||
<Grid Grid.Column="2" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}">
|
<Grid Grid.Column="2" Background="{Binding Source={x:Static sets:Settings.Default}, Path=BG_COLOR}">
|
||||||
<Image Grid.Column="3" Margin="2" x:Name="imageEvaluation">
|
<Image Grid.Column="3" Margin="2" x:Name="imageEvaluation" />
|
||||||
<Image.Style>
|
|
||||||
<Style TargetType="Image">
|
|
||||||
<Setter Property="Source" Value="{Binding NotFolderImage}"/>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding LightMode}" Value="{x:Static db:ShipcallControlModel+TrafficLightMode.GREEN}">
|
|
||||||
<Setter Property="Source" Value="./Resources/check.png"/>
|
|
||||||
</DataTrigger>
|
|
||||||
<DataTrigger Binding="{Binding LightMode}" Value="{x:Static db:ShipcallControlModel+TrafficLightMode.RED}">
|
|
||||||
<Setter Property="Source" Value="./Resources/delete2.png"/>
|
|
||||||
</DataTrigger>
|
|
||||||
<DataTrigger Binding="{Binding LightMode}" Value="{x:Static db:ShipcallControlModel+TrafficLightMode.YELLOW}">
|
|
||||||
<Setter Property="Source" Value="./Resources/sign_warning.png"/>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Image.Style>
|
|
||||||
</Image>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Viewbox Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left">
|
<Viewbox Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left">
|
||||||
|
|||||||
@ -151,6 +151,21 @@ namespace BreCalClient
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch(this.ShipcallControlModel?.LightMode)
|
||||||
|
{
|
||||||
|
case ShipcallControlModel.TrafficLightMode.GREEN:
|
||||||
|
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/check.png"));
|
||||||
|
break;
|
||||||
|
case ShipcallControlModel.TrafficLightMode.YELLOW:
|
||||||
|
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/sign_warning.png"));
|
||||||
|
break;
|
||||||
|
case ShipcallControlModel.TrafficLightMode.RED:
|
||||||
|
this.imageEvaluation.Source = new BitmapImage(new Uri("pack://application:,,,/BreCalTestClient;component/Resources/delete2.png"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.ShipcallControlModel?.Shipcall?.Evaluation != null)
|
if (this.ShipcallControlModel?.Shipcall?.Evaluation != null)
|
||||||
{
|
{
|
||||||
ShipcallControlModel.TrafficLightMode resultColor = (ShipcallControlModel.TrafficLightMode) (this.ShipcallControlModel?.Shipcall?.Evaluation ?? 0); // der nullable Operator hier ist so doof, die VS validation blickts einfach nicht
|
ShipcallControlModel.TrafficLightMode resultColor = (ShipcallControlModel.TrafficLightMode) (this.ShipcallControlModel?.Shipcall?.Evaluation ?? 0); // der nullable Operator hier ist so doof, die VS validation blickts einfach nicht
|
||||||
@ -280,6 +295,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
if (times.ParticipantType == (int)Extensions.ParticipantType.TERMINAL)
|
if (times.ParticipantType == (int)Extensions.ParticipantType.TERMINAL)
|
||||||
{
|
{
|
||||||
|
this.labelTerminalBerth.Content = berthText;
|
||||||
this.labelOperationsStart.Content = times.OperationsStart.HasValue ? times.OperationsStart.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
this.labelOperationsStart.Content = times.OperationsStart.HasValue ? times.OperationsStart.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
|
||||||
this.textBlockTerminalRemarks.Text = times.Remarks;
|
this.textBlockTerminalRemarks.Text = times.Remarks;
|
||||||
if (this.ShipcallControlModel?.Shipcall?.Type != 1)
|
if (this.ShipcallControlModel?.Shipcall?.Type != 1)
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
// Description: Container model for shipcall related info
|
// Description: Container model for shipcall related info
|
||||||
//
|
//
|
||||||
|
|
||||||
|
using BreCalClient.misc.Api;
|
||||||
using BreCalClient.misc.Model;
|
using BreCalClient.misc.Model;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -124,6 +125,25 @@ namespace BreCalClient
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// After closing the edit shipcall or edit agency dialogs, the times assignments may have changed.
|
||||||
|
/// This function updates the assignments for existing times records accordingly and saves them.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="_api">API reference to PUT eidted times</param>
|
||||||
|
internal async void UpdateTimesAssignments(DefaultApi _api)
|
||||||
|
{
|
||||||
|
foreach (Extensions.ParticipantType participantType in this.AssignedParticipants.Keys)
|
||||||
|
{
|
||||||
|
Times? times = this.GetTimesForParticipantType(participantType);
|
||||||
|
if(times == null) continue;
|
||||||
|
if(times.ParticipantId != this.AssignedParticipants[participantType].ParticipantId)
|
||||||
|
{
|
||||||
|
times.ParticipantId = this.AssignedParticipants[participantType].ParticipantId;
|
||||||
|
await _api.TimesPutAsync(times);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region helper
|
#region helper
|
||||||
|
|||||||
Reference in New Issue
Block a user