added SERV templates to the sheet display
This commit is contained in:
parent
ef96795bbf
commit
d1e2e67d5f
@ -381,7 +381,7 @@ namespace ENI2.DetailViewControls
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Spezialbalkon für die Gruppenauswahl im Core (Maersk BHV / Seago usw.)
|
#region SERV template event handler
|
||||||
|
|
||||||
private void comboBoxGroup_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void comboBoxGroup_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
@ -472,6 +472,10 @@ namespace ENI2.DetailViewControls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region other event handler
|
||||||
|
|
||||||
private void buttonSearchPortArea_Click(object sender, RoutedEventArgs e)
|
private void buttonSearchPortArea_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (portAreas != null)
|
if (portAreas != null)
|
||||||
|
|||||||
@ -178,8 +178,40 @@
|
|||||||
<TextBox Grid.Row="12" Grid.Column="1" Name="textBox_AgentFirstName" MaxLength="99" Margin="2" Text="{Binding AgentFirstName, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
|
<TextBox Grid.Row="12" Grid.Column="1" Name="textBox_AgentFirstName" MaxLength="99" Margin="2" Text="{Binding AgentFirstName, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
|
||||||
|
|
||||||
<TextBlock FontSize="18" VerticalAlignment="Bottom" Text="{x:Static p:Resources.text24Invoice}" Grid.Column="0" Grid.Row="13" Grid.ColumnSpan="3"/>
|
<TextBlock FontSize="18" VerticalAlignment="Bottom" Text="{x:Static p:Resources.text24Invoice}" Grid.Column="0" Grid.Row="13" Grid.ColumnSpan="3"/>
|
||||||
<Label HorizontalContentAlignment="Right" Grid.Row="14" Grid.Column="0" Content="{x:Static p:Resources.textMaerskSeago}" Name="label_MaerskSeaGo" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
<Label HorizontalContentAlignment="Right" Grid.Row="14" Grid.Column="0" Content="{x:Static p:Resources.textSERVTemplate}" Name="label_MaerskSeaGo" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
||||||
<ComboBox Grid.Row="14" Grid.Column="1" x:Name="comboBoxGroup" Margin="2" ItemsSource="{StaticResource arrList}" DisplayMemberPath="Key" SelectedValuePath="Value" SelectionChanged="comboBoxGroup_SelectionChanged" ContextMenu="{DynamicResource ClearContextMenu}" />
|
<ComboBox Grid.Row="14" Grid.Column="1" x:Name="comboBoxGroup" DisplayMemberPath="ServiceName" Margin="2" SelectionChanged="comboBoxGroup_SelectionChanged" ContextMenu="{DynamicResource ClearContextMenu}" />
|
||||||
|
<Grid Grid.Row="14" Grid.Column="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="26" />
|
||||||
|
<ColumnDefinition Width="26" />
|
||||||
|
<ColumnDefinition Width="26" />
|
||||||
|
<ColumnDefinition Width="26" />
|
||||||
|
<ColumnDefinition Width="26" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Button Name="buttonSetSERVTemplate" Margin="2" Click="buttonSetSERVTemplate_Click" BorderThickness="0" Background="Transparent" Grid.Column="0"
|
||||||
|
ToolTip="Apply template" HorizontalContentAlignment="Right" IsEnabled="False">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="../Resources/check.png" Margin="0,0,0,0" Height="20" Width="20" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Name="buttonEditSERVTemplate" Grid.Column="2" Grid.Row="0" Margin="2" Click="buttonEditSERVTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Edit template">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="../Resources/pencil.png" Margin="0,0,0,0" Height="20" Width="20" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Name="buttonNewSERVTemplate" Grid.Column="3" Grid.Row="0" Margin="2" Click="buttonNewSERVTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="New template">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="../Resources/document_plain_new.png" Margin="0,0,0,0" Height="20" Width="20" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Name="buttonDeleteSERVTemplate" Grid.Column="4" Grid.Row="0" Margin="2" Click="buttonDeleteSERVTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Delete template" IsEnabled="False">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="../Resources/delete.png" Margin="0,0,0,0" Height="20" Width="20" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
<GroupBox Name="servGroupBox" Header="{x:Static p:Resources.textServ}" Grid.Row="15" Grid.Column="0" Grid.ColumnSpan="3">
|
<GroupBox Name="servGroupBox" Header="{x:Static p:Resources.textServ}" Grid.Row="15" Grid.Column="0" Grid.ColumnSpan="3">
|
||||||
<enictrl:ENIDataGrid x:Name="dataGridSERV" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
<enictrl:ENIDataGrid x:Name="dataGridSERV" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||||
AutoGenerateColumns="False" Margin="0,5,0,0">
|
AutoGenerateColumns="False" Margin="0,5,0,0">
|
||||||
|
|||||||
@ -34,7 +34,7 @@ namespace ENI2.SheetDisplayControls
|
|||||||
private SEC _sec;
|
private SEC _sec;
|
||||||
private WAS _was;
|
private WAS _was;
|
||||||
private Message _stoMessage;
|
private Message _stoMessage;
|
||||||
private Message _crewMessage;
|
// private Message _crewMessage;
|
||||||
|
|
||||||
private Dictionary<string, string> portAreas = null;
|
private Dictionary<string, string> portAreas = null;
|
||||||
|
|
||||||
@ -42,6 +42,9 @@ namespace ENI2.SheetDisplayControls
|
|||||||
private AGNT_Template _currentTemplate;
|
private AGNT_Template _currentTemplate;
|
||||||
private AGNT_Template _undoTemplate;
|
private AGNT_Template _undoTemplate;
|
||||||
|
|
||||||
|
private static List<SERV_Template> _servTemplates = null;
|
||||||
|
private SERV_Template _currentSERVTemplate;
|
||||||
|
|
||||||
private static List<WasteDisposalServiceProvider_Template> _wsdpTemplates = null;
|
private static List<WasteDisposalServiceProvider_Template> _wsdpTemplates = null;
|
||||||
private WasteDisposalServiceProvider_Template _currentWSDPTemplate;
|
private WasteDisposalServiceProvider_Template _currentWSDPTemplate;
|
||||||
private string _undoWSDPTemplate;
|
private string _undoWSDPTemplate;
|
||||||
@ -90,7 +93,7 @@ namespace ENI2.SheetDisplayControls
|
|||||||
if (aMessage.MessageNotificationClass == Message.NotificationClass.AGNT) { this._agnt = aMessage.Elements[0] as AGNT; this.ControlMessages.Add(aMessage); }
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.AGNT) { this._agnt = aMessage.Elements[0] as AGNT; this.ControlMessages.Add(aMessage); }
|
||||||
if (aMessage.MessageNotificationClass == Message.NotificationClass.WAS) { this._was = aMessage.Elements[0] as WAS; this.ControlMessages.Add(aMessage); }
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.WAS) { this._was = aMessage.Elements[0] as WAS; this.ControlMessages.Add(aMessage); }
|
||||||
if (aMessage.MessageNotificationClass == Message.NotificationClass.STO) { this._stoMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
if (aMessage.MessageNotificationClass == Message.NotificationClass.STO) { this._stoMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
||||||
if (aMessage.MessageNotificationClass == Message.NotificationClass.CREWA) { this._crewMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
// if (aMessage.MessageNotificationClass == Message.NotificationClass.CREWA) { this._crewMessage = aMessage; this.ControlMessages.Add(aMessage); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2.1
|
// 2.1
|
||||||
@ -202,6 +205,23 @@ namespace ENI2.SheetDisplayControls
|
|||||||
// this.dataGridEffects.Initialize();
|
// this.dataGridEffects.Initialize();
|
||||||
// this.dataGridEffects.ItemsSource = _crewMessage.Elements;
|
// this.dataGridEffects.ItemsSource = _crewMessage.Elements;
|
||||||
|
|
||||||
|
#region init SERV templates
|
||||||
|
|
||||||
|
if (_servTemplates == null)
|
||||||
|
{
|
||||||
|
_servTemplates = await DBManagerAsync.GetSERVTemplatesAsync(); // initial load
|
||||||
|
_servTemplates.Sort();
|
||||||
|
Trace.WriteLine($"{_servTemplates.Count} SERV templates loaded");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.comboBoxGroup.ItemsSource = _servTemplates;
|
||||||
|
|
||||||
|
this.buttonDeleteSERVTemplate.Visibility = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
this.buttonEditSERVTemplate.Visibility = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
this.buttonNewSERVTemplate.Visibility = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int SelectedTabIndex
|
public override int SelectedTabIndex
|
||||||
@ -578,37 +598,6 @@ namespace ENI2.SheetDisplayControls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void comboBoxGroup_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
||||||
{
|
|
||||||
// clear all
|
|
||||||
this.Core.SetFlag(false, MessageCore.CoreFlags.MAERSK_BHV);
|
|
||||||
this.Core.SetFlag(false, MessageCore.CoreFlags.SEAGO_BHV);
|
|
||||||
this.Core.SetFlag(false, MessageCore.CoreFlags.SEAGO_WHV);
|
|
||||||
this.Core.SetFlag(false, MessageCore.CoreFlags.HOEGH);
|
|
||||||
this.Core.SetFlag(false, MessageCore.CoreFlags.ELBE_BULK);
|
|
||||||
this.Core.SetFlag(false, MessageCore.CoreFlags.FCT_JUNGE);
|
|
||||||
|
|
||||||
if (this.comboBoxGroup.SelectedItem == null)
|
|
||||||
{
|
|
||||||
this.comboBoxGroup.SelectedIndex = 0;
|
|
||||||
DBManager.Instance.Save(this.Core);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DictionaryEntry selectedItem = (DictionaryEntry)this.comboBoxGroup.SelectedItem;
|
|
||||||
if (Int32.TryParse((string)selectedItem.Value, out int selectedValue))
|
|
||||||
{
|
|
||||||
if (selectedValue == (int)MessageCore.CoreFlags.MAERSK_BHV) CheckServiceEntryMaerskBHV();
|
|
||||||
if (selectedValue == (int)MessageCore.CoreFlags.SEAGO_BHV) CheckServiceEntrySeaGoBHV();
|
|
||||||
if (selectedValue == (int)MessageCore.CoreFlags.HOEGH) CheckServiceEntryHoegh();
|
|
||||||
if (selectedValue == (int)MessageCore.CoreFlags.ELBE_BULK) CheckServiceEntryElbeBulk();
|
|
||||||
if (selectedValue == (int)MessageCore.CoreFlags.FCT_JUNGE) CheckServiceEntryFctJunge();
|
|
||||||
this.Core.SetFlag(true, (MessageCore.CoreFlags)selectedValue);
|
|
||||||
DBManager.Instance.Save(this.Core);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region special entry ship service check
|
#region special entry ship service check
|
||||||
@ -1149,5 +1138,98 @@ namespace ENI2.SheetDisplayControls
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region SERV template button event handler
|
||||||
|
|
||||||
|
private void comboBoxGroup_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (this.comboBoxGroup.SelectedItem is SERV_Template st)
|
||||||
|
{
|
||||||
|
this.buttonDeleteSERVTemplate.IsEnabled = true;
|
||||||
|
this.buttonSetSERVTemplate.IsEnabled = true;
|
||||||
|
this._currentSERVTemplate = st;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSetSERVTemplate_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (this.comboBoxGroup.SelectedItem is SERV_Template st)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
foreach (SERV serv in _servMessage.Elements.Cast<SERV>())
|
||||||
|
{
|
||||||
|
if (serv.ServiceName.Equals(st.ServiceName))
|
||||||
|
{
|
||||||
|
found = true; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
SERV newServ = new SERV();
|
||||||
|
newServ.ServiceName = st.ServiceName;
|
||||||
|
newServ.ServiceBeneficiary = st.ServiceBeneficiary;
|
||||||
|
newServ.ServiceInvoiceRecipient = st.ServiceInvoiceRecipient;
|
||||||
|
|
||||||
|
newServ.MessageHeader = this._servMessage;
|
||||||
|
newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
|
||||||
|
this._servMessage.Elements.Add(newServ);
|
||||||
|
this.dataGridSERV.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.SERV);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonEditSERVTemplate_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (this.comboBoxGroup.SelectedItem is SERV_Template st)
|
||||||
|
{
|
||||||
|
EditSERVDialog editSERVDialog = new EditSERVDialog();
|
||||||
|
editSERVDialog.AddVisible = false;
|
||||||
|
editSERVDialog.SERV_Template = st;
|
||||||
|
if (editSERVDialog.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
_ = DBManagerAsync.SaveAsync(st);
|
||||||
|
this.comboBoxGroup.ItemsSource = null;
|
||||||
|
_servTemplates.Sort();
|
||||||
|
this.comboBoxGroup.ItemsSource = _servTemplates;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonNewSERVTemplate_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SERV_Template newTemplate = new SERV_Template();
|
||||||
|
EditSERVDialog esd = new EditSERVDialog();
|
||||||
|
esd.AddVisible = false;
|
||||||
|
esd.SERV_Template = newTemplate;
|
||||||
|
if (esd.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
_ = DBManagerAsync.SaveAsync(esd.SERV_Template);
|
||||||
|
this.comboBoxGroup.ItemsSource = null;
|
||||||
|
_servTemplates.Add(newTemplate);
|
||||||
|
_servTemplates.Sort();
|
||||||
|
this.comboBoxGroup.ItemsSource = _servTemplates;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDeleteSERVTemplate_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_currentSERVTemplate != null)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Delete this template?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
this.comboBoxGroup.SelectedItem = null;
|
||||||
|
this.comboBoxGroup.ItemsSource = null;
|
||||||
|
_ = DBManagerAsync.DeleteAsync(_currentTemplate);
|
||||||
|
_servTemplates.Remove(_currentSERVTemplate);
|
||||||
|
this.buttonDeleteSERVTemplate.IsEnabled = false;
|
||||||
|
this.comboBoxGroup.ItemsSource = _servTemplates;
|
||||||
|
this.buttonSetSERVTemplate.IsEnabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user