Add a button to copy masters name from first CREWA entry

This commit is contained in:
Daniel Schick 2025-07-07 15:52:59 +02:00
parent a4a74da6f9
commit 626b058119
10 changed files with 155 additions and 5 deletions

View File

@ -506,7 +506,7 @@ namespace ENI2
this.DetailControl_RequestReload(this.Core.Id.Value);
System.Action<int> SetTabAction = (int x) =>
System.Action<int> SetTabAction = x =>
{
// this hopefully happens *after* the view was completely reloaded
if (this.detailView.Children[0] is DetailBaseControl currentNewControl)
@ -590,7 +590,7 @@ namespace ENI2
this.DetailControl_RequestReload(this.Core.Id.Value);
System.Action<int> SetTabAction = (int x) =>
Action<int> SetTabAction = x =>
{
// this hopefully happens *after* the view was completely reloaded
if (this.detailView.Children[0] is DetailBaseControl currentNewControl)

View File

@ -36,10 +36,12 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="5*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textNameMaster}" Name="label_nameMaster" Margin="0,0,10,0"/>
<TextBox Grid.Row="0" Grid.Column="1" Name="textBox_NameMaster" MaxLength="100" Margin="2" Text="{Binding NameOfMaster, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center" VerticalAlignment="Center"/>
<Button x:Name="buttonCopyNameFromCREWA" Grid.Row="0" Grid.Column="2" Margin="2" Content="{x:Static p:Resources.textCopyFromCREWA}" Click="buttonCopyNameFromCREWA_Click"/>
</Grid>
</GroupBox>
<GroupBox Name="infoGroupBox" Header="{x:Static p:Resources.textInfo}" Grid.Row="1" Margin="0,5,0,5">

View File

@ -29,6 +29,7 @@ namespace ENI2.DetailViewControls
private Message _infoMessage;
private Message _servMessage;
private Message _ladgMessage;
private Message _crewaMessage;
private Dictionary<string, string> portAreas = null;
private static readonly string[] shippingAreas = {
@ -69,6 +70,7 @@ namespace ENI2.DetailViewControls
if (aMessage.MessageNotificationClass == Message.NotificationClass.INFO) { this._infoMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.SERV) { this._servMessage = aMessage; this.ControlMessages.Add(aMessage); }
if (aMessage.MessageNotificationClass == Message.NotificationClass.LADG) { this._ladgMessage = aMessage; this.ControlMessages.Add(aMessage); }
if(aMessage.MessageNotificationClass == Message.NotificationClass.CREWA) { this._crewaMessage = aMessage;}
}
#region init NAME
@ -547,5 +549,24 @@ namespace ENI2.DetailViewControls
{
}
private void buttonCopyNameFromCREWA_Click(object sender, RoutedEventArgs e)
{
CREW crewA = null;
if (this._crewaMessage.Elements.Count > 0)
{
crewA = this._crewaMessage.Elements[0] as CREW;
}
SelectCrewMemberDialog scmd = new SelectCrewMemberDialog();
scmd.CREW = crewA;
scmd.AddVisible = false;
if (scmd.ShowDialog() ?? false)
{
this.textBox_NameMaster.Text = $"{crewA.CrewMemberFirstName} {crewA.CrewMemberLastName}";
this.SublistElementChanged(Message.NotificationClass.NAME);
}
}
}
}

View File

@ -327,6 +327,9 @@
<Compile Include="EditControls\NewDGItemDialog.xaml.cs">
<DependentUpon>NewDGItemDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\SelectCrewMemberDialog.xaml.cs">
<DependentUpon>SelectCrewMemberDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\SelectPortAreaDialog.xaml.cs">
<DependentUpon>SelectPortAreaDialog.xaml</DependentUpon>
</Compile>
@ -812,6 +815,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\SelectCrewMemberDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\SelectImportClassesDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@ -0,0 +1,32 @@
<enictrl:EditWindowBase x:Class="ENI2.EditControls.SelectCrewMemberDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ENI2.EditControls"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
Title="{x:Static p:Resources.textSelectCrewMember}" Height="160" Width="400" Background="AliceBlue">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textLastName}" />
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textFirstName}" />
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textCrewFunctionOnBoard}" />
<TextBlock Text="{Binding CrewMemberLastName}" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" />
<TextBlock Text="{Binding CrewMemberFirstName}" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" />
<TextBlock Text="{Binding CrewMemberDuty}" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" />
</Grid>
</enictrl:EditWindowBase>

View File

@ -0,0 +1,41 @@
// Copyright (c) 2017- schick Informatik
// Description:
//
using bsmd.database;
using ENI2.Controls;
using System.Windows;
namespace ENI2.EditControls
{
/// <summary>
/// Interaction logic for SelectCrewMemberDialog.xaml
/// </summary>
public partial class SelectCrewMemberDialog : EditWindowBase
{
public SelectCrewMemberDialog()
{
InitializeComponent();
Loaded += SelectCrewMemberDialog_Loaded;
}
#region Properties
public CREW CREW { get; set; }
#endregion
#region event handler
private void SelectCrewMemberDialog_Loaded(object sender, RoutedEventArgs e)
{
if (CREW != null)
{
this.DataContext = CREW;
}
}
#endregion
}
}

View File

@ -2253,6 +2253,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Copy from CREWA.
/// </summary>
public static string textCopyFromCREWA {
get {
return ResourceManager.GetString("textCopyFromCREWA", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copy from last 10 port facilities called.
/// </summary>
@ -5259,6 +5268,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Select crew member.
/// </summary>
public static string textSelectCrewMember {
get {
return ResourceManager.GetString("textSelectCrewMember", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Select classes to import.
/// </summary>

View File

@ -2233,6 +2233,12 @@
<data name="textSECSimplification" xml:space="preserve">
<value>SEC simplification available</value>
</data>
<data name="textCopyFromCREWA" xml:space="preserve">
<value>Copy from CREWA</value>
</data>
<data name="textSelectCrewMember" xml:space="preserve">
<value>Select crew member</value>
</data>
<data name="textSERVTemplate" xml:space="preserve">
<value>SERV-Template</value>
</data>

View File

@ -30,6 +30,7 @@
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textNameMaster}" Name="label_nameMaster" Margin="0,0,10,0"/>
<TextBox Grid.Row="0" Grid.Column="1" Name="textBox_NameMaster" MaxLength="100" Margin="2" Text="{Binding NameOfMaster, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center" />
<Button Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textCopyFromCREWA}" Margin="2" Width="120" HorizontalAlignment="Left" x:Name="buttonCopyFromCrewA" Click="buttonCopyFromCrewA_Click" />
<Label Name="labelCrewNotificationSchengen" Content="{x:Static p:Resources.textNotificationSchengen}" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right"/>
<CheckBox Name="checkBoxCrewNotificationSchengen" Grid.Row="1" Grid.Column="1" IsThreeState="False" VerticalAlignment="Center" Margin="10,0,0,0" Click="checkBoxCrewNotificationSchengen_Click"/>
<Label Name="labelCrewNotificationPAX" Content="{x:Static p:Resources.textNotificationPAX}" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right" />

View File

@ -233,6 +233,26 @@ namespace ENI2.SheetDisplayControls
}
}
private void buttonCopyFromCrewA_Click(object sender, RoutedEventArgs e)
{
CREW crewA = null;
if (this._crewaMessage.Elements.Count > 0)
{
crewA = this._crewaMessage.Elements[0] as CREW;
}
SelectCrewMemberDialog scmd = new SelectCrewMemberDialog();
scmd.CREW = crewA;
scmd.AddVisible = false;
if (scmd.ShowDialog() ?? false)
{
this.textBox_NameMaster.Text = $"{crewA.CrewMemberFirstName} {crewA.CrewMemberLastName}";
this.SublistElementChanged(Message.NotificationClass.NAME);
}
}
#endregion
#region crew grid arrival
@ -378,8 +398,10 @@ namespace ENI2.SheetDisplayControls
}
}
#endregion
}
}