neue ENI2 Version, mit Locode Control und Grid RootControls etc pp

This commit is contained in:
Daniel Schick 2017-04-26 16:31:37 +00:00
parent bfaba32698
commit 2490a78dca
23 changed files with 593 additions and 27 deletions

View File

@ -0,0 +1,122 @@
// Copyright (c) 2017 schick Informatik
// Description: DataGrid mit etwas "verbesserten" Funktionen
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using bsmd.database;
namespace ENI2.Controls
{
/// <summary>
/// Follow steps 1a or 1b and then 2 to use this custom control in a XAML file.
///
/// Step 1a) Using this custom control in a XAML file that exists in the current project.
/// Add this XmlNamespace attribute to the root element of the markup file where it is
/// to be used:
///
/// xmlns:enictrl="clr-namespace:ENI2.Controls"
///
///
/// Step 1b) Using this custom control in a XAML file that exists in a different project.
/// Add this XmlNamespace attribute to the root element of the markup file where it is
/// to be used:
///
/// xmlns:enictrl="clr-namespace:ENI2.Controls;assembly=ENI2.Controls"
///
/// You will also need to add a project reference from the project where the XAML file lives
/// to this project and Rebuild to avoid compilation errors:
///
/// Right click on the target project in the Solution Explorer and
/// "Add Reference"->"Projects"->[Browse to and select this project]
///
///
/// Step 2)
/// Go ahead and use your control in the XAML file.
///
/// <MyNamespace:ENIDataGrid/>
///
/// </summary>
public class ENIDataGrid : DataGrid
{
/*
static ENIDataGrid()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ENIDataGrid), new FrameworkPropertyMetadata(typeof(ENIDataGrid)));
}
*/
public event Action<DatabaseEntity> EditRequested;
public event Action<DatabaseEntity> DeleteRequested;
public event Action CreateRequested;
public void Initialize()
{
this.ContextMenu = new ContextMenu();
MenuItem addItem = new MenuItem();
addItem.Header = "_Add";
addItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/add.png")) };
addItem.Click += new RoutedEventHandler(this.addItem);
this.ContextMenu.Items.Add(addItem);
MenuItem deleteItem = new MenuItem();
deleteItem.Header = "_Delete";
deleteItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/delete.png")) };
deleteItem.Click += this.deleteItem;
this.ContextMenu.Items.Add(deleteItem);
MenuItem editItem = new MenuItem();
editItem.Header = "_Edit";
editItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/edit.png")) };
editItem.Click += this.editItem;
this.ContextMenu.Items.Add(editItem);
}
protected void addItem(object sender, RoutedEventArgs e)
{
this.CreateRequested?.Invoke();
}
protected void deleteItem(object sender, RoutedEventArgs e)
{
if((this.SelectedItems != null) && (this.SelectedItems.Count > 0))
{
// TODO: ask confirmation message box
foreach(object deleteItem in this.SelectedItems)
{
if (deleteItem is DatabaseEntity) {
this.DeleteRequested?.Invoke(deleteItem as DatabaseEntity);
}
}
}
}
protected void editItem(object sender, RoutedEventArgs e)
{
if((this.SelectedItems != null) && (this.SelectedItems.Count == 1))
{
DatabaseEntity selectedEntity = this.SelectedItems[0] as DatabaseEntity;
if (selectedEntity != null)
this.EditRequested?.Invoke(selectedEntity);
}
}
}
}

View File

@ -0,0 +1,22 @@
<UserControl x:Class="ENI2.Controls.LocodeControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ENI2.Controls"
mc:Ignorable="d"
d:DesignHeight="30" d:DesignWidth="300">
<Grid Grid.Column="1" Grid.Row="0" Width="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<xctk:WatermarkComboBox Grid.Column="0" x:Name="comboBoxLocode" Margin="2" IsEditable="True" Watermark="Type for Locode.."
TextBoxBase.TextChanged="ComboBox_TextChanged" SelectionChanged="comboBoxLocode_SelectionChanged"/> <!-- ItemsSource="{Binding LocodeList, Mode=TwoWay}"
SelectedItem="{Binding LocodeValue}" /> -->
<!--, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:LocodeControl}}-->
<Image Name="imageLocodeState" Grid.Column="1" Source="../Resources/bullet_ball_grey.png" />
</Grid>
</UserControl>

View File

@ -0,0 +1,158 @@
// Copyright (c) 2017 schick Informatik
// Description: Kapselt den Locode - Lookup
//
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using bsmd.database;
using bsmd.ExcelReadService;
using System.ComponentModel;
namespace ENI2.Controls
{
/// <summary>
/// Interaction logic for LocodeControl.xaml
/// </summary>
public partial class LocodeControl : UserControl, INotifyPropertyChanged
{
private List<string> _locodeList = new List<string>();
// private string _selectedLocode;
public event PropertyChangedEventHandler PropertyChanged;
public LocodeControl()
{
InitializeComponent();
}
protected enum LocodeState
{
UNKNOWN,
INVALID,
OK,
AMBIGUOUS
}
/// <summary>
/// used internally to load up drop down
/// </summary>
public List<string> LocodeList
{
get { return this._locodeList; }
set { this._locodeList = value; }
}
public static readonly DependencyProperty LocodeValueProperty = DependencyProperty.Register("LocodeValue", typeof(string), typeof(LocodeControl),
new UIPropertyMetadata(LocodeValueChangedHandler));
//new FrameworkPropertyMetadata(default(string), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public static void LocodeValueChangedHandler(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
// Get instance of current control from sender
// and property value from e.NewValue
// Set public property on TaregtCatalogControl, e.g.
if(e.NewValue != null)
((LocodeControl)sender).SelectedItem = e.NewValue.ToString();
}
public string SelectedItem
{
get { return this.comboBoxLocode.SelectedItem as string; }
set {
this._locodeList.Clear();
this._locodeList.Add(value);
this.comboBoxLocode.ItemsSource = this.LocodeList;
LocodeState locodeState = LocodeDB.PortNameFromLocode(value).IsNullOrEmpty() ? LocodeState.INVALID : LocodeState.OK;
this.SetLocodeStateImage(this.imageLocodeState, locodeState);
this.comboBoxLocode.SelectedItem = value;
}
}
/// <summary>
/// Actual value for DataBinding
/// </summary>
public string LocodeValue
{
get { return (string)GetValue(LocodeValueProperty); }
set { SetValue(LocodeValueProperty, value); }
}
#region event handler
private void ComboBox_TextChanged(object sender, RoutedEventArgs e)
{
if (this.comboBoxLocode.Text.Length > 3)
{
// check if actual locode
bool isLocode = !LocodeDB.PortNameFromLocode(this.comboBoxLocode.Text).IsNullOrEmpty();
if (isLocode)
{
this.SetLocodeStateImage(this.imageLocodeState, LocodeState.OK);
return;
}
// assume this is a harbour name typed out..
this.LocodeList = LocodeDB.AllLocodesForCityName(this.comboBoxLocode.Text + "%");
if (this.LocodeList.Count == 1)
{
this.comboBoxLocode.SelectedItem = this.LocodeList[0];
this.SetLocodeStateImage(this.imageLocodeState, LocodeState.OK);
}
else if (this.LocodeList.Count == 0)
{
this.SetLocodeStateImage(this.imageLocodeState, LocodeState.INVALID);
}
else
{
this.SetLocodeStateImage(this.imageLocodeState, LocodeState.AMBIGUOUS);
}
this.comboBoxLocode.ItemsSource = this.LocodeList;
}
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LocodeList"));
}
private void comboBoxLocode_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.LocodeValue = this.SelectedItem;
}
#endregion
#region private/protected methods
protected void SetLocodeStateImage(Image stateImage, LocodeState state)
{
switch (state)
{
case LocodeState.AMBIGUOUS:
stateImage.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/bullet_ball_yellow.png"));
break;
case LocodeState.INVALID:
stateImage.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/bullet_ball_red.png"));
break;
case LocodeState.OK:
stateImage.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/bullet_ball_green.png"));
break;
case LocodeState.UNKNOWN:
default:
stateImage.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/bullet_ball_grey.png"));
break;
}
}
#endregion
}
}

View File

@ -17,6 +17,8 @@ namespace ENI2
public class DetailBaseControl : UserControl public class DetailBaseControl : UserControl
{ {
protected bool _initialized = false;
protected enum LocodeState protected enum LocodeState
{ {
UNKNOWN, UNKNOWN,

View File

@ -32,7 +32,6 @@
<xctk:WatermarkComboBox Grid.Column="0" x:Name="comboBoxPoC" Margin="2" IsEditable="True" Watermark="Type for Locode.." TextBoxBase.TextChanged="ComboBox_TextChanged" ItemsSource="{Binding LocodePoCList, Mode=TwoWay}" SelectedItem="{Binding PoC, Mode=TwoWay}" /> <xctk:WatermarkComboBox Grid.Column="0" x:Name="comboBoxPoC" Margin="2" IsEditable="True" Watermark="Type for Locode.." TextBoxBase.TextChanged="ComboBox_TextChanged" ItemsSource="{Binding LocodePoCList, Mode=TwoWay}" SelectedItem="{Binding PoC, Mode=TwoWay}" />
<Image Name="imagePoCState" Grid.Column="1" Source="../Resources/bullet_ball_grey.png" /> <Image Name="imagePoCState" Grid.Column="1" Source="../Resources/bullet_ball_grey.png" />
</Grid> </Grid>
<!--TextBox Name="textBoxPoC" Grid.Row="0" Grid.Column="1" IsReadOnly="True" Text="{Binding PoC}" Margin="2"/-->
<Label Grid.Row="0" Grid.Column="2" Content="Visit/Transit-ID" /> <Label Grid.Row="0" Grid.Column="2" Content="Visit/Transit-ID" />
<TextBox Name="textBoxDisplayId" Grid.Row="0" Grid.Column="3" IsReadOnly="True" Margin="2"/> <TextBox Name="textBoxDisplayId" Grid.Row="0" Grid.Column="3" IsReadOnly="True" Margin="2"/>
<Label Grid.Row="1" Grid.Column="0" Content="IMO-Nummer" /> <Label Grid.Row="1" Grid.Column="0" Content="IMO-Nummer" />
@ -43,8 +42,8 @@
<Label Grid.Row="2" Grid.Column="2" Content="ETD PoC" /> <Label Grid.Row="2" Grid.Column="2" Content="ETD PoC" />
<Label Grid.Row="3" Grid.Column="0" Content="ATA PoC" /> <Label Grid.Row="3" Grid.Column="0" Content="ATA PoC" />
<Label Grid.Row="3" Grid.Column="2" Content="ATD PoC" /> <Label Grid.Row="3" Grid.Column="2" Content="ATD PoC" />
<xctk:DateTimePicker Grid.Column="1" Grid.Row="2" Value="{Binding ETA, Mode=TwoWay}" Name="dateTimePickerETA" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2"/> <xctk:DateTimePicker Grid.Column="1" Grid.Row="2" Value="{Binding ETA, Mode=TwoWay}" Name="dateTimePickerETA" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False"/>
<xctk:DateTimePicker Grid.Column="3" Grid.Row="2" Name="dateTimePickerETD" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2"/> <xctk:DateTimePicker Grid.Column="3" Grid.Row="2" Name="dateTimePickerETD" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="False"/>
</Grid> </Grid>
</GroupBox> </GroupBox>

View File

@ -29,8 +29,7 @@ namespace ENI2.DetailViewControls
public partial class OverViewDetailControl : DetailBaseControl, INotifyPropertyChanged public partial class OverViewDetailControl : DetailBaseControl, INotifyPropertyChanged
{ {
private Message _message = null; private Message _message = null;
private List<string> _locodePoCList = new List<string>(); private List<string> _locodePoCList = new List<string>();
private bool _initialized = false;
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
@ -66,7 +65,7 @@ namespace ENI2.DetailViewControls
if (!this.Core.PoC.IsNullOrEmpty()) if (!this.Core.PoC.IsNullOrEmpty())
{ {
this._locodePoCList.Add(this.Core.PoC); this._locodePoCList.Add(this.Core.PoC);
LocodeState locodeState = LocodeDB.PortNameFromLocode(this.Core.PoC).IsNullOrEmpty() ? LocodeState.INVALID : LocodeState.OK; // LocodeState locodeState = LocodeDB.PortNameFromLocode(this.Core.PoC).IsNullOrEmpty() ? LocodeState.INVALID : LocodeState.OK;
} }
Binding vtBinding = new Binding(); Binding vtBinding = new Binding();

View File

@ -5,9 +5,105 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ENI2.DetailViewControls" xmlns:local="clr-namespace:ENI2.DetailViewControls"
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="600" d:DesignWidth="800">
<Grid> <GroupBox Name="portCallGroupBox" Header="Port Call">
<Grid>
</Grid> <Grid.RowDefinitions>
<RowDefinition Height="280" />
<RowDefinition Height="250" />
</Grid.RowDefinitions>
<GroupBox Name="noaNodGroupBox" Header="Arrival/Departure" Margin="5, 20, 5, 0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="ETA port of call" Name="label_ETAToPortOfCall"/>
<Label Grid.Row="0" Grid.Column="2" Content="ETD port of call" Name="label_ETDFromPortOfCall"/>
<Label Grid.Row="1" Grid.Column="0" Content="ETA Kiel Canal" Name="label_ETAToKielCanal"/>
<Label Grid.Row="1" Grid.Column="2" Content="ETD Kiel Canal" Name="label_ETDFromKielCanal"/>
<Label Grid.Row="2" Grid.Column="0" Content="Last port" Name="label_LastPort"/>
<Label Grid.Row="3" Grid.Column="0" Content="Next port" Name="label_NextPort"/>
<Label Grid.Row="2" Grid.Column="2" Content="ETD last port" Name="label_ETDFromLastport" />
<Label Grid.Row="3" Grid.Column="2" Content="ETA next port" Name="label_ETAToNextPort" />
<Label Grid.Row="4" Grid.Column="0" Content="Anchored" Name="label_IsAnchored" />
<xctk:DateTimePicker Grid.Column="1" Grid.Row="0" Value="{Binding ETAToPortOfCall, Mode=TwoWay}" Name="dateTimePicker_ETAToPortOfCall" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2"/>
<xctk:DateTimePicker Grid.Column="3" Grid.Row="0" Value="{Binding ETDFromPortOfCall, Mode=TwoWay}" Name="dateTimePicker_ETDFromPortOfCall" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2"/>
<xctk:DateTimePicker Grid.Column="1" Grid.Row="1" Value="{Binding ETAToKielCanal, Mode=TwoWay}" Name="dateTimePicker_ETAToKielCanal" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2"/>
<xctk:DateTimePicker Grid.Column="3" Grid.Row="1" Value="{Binding ETDFromKielCanal, Mode=TwoWay}" Name="dateTimePicker_ETDFromKielCanal" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2"/>
<xctk:DateTimePicker Grid.Column="3" Grid.Row="3" Value="{Binding ETAToNextPort, Mode=TwoWay}" Name="dateTimePicker_ETAToNextPort" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2"/>
<xctk:DateTimePicker Grid.Column="3" Grid.Row="2" Value="{Binding ETDFromLastPort, Mode=TwoWay}" Name="dateTimePicker_ETDFromLastPort" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2"/>
<enictrl:LocodeControl Grid.Column="1" Grid.Row="2" Width="Auto" x:Name="locodeControl_LastPort" LocodeValue="{Binding LastPort, Mode=TwoWay}"/>
<enictrl:LocodeControl Grid.Column="1" Grid.Row="3" Width="Auto" x:Name="locodeControl_NextPort" LocodeValue="{Binding NextPort, Mode=TwoWay}"/>
<CheckBox Grid.Column="1" Grid.Row="4" IsThreeState="True" VerticalContentAlignment="Center" Name="checkBox_IsAnchored" IsChecked="{Binding IsAnchored}"/>
<GroupBox Grid.Row="5" Grid.ColumnSpan="4" Name="groupBoxCallPurpose" Header="Call Purposes" >
<enictrl:ENIDataGrid x:Name="dataGridCallPurposes" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0">
<DataGrid.Columns>
<DataGridTextColumn Header="Code" Binding="{Binding CallPurposeCode}" IsReadOnly="True" />
<DataGridTextColumn Header="Description" Binding="{Binding CallPurposeDescription}" IsReadOnly="True" />
</DataGrid.Columns>
</enictrl:ENIDataGrid>
</GroupBox>
</Grid>
</GroupBox>
<GroupBox Name="agentGroupBox" Header="Agent" Grid.Row="1" Margin="5, 20, 5, 0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="10" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Company name " Name="label_AgentCompanyName"/>
<Label Grid.Row="1" Grid.Column="0" Content="Street / number" Name="label_AgentStreetAndNumber"/>
<Label Grid.Row="2" Grid.Column="0" Content="Postalcode" Name="label_AgentPostalCode"/>
<Label Grid.Row="5" Grid.Column="0" Content="Last name" Name="label_AgentLastName"/>
<Label Grid.Row="6" Grid.Column="0" Content="Phone" Name="label_AgentPhone" />
<Label Grid.Row="7" Grid.Column="0" Content="E-Mail" Name="label_AgentEMail" />
<Label Grid.Row="2" Grid.Column="2" Content="City" Name="label_AgentCity" />
<Label Grid.Row="5" Grid.Column="2" Content="First name" Name="label_AgentFirstName"/>
<Label Grid.Row="6" Grid.Column="2" Content="Fax" Name="label_AgentFax"/>
<TextBox Grid.Row="0" Grid.Column="1" Name="textBox_AgentCompanyName" MaxLength="100" Margin="2" Text="{Binding AgentCompanyName}"/>
<TextBox Grid.Row="1" Grid.Column="1" Name="textBox_AgentStreetAndNumber" MaxLength="100" Margin="2" Text="{Binding AgentStreetAndNumber}" />
<TextBox Grid.Row="2" Grid.Column="1" Name="textBox_AgentPostalCode" MaxLength="100" Margin="2" Text="{Binding AgentPostalCode}" />
<TextBox Grid.Row="2" Grid.Column="3" Name="textBox_AgentCity" MaxLength="100" Margin="2" Text="{Binding AgentCity}"/>
<TextBox Grid.Row="5" Grid.Column="1" Name="textBox_AgentLastName" MaxLength="100" Margin="2" Text="{Binding AgentLastName}"/>
<TextBox Grid.Row="6" Grid.Column="1" Name="textBox_AgentPhone" MaxLength="100" Margin="2" Text="{Binding AgentPhone}"/>
<TextBox Grid.Row="7" Grid.Column="1" Name="textBox_AgentEMail" MaxLength="100" Margin="2" Text="{Binding AgentEMail}"/>
<TextBox Grid.Row="5" Grid.Column="3" Name="textBox_AgentFirstName" MaxLength="100" Margin="2" Text="{Binding AgentFirstName}"/>
<TextBox Grid.Row="6" Grid.Column="3" Name="textBox_AgentFax" MaxLength="100" Margin="2" Text="{Binding AgentFax}"/>
</Grid>
</GroupBox>
</Grid>
</GroupBox>
</src:DetailBaseControl> </src:DetailBaseControl>

View File

@ -18,6 +18,7 @@ using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using bsmd.database; using bsmd.database;
using bsmd.ExcelReadService;
using ENI2; using ENI2;
namespace ENI2.DetailViewControls namespace ENI2.DetailViewControls
@ -27,9 +28,60 @@ namespace ENI2.DetailViewControls
/// </summary> /// </summary>
public partial class PortCallDetailControl : DetailBaseControl public partial class PortCallDetailControl : DetailBaseControl
{ {
private NOA_NOD _noa_nod;
private AGNT _agnt;
public PortCallDetailControl() public PortCallDetailControl()
{ {
InitializeComponent(); InitializeComponent();
} }
public override void Initialize()
{
base.Initialize();
foreach (Message aMessage in this.Messages)
{
if (aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD)
{
if (aMessage.Elements.Count > 0)
_noa_nod = aMessage.Elements[0] as NOA_NOD;
else
_noa_nod = new NOA_NOD(); // TODO
}
if(aMessage.MessageNotificationClass == Message.NotificationClass.AGNT)
{
if (aMessage.Elements.Count > 0)
_agnt = aMessage.Elements[0] as AGNT;
else
_agnt = new AGNT();
}
}
this.dateTimePicker_ETAToKielCanal.IsEnabled = this.Core.IsTransit;
this.dateTimePicker_ETDFromKielCanal.IsEnabled = this.Core.IsTransit;
this.dateTimePicker_ETAToPortOfCall.IsEnabled = !this.Core.IsTransit;
this.dateTimePicker_ETDFromPortOfCall.IsEnabled = !this.Core.IsTransit;
this.noaNodGroupBox.DataContext = _noa_nod;
this.locodeControl_LastPort.DataContext = _noa_nod;
this.locodeControl_NextPort.DataContext = _noa_nod;
this.dataGridCallPurposes.Initialize();
this.dataGridCallPurposes.ItemsSource = _noa_nod.CallPurposes;
this.agentGroupBox.DataContext = _agnt;
this.dateTimePicker_ETAToKielCanal.DataContext = _noa_nod;
this.dateTimePicker_ETAToNextPort.DataContext = _noa_nod;
this.dateTimePicker_ETAToPortOfCall.DataContext = _noa_nod;
this.dateTimePicker_ETDFromKielCanal.DataContext = _noa_nod;
this.dateTimePicker_ETDFromLastPort.DataContext = _noa_nod;
this.dateTimePicker_ETDFromPortOfCall.DataContext = _noa_nod;
}
} }
} }

View File

@ -35,8 +35,8 @@
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion> <MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage> <WebPage>publish.html</WebPage>
<ApplicationRevision>5</ApplicationRevision> <ApplicationRevision>3</ApplicationRevision>
<ApplicationVersion>3.5.3.%2a</ApplicationVersion> <ApplicationVersion>3.5.6.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut> <CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>
@ -157,6 +157,10 @@
<Compile Include="..\..\..\nsw\Source\bsmd.ExcelReadService\LocodeDB.cs"> <Compile Include="..\..\..\nsw\Source\bsmd.ExcelReadService\LocodeDB.cs">
<Link>Locode\LocodeDB.cs</Link> <Link>Locode\LocodeDB.cs</Link>
</Compile> </Compile>
<Compile Include="Controls\ENIDataGrid.cs" />
<Compile Include="Controls\LocodeControl.xaml.cs">
<DependentUpon>LocodeControl.xaml</DependentUpon>
</Compile>
<Compile Include="DetailBaseControl.cs" /> <Compile Include="DetailBaseControl.cs" />
<Compile Include="DetailRootControl.xaml.cs"> <Compile Include="DetailRootControl.xaml.cs">
<DependentUpon>DetailRootControl.xaml</DependentUpon> <DependentUpon>DetailRootControl.xaml</DependentUpon>
@ -211,6 +215,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Controls\LocodeControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="DetailRootControl.xaml"> <Page Include="DetailRootControl.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@ -286,6 +294,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="VorgaengeControl.xaml"> <Page Include="VorgaengeControl.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@ -305,6 +317,9 @@
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<Resource Include="Resources\edit.png" />
<Resource Include="Resources\delete.png" />
<Resource Include="Resources\add.png" />
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@ -60,6 +60,16 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap add {
get {
object obj = ResourceManager.GetObject("add", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>
@ -160,6 +170,16 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap delete {
get {
object obj = ResourceManager.GetObject("delete", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>
@ -170,6 +190,16 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap edit {
get {
object obj = ResourceManager.GetObject("edit", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>

View File

@ -181,4 +181,13 @@
<data name="bullet_ball_yellow" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="bullet_ball_yellow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bullet_ball_yellow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\bullet_ball_yellow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="edit" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\edit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -9,7 +9,7 @@
d:DesignHeight="600" d:DesignWidth="800"> d:DesignHeight="600" d:DesignWidth="800">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="120" /> <RowDefinition Height="150" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid Grid.Row="0"> <Grid Grid.Row="0">
@ -26,7 +26,9 @@
<RowDefinition Height="30" /> <RowDefinition Height="30" />
<RowDefinition Height="30" /> <RowDefinition Height="30" />
<RowDefinition Height="30" /> <RowDefinition Height="30" />
<RowDefinition Height="30" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="Id"/> <Label Grid.Column="0" Grid.Row="0" Content="Id"/>
<Label Grid.Column="0" Grid.Row="1" Content="IMO / ENI Nr."/> <Label Grid.Column="0" Grid.Row="1" Content="IMO / ENI Nr."/>
<Label Grid.Column="0" Grid.Row="2" Content="Schiffsname"/> <Label Grid.Column="0" Grid.Row="2" Content="Schiffsname"/>
@ -34,7 +36,7 @@
<Label Grid.Column="2" Grid.Row="1" Content="ETA"/> <Label Grid.Column="2" Grid.Row="1" Content="ETA"/>
<Label Grid.Column="2" Grid.Row="2" Content="Ticket-Nr."/> <Label Grid.Column="2" Grid.Row="2" Content="Ticket-Nr."/>
<TextBox Grid.Column="1" Grid.Row="0" Name="textBoxId" VerticalContentAlignment="Center" Margin="2"/> <TextBox Grid.Column="1" Grid.Row="0" Name="textBoxId" VerticalContentAlignment="Center" Margin="2"/>
<TextBox Grid.Column="1" Grid.Row="1" Name="textBoxIMO" VerticalContentAlignment="Center" Margin="2"/> <TextBox Grid.Column="1" Grid.Row="1" Name="textBoxIMO" VerticalContentAlignment="Center" Margin="2" MaxLength="7"/>
<TextBox Grid.Column="1" Grid.Row="2" Name="textBoxName" VerticalContentAlignment="Center" Margin="2"/> <TextBox Grid.Column="1" Grid.Row="2" Name="textBoxName" VerticalContentAlignment="Center" Margin="2"/>
<TextBox Grid.Column="3" Grid.Row="0" Name="textBoxHafen" VerticalContentAlignment="Center" Margin="2"/> <TextBox Grid.Column="3" Grid.Row="0" Name="textBoxHafen" VerticalContentAlignment="Center" Margin="2"/>
<Grid Grid.Column="3" Grid.Row="1" Height="Auto" Margin="2"> <Grid Grid.Column="3" Grid.Row="1" Height="Auto" Margin="2">
@ -45,15 +47,16 @@
<ColumnDefinition Width="3*" /> <ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="Von:" HorizontalAlignment="Left" /> <Label Grid.Column="0" Grid.Row="0" Content="Von:" HorizontalAlignment="Left" />
<xctk:DateTimePicker Grid.Column="1" Grid.Row="0" Name="dateTimePickerETAFrom" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" /> <xctk:DateTimePicker Grid.Column="1" Grid.Row="0" Name="dateTimePickerETAFrom" Format="Custom" FormatString="dd.MM.yyyy" ShowButtonSpinner="False" VerticalContentAlignment="Center" AutoCloseCalendar="True" ValueChanged="etaValueChanged" AllowTextInput="False" TimePickerVisibility="Collapsed"/>
<Label Grid.Column="2" Grid.Row="0" Content="Bis:" HorizontalAlignment="Left" /> <Label Grid.Column="2" Grid.Row="0" Content="Bis:" HorizontalAlignment="Left" />
<xctk:DateTimePicker Grid.Column="3" Grid.Row="0" Name="dateTimePickerETATo" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" /> <xctk:DateTimePicker Grid.Column="3" Grid.Row="0" Name="dateTimePickerETATo" Format="Custom" FormatString="dd.MM.yyyy" ShowButtonSpinner="False" VerticalContentAlignment="Center" AutoCloseCalendar="True" ValueChanged="etaValueChanged" AllowTextInput="False" TimePickerVisibility="Collapsed"/>
</Grid> </Grid>
<TextBox Grid.Column="3" Grid.Row="2" Name="textBoxTicketNr" Margin="2"/> <TextBox Grid.Column="3" Grid.Row="2" Name="textBoxTicketNr" Margin="2"/>
<Button Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Content="Eingaben löschen" Name="buttonClearInput" Click="Button_Click" Margin="2"/> <Button Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Content="Eingaben löschen" Name="buttonClearInput" Click="Button_Click" Margin="2"/>
<Button Grid.Column="2" Grid.Row="3" Grid.ColumnSpan="2" Content="Suche" Name="buttonSuche" Click="buttonSuche_Click" Margin="2"/> <Button Grid.Column="2" Grid.Row="3" Grid.ColumnSpan="2" Content="Suche" Name="buttonSuche" Click="buttonSuche_Click" Margin="2"/>
</Grid> <Label Name="searchResultLabel" Grid.ColumnSpan="4" Grid.Row="4" VerticalContentAlignment="Center" />
</Grid>
<DataGrid Grid.Row="1" Margin="0,8,0,0" x:Name="dataGrid" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" <DataGrid Grid.Row="1" Margin="0,8,0,0" x:Name="dataGrid" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" MouseDoubleClick="dataGrid_MouseDoubleClick" PreviewKeyDown="dataGrid_PreviewKeyDown" > SelectionMode="Single" AutoGenerateColumns="False" MouseDoubleClick="dataGrid_MouseDoubleClick" PreviewKeyDown="dataGrid_PreviewKeyDown" >
<DataGrid.Columns> <DataGrid.Columns>

View File

@ -75,7 +75,8 @@ namespace ENI2
} }
if(!this.dateTimePickerETATo.Text.IsNullOrEmpty()) if(!this.dateTimePickerETATo.Text.IsNullOrEmpty())
{ {
to = this.dateTimePickerETATo.Value.Value.ToUnixTimeStamp(); DateTime toTime = this.dateTimePickerETATo.Value.Value.Add(new TimeSpan(23, 59, 59)); // search till the end of the "to" day (no time selection)
to = toTime.ToUnixTimeStamp();
} }
if (from.HasValue || to.HasValue) if (from.HasValue || to.HasValue)
@ -86,6 +87,19 @@ namespace ENI2
// ergebnis anzeigen // ergebnis anzeigen
this.dataGrid.ItemsSource = this.anmeldungen; this.dataGrid.ItemsSource = this.anmeldungen;
this.searchResultLabel.Content = (this.anmeldungen.Count > 0) ? string.Format("{0} results found.", this.anmeldungen.Count) : "no results";
}
private void etaValueChanged(object sender, EventArgs args)
{
bool valid = true;
if ((this.dateTimePickerETAFrom.Value != null) && (this.dateTimePickerETATo.Value != null) &&
this.dateTimePickerETATo.Value.Value < this.dateTimePickerETAFrom.Value.Value)
valid = false;
this.dateTimePickerETAFrom.Background = valid ? SystemColors.ControlBrush : Brushes.Red;
this.dateTimePickerETATo.Background = valid ? SystemColors.ControlBrush : Brushes.Red;
} }
#endregion #endregion

View File

@ -0,0 +1,20 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:local="clr-namespace:ENI2">
<Style TargetType="{x:Type enictrl:ENIDataGrid}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type enictrl:ENIDataGrid}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

Binary file not shown.

View File

@ -281,6 +281,8 @@ namespace bsmd.ExcelReadService
bpol.StowawaysOnBoard = (poba.TotalStowawaysOnBoardUponArrival ?? 0) > 0; bpol.StowawaysOnBoard = (poba.TotalStowawaysOnBoardUponArrival ?? 0) > 0;
} }
bpol.DeleteElements();
// PortOfItinerary // PortOfItinerary
for (int i = 1; i <= 10; i++) for (int i = 1; i <= 10; i++)
{ {
@ -382,6 +384,7 @@ namespace bsmd.ExcelReadService
hazaMessage.Elements.Add(newHaza); hazaMessage.Elements.Add(newHaza);
} }
HAZ haza = hazaMessage.Elements[0] as HAZ; HAZ haza = hazaMessage.Elements[0] as HAZ;
haza.DeleteElements();
haza.NoDPGOnBoardOnArrival = !reader.ReadBoolean("HAZA.DGOnBoard"); haza.NoDPGOnBoardOnArrival = !reader.ReadBoolean("HAZA.DGOnBoard");
haza.DPGManifestOnBoardOnArrival = reader.ReadBoolean("HAZA.DPGManifestOnBoardOnArrival"); haza.DPGManifestOnBoardOnArrival = reader.ReadBoolean("HAZA.DPGManifestOnBoardOnArrival");
@ -681,6 +684,7 @@ namespace bsmd.ExcelReadService
hazdMessage.Elements.Add(newHazd); hazdMessage.Elements.Add(newHazd);
} }
HAZ hazd = hazdMessage.Elements[0] as HAZ; HAZ hazd = hazdMessage.Elements[0] as HAZ;
hazd.DeleteElements();
hazd.NoDPGOnBoardOnArrival = !reader.ReadBoolean("HAZD.DGOnBoard"); hazd.NoDPGOnBoardOnArrival = !reader.ReadBoolean("HAZD.DGOnBoard");
hazd.DPGManifestOnBoardOnArrival = reader.ReadBoolean("HAZD.DPGManifestOnBoardOnDeparture"); hazd.DPGManifestOnBoardOnArrival = reader.ReadBoolean("HAZD.DPGManifestOnBoardOnDeparture");
@ -1197,6 +1201,7 @@ namespace bsmd.ExcelReadService
wasMessage.Elements.Add(newWAS); wasMessage.Elements.Add(newWAS);
} }
WAS was = wasMessage.Elements[0] as WAS; WAS was = wasMessage.Elements[0] as WAS;
was.DeleteElements();
Util.ScanMessage(was, reader); Util.ScanMessage(was, reader);
was.WasteDisposalDelivery = reader.ReadDelivery("WAS.WasteDisposalDelivery"); was.WasteDisposalDelivery = reader.ReadDelivery("WAS.WasteDisposalDelivery");
if ((was.LastWasteDisposalPort != null) && (was.LastWasteDisposalPort.Length > 5)) if ((was.LastWasteDisposalPort != null) && (was.LastWasteDisposalPort.Length > 5))
@ -1394,6 +1399,7 @@ namespace bsmd.ExcelReadService
mdhMessage.Elements.Add(newMDH); mdhMessage.Elements.Add(newMDH);
} }
MDH mdh = mdhMessage.Elements[0] as MDH; MDH mdh = mdhMessage.Elements[0] as MDH;
mdh.DeleteElements();
Util.ScanMessage(mdh, reader); Util.ScanMessage(mdh, reader);
// lt. Mail von Christin am 28.9.2016 // lt. Mail von Christin am 28.9.2016
@ -1616,7 +1622,7 @@ namespace bsmd.ExcelReadService
newSEC.MessageHeader = secMessage; newSEC.MessageHeader = secMessage;
secMessage.Elements.Add(newSEC); secMessage.Elements.Add(newSEC);
} }
SEC sec = secMessage.Elements[0] as SEC; SEC sec = secMessage.Elements[0] as SEC;
Util.ScanMessage(sec, reader); Util.ScanMessage(sec, reader);
reader.ReadBoolean("SEC.AreMatterToReport"); // das berücksichtigen wir derzeit nicht in der DB (implizit) reader.ReadBoolean("SEC.AreMatterToReport"); // das berücksichtigen wir derzeit nicht in der DB (implizit)
@ -1788,6 +1794,7 @@ namespace bsmd.ExcelReadService
static void ScanBKRA(List<Message> messages, MessageCore messageCore, ExcelReader reader) static void ScanBKRA(List<Message> messages, MessageCore messageCore, ExcelReader reader)
{ {
Message bkraMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.BKRA); Message bkraMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.BKRA);
bkraMessage.DeleteElements();
for (int i = 1; i <= bkraMessage.NumberOfExcelRows; i++) for (int i = 1; i <= bkraMessage.NumberOfExcelRows; i++)
{ {
string lnQuantity = string.Format("BKRA.BunkerFuelQuantity_TNE_{0}", i); string lnQuantity = string.Format("BKRA.BunkerFuelQuantity_TNE_{0}", i);
@ -1829,6 +1836,7 @@ namespace bsmd.ExcelReadService
static void ScanBKRD(List<Message> messages, MessageCore messageCore, ExcelReader reader) static void ScanBKRD(List<Message> messages, MessageCore messageCore, ExcelReader reader)
{ {
Message bkrdMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.BKRD); Message bkrdMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.BKRD);
bkrdMessage.DeleteElements();
for (int i = 1; i <= bkrdMessage.NumberOfExcelRows; i++) for (int i = 1; i <= bkrdMessage.NumberOfExcelRows; i++)
{ {
string lnQuantity = string.Format("BKRD.BunkerFuelQuantity_TNE_{0}", i); string lnQuantity = string.Format("BKRD.BunkerFuelQuantity_TNE_{0}", i);
@ -1869,6 +1877,7 @@ namespace bsmd.ExcelReadService
static void ScanTOWA(List<Message> messages, MessageCore messageCore, ExcelReader reader) static void ScanTOWA(List<Message> messages, MessageCore messageCore, ExcelReader reader)
{ {
Message towaMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.TOWA); Message towaMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.TOWA);
towaMessage.DeleteElements();
for (int i = 1; i <= towaMessage.NumberOfExcelRows; i++) for (int i = 1; i <= towaMessage.NumberOfExcelRows; i++)
{ {
string tName = string.Format("TOWA.TowageOnArrivalName_{0}", i); string tName = string.Format("TOWA.TowageOnArrivalName_{0}", i);
@ -1914,6 +1923,7 @@ namespace bsmd.ExcelReadService
static void ScanTOWD(List<Message> messages, MessageCore messageCore, ExcelReader reader) static void ScanTOWD(List<Message> messages, MessageCore messageCore, ExcelReader reader)
{ {
Message towdMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.TOWD); Message towdMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.TOWD);
towdMessage.DeleteElements();
for (int i = 1; i <= towdMessage.NumberOfExcelRows; i++) for (int i = 1; i <= towdMessage.NumberOfExcelRows; i++)
{ {
@ -2001,6 +2011,8 @@ namespace bsmd.ExcelReadService
static void ScanSTO(List<Message> messages, MessageCore messageCore, ExcelReader reader) static void ScanSTO(List<Message> messages, MessageCore messageCore, ExcelReader reader)
{ {
Message stoMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.STO); Message stoMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.STO);
stoMessage.DeleteElements();
for(int i=0;i<stoMessage.NumberOfExcelRows;i++) // 10 for(int i=0;i<stoMessage.NumberOfExcelRows;i++) // 10
{ {
string stoName = string.Format("STO.Name_{0}", i + 1); string stoName = string.Format("STO.Name_{0}", i + 1);
@ -2040,6 +2052,8 @@ namespace bsmd.ExcelReadService
static void ScanLADG(List<Message> messages, MessageCore messageCore, ExcelReader reader) static void ScanLADG(List<Message> messages, MessageCore messageCore, ExcelReader reader)
{ {
Message ladgMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.LADG); Message ladgMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.LADG);
ladgMessage.DeleteElements();
for (int i = 0; i < ladgMessage.NumberOfExcelRows; i++) for (int i = 0; i < ladgMessage.NumberOfExcelRows; i++)
{ {
string lnCHT = string.Format("LADG.CargoHandlingType_{0}", i + 1); string lnCHT = string.Format("LADG.CargoHandlingType_{0}", i + 1);
@ -2143,6 +2157,8 @@ namespace bsmd.ExcelReadService
static void ScanCREW(List<Message> messages, MessageCore messageCore, ExcelReader reader) static void ScanCREW(List<Message> messages, MessageCore messageCore, ExcelReader reader)
{ {
Message crewMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.CREW); Message crewMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.CREW);
crewMessage.DeleteElements();
for (int i = 0; i < crewMessage.NumberOfExcelRows; i++) for (int i = 0; i < crewMessage.NumberOfExcelRows; i++)
{ {
string crewLastName = string.Format("CREW.CrewMemberLastName_{0}", i + 1); string crewLastName = string.Format("CREW.CrewMemberLastName_{0}", i + 1);
@ -2254,6 +2270,8 @@ namespace bsmd.ExcelReadService
static void ScanPAS(List<Message> messages, MessageCore messageCore, ExcelReader reader) static void ScanPAS(List<Message> messages, MessageCore messageCore, ExcelReader reader)
{ {
Message pasMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.PAS); Message pasMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.PAS);
pasMessage.DeleteElements();
for (int i = 0; i < pasMessage.NumberOfExcelRows; i++) for (int i = 0; i < pasMessage.NumberOfExcelRows; i++)
{ {
string pasLastName = string.Format("PAS.PassengerLastName_{0}", i + 1); string pasLastName = string.Format("PAS.PassengerLastName_{0}", i + 1);

View File

@ -22,6 +22,7 @@ namespace bsmd.database
{ {
private static ILog _log = LogManager.GetLogger(typeof(Extensions)); private static ILog _log = LogManager.GetLogger(typeof(Extensions));
private static Regex splitRegex = new Regex(@"(""((\\"")|([^""]))*"")|('((\\')|([^']))*')|(\S+)"); private static Regex splitRegex = new Regex(@"(""((\\"")|([^""]))*"")|('((\\')|([^']))*')|(\S+)");
private static char[] splitDelimiter = new[] { ',', ';', ' ' };
public static bool IsNullOrEmpty(this String str) public static bool IsNullOrEmpty(this String str)
{ {
@ -114,11 +115,17 @@ namespace bsmd.database
foreach(Match match in splitRegex.Matches(source)) foreach(Match match in splitRegex.Matches(source))
{ {
result.Add(match.Value); result.Add(match.Value.Trim());
} }
return result; return result;
} }
public static List<string> SimpleSplit(this string source)
{
List<string> result = new List<string>(source.Split(splitDelimiter, StringSplitOptions.RemoveEmptyEntries));
return result;
}
} }
} }

View File

@ -2,9 +2,7 @@
using System.Data; using System.Data;
using System.Data.SqlClient; using System.Data.SqlClient;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
namespace bsmd.database namespace bsmd.database
{ {
@ -276,7 +274,7 @@ namespace bsmd.database
} }
case Message.LoadFilter.BSMDSTATUS: case Message.LoadFilter.BSMDSTATUS:
{ {
sb.Append("WHERE BSMDStatus = @STATUS ORDER BY Created DESC"); sb.Append("WHERE BSMDStatus = @STATUS ORDER BY ETA");
((SqlCommand)cmd).Parameters.AddWithValue("@STATUS", criteria[0]); ((SqlCommand)cmd).Parameters.AddWithValue("@STATUS", criteria[0]);
break; break;
} }
@ -374,7 +372,7 @@ namespace bsmd.database
{ {
sb.Append("( "); sb.Append("( ");
int paramCnt = 0; int paramCnt = 0;
foreach (string param in searchDict[key].RegexSplit()) foreach (string param in searchDict[key].SimpleSplit())
{ {
string paramName = string.Format("@SEARCH_PORT{0}", paramCnt); string paramName = string.Format("@SEARCH_PORT{0}", paramCnt);
if (paramCnt > 0) sb.Append(" OR "); if (paramCnt > 0) sb.Append(" OR ");
@ -397,12 +395,14 @@ namespace bsmd.database
break; break;
} }
if (!moreThanOne) moreThanOne = true; if (!moreThanOne) moreThanOne = true;
} }
} }
sb.Append(" ORDER BY ETA");
break; break;
} }
case Message.LoadFilter.ALL: case Message.LoadFilter.ALL:
default: default:
sb.Append(" ORDER BY ETA");
break; break;
} }

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")] [assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
[assembly: AssemblyProduct("BSMD NSW interface")] [assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("3.5.5")] [assembly: AssemblyInformationalVersion("3.5.6")]
[assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")] [assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]

View File

@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.5.5.*")] [assembly: AssemblyVersion("3.5.6.*")]