Version 5.0.3, Validierung und die neue "Copy" Funktion

This commit is contained in:
Daniel Schick 2018-03-17 11:40:16 +00:00
parent 1ff4a47010
commit ad7417f03c
35 changed files with 608 additions and 33 deletions

View File

@ -79,16 +79,24 @@ namespace ENI2.Controls
public string LocodeValue
{
get { return (string)GetValue(LocodeValueProperty); }
set { SetValue(LocodeValueProperty, value); }
set { SetValue(LocodeValueProperty, value); }
}
private static object LocodeValue_CoerceValue(DependencyObject dobj, object Value)
{
//called whenever dependency property value is reevaluated. The return value is the
//latest value set to the dependency property
// MessageBox.Show(string.Format("CoerceValue is fired : Value {0}", Value));
return Value;
}
public RuleEngine.LocodeMode LocodeSource { get; set; }
#region static methods
public static readonly DependencyProperty LocodeValueProperty = DependencyProperty.Register("LocodeValue", typeof(string), typeof(LocodeControl),
new UIPropertyMetadata(LocodeValueChangedHandler));
new UIPropertyMetadata(null, LocodeValueChangedHandler, LocodeValue_CoerceValue));
public static void LocodeValueChangedHandler(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
@ -209,6 +217,7 @@ namespace ENI2.Controls
this.LocodeValue = this.SelectedItem;
}
}
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("LocodeList"));
}
#endregion

View File

@ -76,6 +76,11 @@ namespace ENI2
/// </summary>
public event Action RequestDisable;
/// <summary>
/// Damit kann aus einer Anmeldung heraus die Kopier-Logik ausgelöst werden
/// </summary>
public event Action RequestCopy;
/// <summary>
/// Eine in der Detailansicht enthaltene Meldeklasse hat sich geändert
/// </summary>
@ -165,6 +170,11 @@ namespace ENI2
this.RequestDisable?.Invoke();
}
protected virtual void OnRequestCopy()
{
this.RequestCopy?.Invoke();
}
protected virtual void OnControlCacheReset(string messageGroupName)
{
this.ResetControlCache?.Invoke(messageGroupName);

View File

@ -50,6 +50,8 @@ namespace ENI2
internal event DatabaseEntityWatchdog.DatabaseEntityChangedHandler HighlightReset;
internal event Action<MessageCore> OpenNewCoreRequested;
public bool HasUnsavedChanges
{
get { return (this.buttonSave.Visibility == Visibility.Visible); } // schwach aber es wird's tun
@ -159,6 +161,7 @@ namespace ENI2
detailControl.ResetControlCache += DetailControl_ResetControlCache;
detailControl.RequestValidate += DetailControl_RequestValidate;
detailControl.RequestDisable += DetailControl_RequestDisable;
detailControl.RequestCopy += DetailControl_RequestCopy;
detailControl.RequestSendValidation += DetailControl_RequestSendValidation;
detailControl.Initialize();
@ -192,7 +195,52 @@ namespace ENI2
detailView.Children.Add(controlCache[mg.MessageGroupName]);
}
}
}
private void DetailControl_RequestCopy()
{
CopyDeclarationDialog cdd = new CopyDeclarationDialog();
MessageCore newCore = new MessageCore();
cdd.NewCore = newCore;
cdd.OldCore = this.Core;
cdd.IsModal = false;
cdd.Closed += (senderDialog, closeArgs) =>
{
CopyDeclarationDialog closedDialog = senderDialog as CopyDeclarationDialog;
if (closedDialog.IsOK)
{
if (!closedDialog.NewCore.IsDK && closedDialog.NewCore.VisitId.IsNullOrEmpty() && closedDialog.NewCore.TransitId.IsNullOrEmpty())
{
// deutsche Häfen fordern eine Visit-Id an, für DK erfolgt hier nur die Anlage eines Datensatzes
closedDialog.NewCore.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
}
if (closedDialog.NewCore.PoC.Equals("ZZNOK"))
closedDialog.NewCore.IsTransit = true;
closedDialog.NewCore.Incoming = true;
closedDialog.NewCore.DefaultReportingPartyId = this.LockedBy.Id;
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(newCore);
// Meldeklassen für neuen Anlauf erzeugen
List<Message> newMessages = new List<Message>();
foreach (Message oldMessage in this._messages)
{
Message newMessage = oldMessage.Clone() as Message;
newMessage.MessageCore = newCore;
newMessage.MessageCoreId = newCore.Id;
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(newMessage);
newMessage.SaveElements();
}
//
this.OnOpenNewCoreRequested(newCore);
}
};
cdd.Show();
}
private void DetailControl_RequestDisable()
{
@ -604,6 +652,11 @@ namespace ENI2
this.HighlightReset?.Invoke(this.Core);
}
protected virtual void OnOpenNewCoreRequested(MessageCore newCore)
{
this.OpenNewCoreRequested?.Invoke(newCore);
}
private DependencyObject GetContainerForMessageGroupName(string messageGroupName)
{
if (controlCache.ContainsKey(messageGroupName))

View File

@ -79,7 +79,7 @@
<Label Grid.Column="0" Grid.Row="6" Margin="0,0,10,0" HorizontalContentAlignment="Right" Name="labelBSMDStatusInternal" Content="{Binding BSMDStatusInternal, StringFormat={}{0}}" VerticalContentAlignment="Center" FontWeight="Bold" />
<Button IsEnabled="True" Name="buttonStorno" Grid.Column="1" Grid.Row="6" Margin="2" Click="buttonStorno_Click" Content="{x:Static p:Resources.textCancelDeclaration}"/>
<Button IsEnabled="False" Name="buttonCopy" Grid.Column="2" Grid.Row="6" Margin="2" Click="buttonCopy_Click" Content="{x:Static p:Resources.textCopyData}"/>
<Button IsEnabled="True" Name="buttonCopy" Grid.Column="2" Grid.Row="6" Margin="2" Click="buttonCopy_Click" Content="{x:Static p:Resources.textCopyData}"/>
<Button IsEnabled="False" Name="buttonSendPDF" Grid.Column="3" Grid.Row="6" Margin="2" Click="buttonSendPDF_Click" Content="{x:Static p:Resources.textCreatePDF}"/>
<Button Name="buttonQueryHIS" Grid.Column="4" Grid.Row="6" Margin="2" Click="buttonQueryHIS_Click" Content="{x:Static p:Resources.textQueryHIS}"/>
<StackPanel Orientation="Horizontal" Grid.Column="5" Grid.Row="6">

View File

@ -532,7 +532,7 @@ namespace ENI2.DetailViewControls
private void buttonCopy_Click(object sender, RoutedEventArgs e)
{
this.OnRequestCopy();
}
private void buttonSendPDF_Click(object sender, RoutedEventArgs e)

View File

@ -35,8 +35,8 @@
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>5.0.1.%2a</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>5.0.3.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
@ -237,6 +237,9 @@
<Compile Include="EditControls\AboutDialog.xaml.cs">
<DependentUpon>AboutDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\CopyDeclarationDialog.xaml.cs">
<DependentUpon>CopyDeclarationDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\CoreStatusInfoDialog.xaml.cs">
<DependentUpon>CoreStatusInfoDialog.xaml</DependentUpon>
</Compile>
@ -445,6 +448,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\CopyDeclarationDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\CoreStatusInfoDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -673,6 +680,9 @@
<Resource Include="Resources\bullet_ball_red.ico" />
<Resource Include="Resources\bullet_ball_yellow.ico" />
<Resource Include="Resources\document_pdf.png" />
<Resource Include="Resources\id_card_add.ico" />
<Resource Include="Resources\id_card_new.ico" />
<Resource Include="Resources\id_cards.ico" />
<Content Include="x64\SQLite.Interop.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

View File

@ -0,0 +1,65 @@
<enictrl:EditWindowBase x:Class="ENI2.EditControls.CopyDeclarationDialog"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ENI2.EditControls"
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textCopyDeclaration}" Height="270" Width="440" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2;component/Resources/id_cards.ico">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="28" />
</Grid.ColumnDefinitions>
<Label Name="labelVisitId" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textVisitTransitId}" />
<Label Name="labelIMO" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textIMO}" />
<Label Name="labelENI" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textENI}" />
<Label Name="labelPoC" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textPortCall}" />
<Label Name="labelETA" Grid.Row="4" Grid.Column="0" Content="ETA" />
<Label Name="labelHIS" Grid.Row="5" Grid.Column="0" Content="HIS" />
<TextBox Name="textBoxVisitTransitId" Margin="2" Grid.Row="0" Grid.Column="1" TextChanged="textBoxVisitTransitId_TextChanged" VerticalContentAlignment="Center"/>
<Image Grid.Row="0" Grid.Column="2" Name="okCheckMark" Source="pack://application:,,,/Resources/check.png" Margin="2" Visibility="Hidden" />
<xctk:DoubleUpDown x:Name="doubleUpDownIMO" Margin="2" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
ClipValueToMinMax="True"
ShowButtonSpinner="False"
AllowSpin="True"
AllowTextInput="True"
IsReadOnly="False"
MouseWheelActiveOnFocus="True"
FormatString="G"
Increment="1"
DisplayDefaultValueOnEmptyText="False"
ButtonSpinnerLocation="Right"
ParsingNumberStyle="Integer"
Watermark="Enter IMO" ValueChanged="doubleUpDownIMO_ValueChanged" TextAlignment="Left"/>
<xctk:DoubleUpDown x:Name="doubleUpDownENI" Margin="2" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
ClipValueToMinMax="True"
ShowButtonSpinner="False"
AllowSpin="True"
AllowTextInput="True"
IsReadOnly="False"
MouseWheelActiveOnFocus="True"
FormatString="00000000"
Increment="1"
DisplayDefaultValueOnEmptyText="False"
ButtonSpinnerLocation="Right"
ParsingNumberStyle="Integer"
Watermark="Enter ENI" ValueChanged="doubleUpDownENI_ValueChanged" TextAlignment="Left"/>
<enictrl:LocodeControl Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="2" Width="Auto" x:Name="locodePoC" />
<DatePicker Name="datePickerETA" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" SelectedDateChanged="datePickerETA_SelectedDateChanged" />
<ComboBox Name="comboBoxInitialHIS" Grid.Row="5" Grid.Column="1" Margin="2" Grid.ColumnSpan="2" DisplayMemberPath="Value" SelectedValuePath="Key" SelectionChanged="comboBoxInitialHIS_SelectionChanged"/>
</Grid>
</enictrl:EditWindowBase>

View File

@ -0,0 +1,155 @@
// Copyright (c) 2017 schick Informatik
// Description: Dialog, um aus einer alten Anmeldung eine neue zu machen
//
using ENI2.Controls;
using bsmd.database;
using System.Collections.Generic;
using System;
using bsmd.ExcelReadService;
using System.ComponentModel;
namespace ENI2.EditControls
{
/// <summary>
/// Interaction logic for CopyDeclarationDialog.xaml
/// </summary>
public partial class CopyDeclarationDialog : EditWindowBase
{
private bool _isOK = false;
public CopyDeclarationDialog()
{
InitializeComponent();
Loaded += CopyDeclarationDialog_Loaded;
}
private void CopyDeclarationDialog_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
this.OKClicked += VisitIdDialog_OKClicked;
List<KeyValuePair<bsmd.database.Message.NSWProvider, string>> comboDataSource = new List<KeyValuePair<bsmd.database.Message.NSWProvider, string>>()
{
new KeyValuePair<bsmd.database.Message.NSWProvider, string>( Message.NSWProvider.DBH, "DBH live" ),
new KeyValuePair<bsmd.database.Message.NSWProvider, string>( Message.NSWProvider.DBH_TEST, "DBH Testsystem" ),
new KeyValuePair<bsmd.database.Message.NSWProvider, string>( Message.NSWProvider.DUDR, "HIS-Nord live" ),
new KeyValuePair<bsmd.database.Message.NSWProvider, string>( Message.NSWProvider.DUDR_TEST, "HIS-Nord Testsystem" )
};
this.comboBoxInitialHIS.ItemsSource = comboDataSource;
this.comboBoxInitialHIS.SelectedIndex = 2;
this.EnableOK(false);
this.locodePoC.PropertyChanged += LocodePoC_PropertyChanged;
if (!this.OldCore.IMO.IsNullOrEmpty()) this.doubleUpDownIMO.Value = Double.Parse(this.OldCore.IMO);
if (!this.OldCore.ENI.IsNullOrEmpty()) this.doubleUpDownENI.Value = Double.Parse(this.OldCore.ENI);
if (!this.OldCore.PoC.IsNullOrEmpty()) this.locodePoC.LocodeValue = this.OldCore.PoC;
if (this.OldCore.ETA.HasValue) this.datePickerETA.SelectedDate = this.OldCore.ETA;
}
#region Properties
public MessageCore OldCore { get; set; }
public MessageCore NewCore { get; set; }
public bool IsOK { get { return this._isOK; } }
#endregion
#region completion logic
private void CheckComplete()
{
bool isComplete = true;
isComplete &= this.datePickerETA.SelectedDate.HasValue; // ETA
bool imo_OR_eni = ((doubleUpDownIMO.Value.HasValue) && (doubleUpDownIMO.Value >= 1000000) && (doubleUpDownIMO.Value <= 9999999)) ||
((doubleUpDownENI.Value.HasValue) && (doubleUpDownENI.Value >= 100000) && (doubleUpDownENI.Value <= 99999999));
isComplete &= imo_OR_eni;
string locode = this.locodePoC.LocodeValue;
bool validLocode = (locode != null) && (locode.Length == 5) && (locode.StartsWith("DE") || locode.StartsWith("DK") || locode.Equals("ZZNOK"));
isComplete &= validLocode;
isComplete &= (comboBoxInitialHIS.SelectedValue != null);
this.EnableOK(isComplete);
}
#endregion
#region event handler
private void LocodePoC_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
this.CheckComplete();
}
private void doubleUpDownIMO_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<object> e)
{
bool hasValue = (doubleUpDownIMO.Value.HasValue && doubleUpDownIMO.Value > 0);
doubleUpDownENI.IsReadOnly = hasValue;
this.CheckComplete();
}
private void doubleUpDownENI_ValueChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<object> e)
{
bool hasValue = (doubleUpDownENI.Value.HasValue && doubleUpDownENI.Value > 0);
doubleUpDownIMO.IsReadOnly = hasValue;
this.CheckComplete();
}
private void datePickerETA_SelectedDateChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
this.CheckComplete();
}
private void comboBoxInitialHIS_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
this.CheckComplete();
}
private void textBoxVisitTransitId_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
this.CheckComplete();
}
private void VisitIdDialog_OKClicked()
{
if (this.locodePoC.LocodeValue == "ZZNOK")
{
this.NewCore.IsTransit = true;
this.NewCore.ETAKielCanal = this.datePickerETA.SelectedDate;
}
else
{
this.NewCore.IsTransit = false;
this.NewCore.ETA = this.datePickerETA.SelectedDate;
}
if (this.doubleUpDownIMO.Value.HasValue)
this.NewCore.IMO = this.doubleUpDownIMO.Value.Value.ToString("0000000");
if (this.doubleUpDownENI.Value.HasValue)
this.NewCore.ENI = this.doubleUpDownENI.Value.Value.ToString("00000000");
this.NewCore.PoC = this.locodePoC.LocodeValue;
this.NewCore.Portname = LocodeDB.PortNameFromLocode(this.NewCore.PoC);
this.NewCore.InitialHIS = (Message.NSWProvider)this.comboBoxInitialHIS.SelectedValue;
this._isOK = true;
}
#endregion
}
}

View File

@ -21,9 +21,9 @@
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textPortCall}" />
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textATAPortOfCall}" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="{x:Static p:Resources.textCrewMemberJoinTheShip}" TextWrapping="Wrap" FontSize="11"/>
<TextBlock Grid.Row="3" Grid.Column="0" Text="{x:Static p:Resources.textCrewMembersJoined}" TextWrapping="Wrap"/>
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textATDPortOfCall}" />
<TextBlock Grid.Row="2" Grid.Column="0" Text="{x:Static p:Resources.textCrewMemberJoinTheShip}" TextWrapping="Wrap" FontSize="11" Margin="5,0,0,0"/>
<TextBlock Grid.Row="3" Grid.Column="0" Text="{x:Static p:Resources.textCrewMembersJoined}" TextWrapping="Wrap" Margin="5,0,0,0"/>
<enictrl:LocodeControl Grid.Column="1" Grid.Row="0" x:Name="locodeControlPortName" />
<DatePicker Name="datePickerATAPortOfCall" Grid.Column="1" Grid.Row="1" Margin="2"/>
<CheckBox Name="checkBoxCrewMembersJoined" VerticalContentAlignment="Center" Grid.Column="1" Grid.Row="2" />

View File

@ -8,7 +8,7 @@
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textNewWithId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize">
Title="{x:Static p:Resources.textNewWithId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2;component/Resources/id_card_add.ico">
<Grid Margin="4">
<Grid.RowDefinitions>

View File

@ -8,7 +8,7 @@
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textNewVisitTransitId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize">
Title="{x:Static p:Resources.textNewVisitTransitId}" Height="220" Width="350" WindowStyle="SingleBorderWindow" Background="AliceBlue" ResizeMode="NoResize" Icon="/ENI2;component/Resources/id_card_new.ico">
<Grid Margin="4">
<Grid.RowDefinitions>
<RowDefinition Height="28" />

View File

@ -125,6 +125,10 @@ namespace ENI2
this._dbWatchDog.Register(aMessageCore);
drc.HighlightReset += Drc_HighlightReset;
drc.OpenNewCoreRequested += (core) =>
{
this.AnmeldungenControl_MessageCoreSelected(core);
};
}
else

View File

@ -430,6 +430,36 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
public static System.Drawing.Icon id_card_add {
get {
object obj = ResourceManager.GetObject("id_card_add", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
public static System.Drawing.Icon id_card_new {
get {
object obj = ResourceManager.GetObject("id_card_new", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
public static System.Drawing.Icon id_cards {
get {
object obj = ResourceManager.GetObject("id_cards", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -1391,6 +1421,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Copy declaration.
/// </summary>
public static string textCopyDeclaration {
get {
return ResourceManager.GetString("textCopyDeclaration", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copy to HAZD.
/// </summary>

View File

@ -1624,4 +1624,16 @@
<data name="textLimitCallNumbers" xml:space="preserve">
<value>(1 per row, 5 numbers max)</value>
</data>
<data name="textCopyDeclaration" xml:space="preserve">
<value>Copy declaration</value>
</data>
<data name="id_cards" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\id_cards.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="id_card_add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\id_card_add.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="id_card_new" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\id_card_new.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

View File

@ -170,6 +170,22 @@ namespace bsmd.database
#endregion
#region Clone implementation
public override object Clone()
{
BPOL bpol = this.MemberwiseClone() as BPOL;
bpol.id = null;
bpol.poi = new ObservableCollection<DatabaseEntity>();
foreach (PortOfItinerary po in this.PortOfItineraries)
bpol.PortOfItineraries.Add(po.Clone() as PortOfItinerary);
return bpol;
}
#endregion
}
}

View File

@ -18,7 +18,7 @@ using System.Text.RegularExpressions;
namespace bsmd.database
{
public abstract class DatabaseEntity : IMessageParagraph, IEquatable<DatabaseEntity>
public abstract class DatabaseEntity : IMessageParagraph, IEquatable<DatabaseEntity>, ICloneable
{
protected Guid? id;
protected string tablename;
@ -349,5 +349,16 @@ namespace bsmd.database
#endregion
#region ICloneable implementation
public virtual object Clone()
{
DatabaseEntity entity = this.MemberwiseClone() as DatabaseEntity;
entity.id = null;
return entity;
}
#endregion
}
}

View File

@ -10,13 +10,14 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.SqlClient;
using System.Reflection;
namespace bsmd.database
{
public class HAZ : DatabaseEntity, ISublistContainer
{
#region Fields
private ObservableCollection<DatabaseEntity> imdgPositions = new ObservableCollection<DatabaseEntity>();
private ObservableCollection<DatabaseEntity> ibcPositions = new ObservableCollection<DatabaseEntity>();
private ObservableCollection<DatabaseEntity> igcPositions = new ObservableCollection<DatabaseEntity>();
@ -24,6 +25,8 @@ namespace bsmd.database
private ObservableCollection<DatabaseEntity> marpolPositions = new ObservableCollection<DatabaseEntity>();
private bool _isDeparture;
#endregion
public HAZ()
{ }
@ -115,7 +118,6 @@ namespace bsmd.database
#region DatabaseEntity implementation
public override string Tablename
{
get
@ -424,6 +426,12 @@ namespace bsmd.database
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
{
if (this.NoDPGOnBoardOnArrival ?? false)
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "No DPG on board set!", null, this.Title, null, this.Tablename));
}
if (this.GetValidationBlock() == ValidationBlock.BLOCK2)
{
/*
@ -465,5 +473,32 @@ namespace bsmd.database
#endregion
#region IClone implementation
public override object Clone()
{
HAZ haz = this.MemberwiseClone() as HAZ;
haz.id = null;
haz.imdgPositions = new ObservableCollection<DatabaseEntity>();
haz.ibcPositions = new ObservableCollection<DatabaseEntity>();
haz.igcPositions = new ObservableCollection<DatabaseEntity>();
haz.imsbcPositions = new ObservableCollection<DatabaseEntity>();
haz.marpolPositions = new ObservableCollection<DatabaseEntity>();
foreach (IMDGPosition imdgPosition in this.IMDGPositions)
haz.IMDGPositions.Add(imdgPosition.Clone() as IMDGPosition);
foreach (IGCPosition igcPosition in this.IGCPositions)
haz.IGCPositions.Add(igcPosition.Clone() as IGCPosition);
foreach (IBCPosition ibcPosition in this.IBCPositions)
haz.IBCPositions.Add(ibcPosition.Clone() as IBCPosition);
foreach (IMSBCPosition imsbcPosition in this.IMSBCPositions)
haz.IMSBCPositions.Add(imsbcPosition.Clone() as IMSBCPosition);
foreach (MARPOL_Annex_I_Position marpolPosition in this.MARPOLPositions)
haz.MARPOLPositions.Add(marpolPosition.Clone() as MARPOL_Annex_I_Position);
return haz;
}
#endregion
}
}

View File

@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Reflection;
using System.Text.RegularExpressions;
namespace bsmd.database
{
@ -256,8 +257,10 @@ namespace bsmd.database
if(!this.Flashpoint_CEL.IsNullOrEmpty())
{
double flashVal;
if (!Double.TryParse(this.Flashpoint_CEL, out flashVal))
string pattern = @"^[<>]?\-?[0-9]+(\.[0-9]+)?$";
Regex regex = new Regex(pattern);
if(!regex.IsMatch(this.Flashpoint_CEL))
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "Flashpoint_CEL", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
}

View File

@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Text.RegularExpressions;
namespace bsmd.database
{
@ -446,16 +447,28 @@ namespace bsmd.database
(this.Volume_MTQ.HasValue && this.Volume_MTQ.Value > 100))
violations.Add(RuleEngine.CreateViolation(ValidationCode.V809, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
foreach (SubsidiaryRisks sr in this.SubsidiaryRiskList)
RuleEngine.ValidateProperties(sr, errors, violations);
if (!this.Flashpoint_CEL.IsNullOrEmpty())
{
double flashVal;
if (!Double.TryParse(this.Flashpoint_CEL, out flashVal))
string pattern = @"^[<>]?\-?[0-9]+(\.[0-9]+)?$";
Regex regex = new Regex(pattern);
if (!regex.IsMatch(this.Flashpoint_CEL))
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "Flashpoint_CEL", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
}
if(!this.IMOClass.IsNullOrEmpty())
{
string pattern = @"^[1-9]{1}(\.[1-9]{1}([A-Z]{1})?)?$";
Regex regex = new Regex(pattern);
if (!regex.IsMatch(this.IMOClass))
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "IMOClass", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
}
}
#endregion
@ -504,5 +517,20 @@ namespace bsmd.database
#endregion
#region IClone implementation
public override object Clone()
{
IMDGPosition imdg = this.MemberwiseClone() as IMDGPosition;
imdg.id = null;
imdg.subsidiaryRisksList = new List<SubsidiaryRisks>();
foreach (SubsidiaryRisks sr in this.SubsidiaryRiskList)
imdg.SubsidiaryRiskList.Add(sr.Clone() as SubsidiaryRisks);
return imdg;
}
#endregion
}
}

View File

@ -171,15 +171,11 @@ namespace bsmd.database
#region Validate
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
{
bool locationInsufficient = this.PortFacilityPortLoCode.IsNullOrEmpty() &&
!(!this.PortFacilityPortName.IsNullOrEmpty() && !this.PortFacilityPortCountry.IsNullOrEmpty());
{
if (locationInsufficient)
{
string val = string.Format("LoCode:{0} Port:{1} Country:{2}", this.PortFacilityPortLoCode ?? "", this.PortFacilityPortName ?? "",
this.PortFacilityPortCountry ?? "");
violations.Add(RuleEngine.CreateViolation(ValidationCode.V703, null, val, this.Title, this.Identifier, this.SEC.Tablename));
if (this.PortFacilityPortLoCode.IsNullOrEmpty())
{
errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "PortFacilityPortLocode", null, this.Title, this.Identifier, this.SEC.Tablename));
}
if(!this.PortFacilityPortLoCode.IsNullOrEmpty() && (RuleEngine.LocodeChecker != null))

View File

@ -11,6 +11,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
namespace bsmd.database
{
@ -182,9 +183,11 @@ namespace bsmd.database
this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
if (!this.Flashpoint_CEL.IsNullOrEmpty())
{
double flashVal;
if (!Double.TryParse(this.Flashpoint_CEL, out flashVal))
{
string pattern = @"^[<>]?\-?[0-9]+(\.[0-9]+)?$";
Regex regex = new Regex(pattern);
if (!regex.IsMatch(this.Flashpoint_CEL))
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "Flashpoint_CEL", null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
}

View File

@ -564,5 +564,33 @@ namespace bsmd.database
#endregion
#region ICloneable implementation
public override object Clone()
{
MDH mdh = this.MemberwiseClone() as MDH;
mdh.id = null;
mdh.infectedAreas = new ObservableCollection<DatabaseEntity>();
mdh.portOfCallLast30Days = new ObservableCollection<DatabaseEntity>();
mdh.sanitaryMeasuresDetails = new ObservableCollection<DatabaseEntity>();
mdh.stowawaysJoiningLocations = new ObservableCollection<DatabaseEntity>();
foreach (InfectedArea ia in this.InfectedAreas)
mdh.InfectedAreas.Add(ia.Clone() as InfectedArea);
foreach (PortOfCallLast30Days poc in this.PortOfCallLast30Days)
mdh.PortOfCallLast30Days.Add(poc.Clone() as PortOfCallLast30Days);
foreach (SanitaryMeasuresDetail smd in this.sanitaryMeasuresDetails)
mdh.SanitaryMeasuresDetails.Add(smd.Clone() as SanitaryMeasuresDetail);
foreach (StowawaysJoiningLocation sjl in this.StowawaysJoiningLocations)
mdh.StowawaysJoiningLocations.Add(sjl.Clone() as StowawaysJoiningLocation);
return mdh;
}
#endregion
}
}

View File

@ -831,5 +831,25 @@ namespace bsmd.database
#endregion
#region IClonable implementation
public override object Clone()
{
// hier gibt es kein Memberwise Clone, weil die meisten Felder zurück gesetzt werden
Message root = new Message();
root.MessageNotificationClass = this.MessageNotificationClass;
root.InternalStatus = BSMDStatus.PREPARE;
foreach (DatabaseEntity databaseEntity in this.Elements)
{
DatabaseEntity clonedElement = databaseEntity.Clone() as DatabaseEntity;
clonedElement.MessageHeader = root;
root.Elements.Add(clonedElement);
}
return root;
}
#endregion
}
}

View File

@ -304,5 +304,21 @@ namespace bsmd.database
#endregion
#region ICloneable implementation
public override object Clone()
{
NOA_NOD noanod = this.MemberwiseClone() as NOA_NOD;
noanod.id = null;
noanod.callPurposes = new ObservableCollection<DatabaseEntity>();
foreach (CallPurpose cp in this.CallPurposes)
noanod.CallPurposes.Add(cp.Clone() as CallPurpose);
return noanod;
}
#endregion
}
}

View File

@ -266,5 +266,21 @@ namespace bsmd.database
#endregion
#region ICloneable implementation
public override object Clone()
{
PortOfCallLast30Days p30 = this.MemberwiseClone() as PortOfCallLast30Days;
p30.id = null;
p30.poc30Crew = new List<DatabaseEntity>();
foreach (PortOfCallLast30DaysCrewJoinedShip p30Crew in this.CrewJoinedShip)
p30.CrewJoinedShip.Add(p30Crew.Clone() as PortOfCallLast30DaysCrewJoinedShip);
return p30;
}
#endregion
}
}

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("schick Informatik")]
[assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("5.0.2")]
[assembly: AssemblyInformationalVersion("5.0.3")]
[assembly: AssemblyCopyright("Copyright © 2014-2018 schick Informatik")]
[assembly: AssemblyTrademark("")]

View File

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

View File

@ -417,5 +417,26 @@ namespace bsmd.database
#endregion
#region ICloneable implementation
public override object Clone()
{
SEC sec = this.MemberwiseClone() as SEC;
sec.id = null;
sec.lsts = new ObservableCollection<DatabaseEntity>();
sec.ltpfc = new ObservableCollection<DatabaseEntity>();
foreach (LastTenPortFacilitiesCalled ltp in this.LastTenPortFacilitesCalled)
sec.LastTenPortFacilitesCalled.Add(ltp.Clone() as bsmd.database.LastTenPortFacilitiesCalled);
foreach (ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s in this.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)
sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(s2s.Clone() as bsmd.database.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled);
return sec;
}
#endregion
}
}

View File

@ -440,5 +440,26 @@ namespace bsmd.database
#endregion
#region ICloneable implementation
public override object Clone()
{
WAS was = this.MemberwiseClone() as WAS;
was.id = null;
was.waste = new ObservableCollection<DatabaseEntity>();
was.wdsp = new ObservableCollection<DatabaseEntity>();
foreach (Waste waste in this.Waste)
was.Waste.Add(waste.Clone() as Waste);
foreach (WasteDisposalServiceProvider wdsp in this.WasteDisposalServiceProvider)
was.WasteDisposalServiceProvider.Add(wdsp.Clone() as WasteDisposalServiceProvider);
return was;
}
#endregion
}
}

View File

@ -429,6 +429,8 @@ namespace bsmd.dbh
lastTen.PortFacilityShipSecurityLevel = lastTenPortFacilitiesCalled.PortFacilityShipSecurityLevel.Value;
lastTen.PortFacilitySecurityMattersToReport = lastTenPortFacilitiesCalled.PortFacilitySecurityMattersToReport;
lastTen.PortFacilityGISISCode = lastTenPortFacilitiesCalled.PortFacilityGISISCode;
if (!lastTenPortFacilitiesCalled.PortFacilityGISISCodeLocode.IsNullOrEmpty())
lastTen.PortFacilityGISISCodeLoCode = lastTenPortFacilitiesCalled.PortFacilityGISISCodeLocode;
}
for (int i = 0; i < sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Count; i++)

View File

@ -928,6 +928,8 @@ namespace bsmd.hisnord
if(!l10Called.PortFacilitySecurityMattersToReport.IsNullOrEmpty())
hn_last10port.PortFacilitySecurityMattersToReport = l10Called.PortFacilitySecurityMattersToReport;
hn_last10port.PortFacilityGISISCode = l10Called.PortFacilityGISISCode;
if(!l10Called.PortFacilityGISISCodeLocode.IsNullOrEmpty())
hn_last10port.PortFacilityGISISCodeLoCode = l10Called.PortFacilityGISISCodeLocode;
secItemNames.Add(ItemsChoiceType4.LastTenPortFacilitiesCalled);
secItems.Add(hn_last10port);