3.9.5: Kleine Verbesserungen (TRUNCATE Validierung, Copy ID) und Korrekturen
This commit is contained in:
parent
7f659144b7
commit
2ee4059926
@ -178,6 +178,13 @@ namespace ENI2
|
|||||||
this._controlClassDict[textBox] = notificationClass;
|
this._controlClassDict[textBox] = notificationClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void UnregisterTextboxChange(TextBox textBox)
|
||||||
|
{
|
||||||
|
this._dpTextBox.RemoveValueChanged(textBox, this.controlContentChanged);
|
||||||
|
if (this._controlClassDict.ContainsKey(textBox))
|
||||||
|
this._controlClassDict.Remove(textBox);
|
||||||
|
}
|
||||||
|
|
||||||
protected void RegisterDateTimePickerChange(Xceed.Wpf.Toolkit.DateTimePicker dateTimePicker, Message.NotificationClass notificationClass)
|
protected void RegisterDateTimePickerChange(Xceed.Wpf.Toolkit.DateTimePicker dateTimePicker, Message.NotificationClass notificationClass)
|
||||||
{
|
{
|
||||||
this._dpDateTimePicker.AddValueChanged(dateTimePicker, this.controlContentChanged);
|
this._dpDateTimePicker.AddValueChanged(dateTimePicker, this.controlContentChanged);
|
||||||
|
|||||||
@ -377,15 +377,22 @@ namespace ENI2.DetailViewControls
|
|||||||
|
|
||||||
public void UpdateCore()
|
public void UpdateCore()
|
||||||
{
|
{
|
||||||
|
this.UnregisterTextboxChange(this.textBoxDisplayId);
|
||||||
|
|
||||||
this.textBoxDisplayId.DataContext = null;
|
this.textBoxDisplayId.DataContext = null;
|
||||||
this.textBoxDisplayId.DataContext = this.Core;
|
this.textBoxDisplayId.DataContext = this.Core;
|
||||||
this.textBoxDisplayId.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
|
this.textBoxDisplayId.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
|
||||||
|
|
||||||
|
this.RegisterTextboxChange(this.textBoxDisplayId, Message.NotificationClass.ATA);
|
||||||
|
|
||||||
this.labelBSMDStatusInternal.DataContext = null;
|
this.labelBSMDStatusInternal.DataContext = null;
|
||||||
this.labelBSMDStatusInternal.DataContext = this.Core;
|
this.labelBSMDStatusInternal.DataContext = this.Core;
|
||||||
this.labelBSMDStatusInternal.GetBindingExpression(Label.ContentProperty)?.UpdateTarget();
|
this.labelBSMDStatusInternal.GetBindingExpression(Label.ContentProperty)?.UpdateTarget();
|
||||||
|
//MessageBox.Show(string.Format("Visit/Transit ID updated: {0}", this.Core.DisplayId));
|
||||||
MessageBox.Show(string.Format("Visit/Transit ID updated: {0}", this.Core.DisplayId));
|
ShowIdDialog sid = new ShowIdDialog();
|
||||||
|
sid.DisplayId = this.Core.DisplayId;
|
||||||
|
sid.Show();
|
||||||
|
this.Core.IsDirty = false; // ist ja schon gespeichert..
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -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>1</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<ApplicationVersion>3.9.3.%2a</ApplicationVersion>
|
<ApplicationVersion>3.9.5.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
@ -308,6 +308,9 @@
|
|||||||
<Compile Include="EditControls\NewWithIdDialog.xaml.cs">
|
<Compile Include="EditControls\NewWithIdDialog.xaml.cs">
|
||||||
<DependentUpon>NewWithIdDialog.xaml</DependentUpon>
|
<DependentUpon>NewWithIdDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="EditControls\ShowIdDialog.xaml.cs">
|
||||||
|
<DependentUpon>ShowIdDialog.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="EditControls\SimplePropertyViewDialog.xaml.cs">
|
<Compile Include="EditControls\SimplePropertyViewDialog.xaml.cs">
|
||||||
<DependentUpon>SimplePropertyViewDialog.xaml</DependentUpon>
|
<DependentUpon>SimplePropertyViewDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -537,6 +540,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="EditControls\ShowIdDialog.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="EditControls\SimplePropertyViewDialog.xaml">
|
<Page Include="EditControls\SimplePropertyViewDialog.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@ -43,9 +43,9 @@ namespace ENI2.EditControls
|
|||||||
|
|
||||||
public string VisitTransitId { get { return this.textBoxVisitTransitId.Text; } }
|
public string VisitTransitId { get { return this.textBoxVisitTransitId.Text; } }
|
||||||
|
|
||||||
public string IMO { get { if (this.doubleUpDownIMO.Value.HasValue) return this.doubleUpDownIMO.Value.ToString(); else return null; } }
|
public string IMO { get { if (this.doubleUpDownIMO.Value.HasValue) return this.doubleUpDownIMO.Value.Value.ToString("0000000"); else return null; } }
|
||||||
|
|
||||||
public string ENI { get { if (this.doubleUpDownENI.Value.HasValue) return this.doubleUpDownENI.Value.ToString(); else return null; } }
|
public string ENI { get { if (this.doubleUpDownENI.Value.HasValue) return this.doubleUpDownENI.Value.Value.ToString("00000000"); else return null; } }
|
||||||
|
|
||||||
public DateTime? ETA { get { return this.datePickerETA.SelectedDate; } }
|
public DateTime? ETA { get { return this.datePickerETA.SelectedDate; } }
|
||||||
|
|
||||||
|
|||||||
22
ENI-2/ENI2/ENI2/EditControls/ShowIdDialog.xaml
Normal file
22
ENI-2/ENI2/ENI2/EditControls/ShowIdDialog.xaml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<Window x:Class="ENI2.EditControls.ShowIdDialog"
|
||||||
|
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:p="clr-namespace:ENI2.Properties"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="{x:Static p:Resources.textVisitTransitId}" Height="152" Width="300" WindowStyle="SingleBorderWindow">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Content="Id updated:" Grid.Row="0" />
|
||||||
|
<TextBox IsReadOnly="True" Name="textBoxId" MouseDown="textBoxId_MouseDown" FontWeight="Bold" HorizontalAlignment="Center" VerticalContentAlignment="Center" Margin="2" Grid.Row="1"/>
|
||||||
|
<Label Content=" -> click to copy" HorizontalAlignment="Center" Grid.Row="2" MouseDown="textBoxId_MouseDown"/>
|
||||||
|
<Button Grid.Row="3" HorizontalAlignment="Right" Content="OK" Margin="2" Width="100" Click="Button_Click" />
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
48
ENI-2/ENI2/ENI2/EditControls/ShowIdDialog.xaml.cs
Normal file
48
ENI-2/ENI2/ENI2/EditControls/ShowIdDialog.xaml.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// Copyright (c) 2017 schick Informatik
|
||||||
|
// Description: Info-Dialog wenn eine Id erhalten wird
|
||||||
|
//
|
||||||
|
|
||||||
|
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.Shapes;
|
||||||
|
|
||||||
|
namespace ENI2.EditControls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ShowIdDialog.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ShowIdDialog : Window
|
||||||
|
{
|
||||||
|
public ShowIdDialog()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DisplayId
|
||||||
|
{
|
||||||
|
set { this.textBoxId.Text = value; }
|
||||||
|
get { return this.textBoxId.Text; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textBoxId_MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
Clipboard.SetText(this.textBoxId.Text);
|
||||||
|
this.textBoxId.Background = Brushes.LightGreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -57,10 +57,10 @@ namespace ENI2.EditControls
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.doubleUpDownIMO.Value.HasValue)
|
if (this.doubleUpDownIMO.Value.HasValue)
|
||||||
this.Core.IMO = this.doubleUpDownIMO.Value.ToString();
|
this.Core.IMO = this.doubleUpDownIMO.Value.Value.ToString("0000000");
|
||||||
|
|
||||||
if (this.doubleUpDownENI.Value.HasValue)
|
if (this.doubleUpDownENI.Value.HasValue)
|
||||||
this.Core.ENI = this.doubleUpDownENI.Value.ToString();
|
this.Core.ENI = this.doubleUpDownENI.Value.Value.ToString("00000000");
|
||||||
|
|
||||||
this.Core.PoC = this.locodePoC.LocodeValue;
|
this.Core.PoC = this.locodePoC.LocodeValue;
|
||||||
this.Core.Portname = LocodeDB.PortNameFromLocode(this.Core.PoC);
|
this.Core.Portname = LocodeDB.PortNameFromLocode(this.Core.PoC);
|
||||||
|
|||||||
Binary file not shown.
@ -165,7 +165,7 @@ namespace bsmd.database
|
|||||||
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||||
{
|
{
|
||||||
foreach (PortOfItinerary poi in this.PortOfItineraries)
|
foreach (PortOfItinerary poi in this.PortOfItineraries)
|
||||||
RuleEngine.ValidateProperties(poi, errors);
|
RuleEngine.ValidateProperties(poi, errors, violations);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -330,7 +330,9 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
result = (Message) messages[0]; // es kann nur eine sein
|
result = (Message) messages[0]; // es kann nur eine sein
|
||||||
result.MessageCore = core;
|
result.MessageCore = core;
|
||||||
// TODO: abhängige Listen laden?
|
List<Message> lm = new List<Message>();
|
||||||
|
lm.Add(result);
|
||||||
|
this.LoadMessageDependencies(lm);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._closeConnectionAfterUse) this.Disconnect();
|
if (this._closeConnectionAfterUse) this.Disconnect();
|
||||||
|
|||||||
@ -434,30 +434,30 @@ namespace bsmd.database
|
|||||||
|
|
||||||
foreach (IMDGPosition imdg in this.IMDGPositions)
|
foreach (IMDGPosition imdg in this.IMDGPositions)
|
||||||
{
|
{
|
||||||
RuleEngine.ValidateProperties(imdg, errors);
|
RuleEngine.ValidateProperties(imdg, errors, violations);
|
||||||
imdg.Validate(errors, violations);
|
imdg.Validate(errors, violations);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(IBCPosition ibc in this.IBCPositions)
|
foreach(IBCPosition ibc in this.IBCPositions)
|
||||||
{
|
{
|
||||||
RuleEngine.ValidateProperties(ibc, errors);
|
RuleEngine.ValidateProperties(ibc, errors, violations);
|
||||||
ibc.Validate(errors, violations);
|
ibc.Validate(errors, violations);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(IGCPosition igc in this.IGCPositions)
|
foreach(IGCPosition igc in this.IGCPositions)
|
||||||
{
|
{
|
||||||
RuleEngine.ValidateProperties(igc, errors);
|
RuleEngine.ValidateProperties(igc, errors, violations);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(IMSBCPosition imsbc in this.IMSBCPositions)
|
foreach(IMSBCPosition imsbc in this.IMSBCPositions)
|
||||||
{
|
{
|
||||||
RuleEngine.ValidateProperties(imsbc, errors);
|
RuleEngine.ValidateProperties(imsbc, errors, violations);
|
||||||
imsbc.Validate(errors, violations);
|
imsbc.Validate(errors, violations);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(MARPOL_Annex_I_Position marpol in this.MARPOLPositions)
|
foreach(MARPOL_Annex_I_Position marpol in this.MARPOLPositions)
|
||||||
{
|
{
|
||||||
RuleEngine.ValidateProperties(marpol, errors);
|
RuleEngine.ValidateProperties(marpol, errors, violations);
|
||||||
marpol.Validate(errors, violations);
|
marpol.Validate(errors, violations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -447,7 +447,7 @@ namespace bsmd.database
|
|||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V809, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.V809, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
||||||
|
|
||||||
foreach (SubsidiaryRisks sr in this.SubsidiaryRiskList)
|
foreach (SubsidiaryRisks sr in this.SubsidiaryRiskList)
|
||||||
RuleEngine.ValidateProperties(sr, errors);
|
RuleEngine.ValidateProperties(sr, errors, violations);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -555,7 +555,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
foreach (PortOfCallLast30Days poc30d in this.portOfCallLast30Days)
|
foreach (PortOfCallLast30Days poc30d in this.portOfCallLast30Days)
|
||||||
{
|
{
|
||||||
RuleEngine.ValidateProperties(poc30d, errors);
|
RuleEngine.ValidateProperties(poc30d, errors, violations);
|
||||||
poc30d.Validate(errors, violations);
|
poc30d.Validate(errors, violations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -258,7 +258,7 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
foreach (PortOfCallLast30DaysCrewJoinedShip poc30Crew in this.CrewJoinedShip)
|
foreach (PortOfCallLast30DaysCrewJoinedShip poc30Crew in this.CrewJoinedShip)
|
||||||
{
|
{
|
||||||
RuleEngine.ValidateProperties(poc30Crew, errors);
|
RuleEngine.ValidateProperties(poc30Crew, errors, violations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
[assembly: AssemblyCompany("schick Informatik")]
|
[assembly: AssemblyCompany("schick Informatik")]
|
||||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||||
[assembly: AssemblyInformationalVersion("3.9.3")]
|
[assembly: AssemblyInformationalVersion("3.9.5")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014-2017 schick Informatik")]
|
[assembly: AssemblyCopyright("Copyright © 2014-2017 schick Informatik")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.9.3.*")]
|
[assembly: AssemblyVersion("3.9.5.*")]
|
||||||
|
|
||||||
|
|||||||
@ -134,7 +134,7 @@ namespace bsmd.database
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entity"></param>
|
/// <param name="entity"></param>
|
||||||
/// <param name="errors"></param>
|
/// <param name="errors"></param>
|
||||||
public static void ValidateProperties(DatabaseEntity entity, List<MessageError> errors)
|
public static void ValidateProperties(DatabaseEntity entity, List<MessageError> errors, List<MessageViolation> violations)
|
||||||
{
|
{
|
||||||
string identifier = null;
|
string identifier = null;
|
||||||
if (entity is ISublistElement)
|
if (entity is ISublistElement)
|
||||||
@ -186,6 +186,17 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// check for truncation warnings
|
||||||
|
if (Attribute.IsDefined(property, typeof(MaxLengthAttribute)))
|
||||||
|
{
|
||||||
|
MaxLengthAttribute mla = Attribute.GetCustomAttribute(property, typeof(MaxLengthAttribute)) as MaxLengthAttribute;
|
||||||
|
if((value.Length >= 50) && (mla.MaxLength == value.Length))
|
||||||
|
{
|
||||||
|
// put out a warning this might be truncated
|
||||||
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.TRUNCATE, property.Name, value, entity.Title, identifier, entity.Tablename));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check properties
|
// check properties
|
||||||
|
|
||||||
switch (validationCode)
|
switch (validationCode)
|
||||||
@ -195,16 +206,21 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
case ValidationCode.LOCODE:
|
case ValidationCode.LOCODE:
|
||||||
{
|
{
|
||||||
Regex rgx = new Regex("[A-Z]{2}[A-Z0-9]{3}");
|
Regex rgx = new Regex("^[A-Z]{2}[A-Z0-9]{3}$");
|
||||||
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
if (!rgx.IsMatch(value))
|
||||||
if (_locodeChecker != null)
|
{
|
||||||
|
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
||||||
|
}
|
||||||
|
else if (_locodeChecker != null)
|
||||||
|
{
|
||||||
if (!_locodeChecker(value, LocodeMode.STANDARD))
|
if (!_locodeChecker(value, LocodeMode.STANDARD))
|
||||||
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ValidationCode.LOCODE_NOPORT:
|
case ValidationCode.LOCODE_NOPORT:
|
||||||
{
|
{
|
||||||
Regex rgx = new Regex("[A-Z]{2}[A-Z0-9]{3}");
|
Regex rgx = new Regex("^[A-Z]{2}[A-Z0-9]{3}$");
|
||||||
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
||||||
if (_locodeChecker != null)
|
if (_locodeChecker != null)
|
||||||
if (!_locodeChecker(value, LocodeMode.NO_PORT_FLAG))
|
if (!_locodeChecker(value, LocodeMode.NO_PORT_FLAG))
|
||||||
@ -213,7 +229,7 @@ namespace bsmd.database
|
|||||||
break;
|
break;
|
||||||
case ValidationCode.LOCODE_SSN:
|
case ValidationCode.LOCODE_SSN:
|
||||||
{
|
{
|
||||||
Regex rgx = new Regex("[A-Z]{2}[A-Z0-9]{3}");
|
Regex rgx = new Regex("^[A-Z]{2}[A-Z0-9]{3}$");
|
||||||
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
||||||
if (_locodeChecker != null)
|
if (_locodeChecker != null)
|
||||||
if (!_locodeChecker(value, LocodeMode.SSN))
|
if (!_locodeChecker(value, LocodeMode.SSN))
|
||||||
@ -326,6 +342,13 @@ namespace bsmd.database
|
|||||||
if ((value.Length > maxlen) || (value.Length == 0))
|
if ((value.Length > maxlen) || (value.Length == 0))
|
||||||
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
||||||
break;
|
break;
|
||||||
|
case ValidationCode.FRZ:
|
||||||
|
{
|
||||||
|
Regex rgx = new Regex(@"^[A-Z, a-z,0-9]{4,7}$");
|
||||||
|
if (!rgx.IsMatch(value)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -348,7 +371,7 @@ namespace bsmd.database
|
|||||||
// individuelle Fehler nach Nachrichtenklasse prüfen
|
// individuelle Fehler nach Nachrichtenklasse prüfen
|
||||||
derivedEntity.MessageCore = aMessage.MessageCore; // some instance we need info from core (NOA / Transit)
|
derivedEntity.MessageCore = aMessage.MessageCore; // some instance we need info from core (NOA / Transit)
|
||||||
if ((derivedEntity is LADG) && aMessage.MessageCore.IsTransit) continue; // kein error reporting für LADG bei Transit (CH, 1.2.16)
|
if ((derivedEntity is LADG) && aMessage.MessageCore.IsTransit) continue; // kein error reporting für LADG bei Transit (CH, 1.2.16)
|
||||||
RuleEngine.ValidateProperties(derivedEntity, errors);
|
RuleEngine.ValidateProperties(derivedEntity, errors, violations);
|
||||||
derivedEntity.Validate(errors, violations);
|
derivedEntity.Validate(errors, violations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +396,7 @@ namespace bsmd.database
|
|||||||
// individuelle Fehler nach Nachrichtenklasse prüfen
|
// individuelle Fehler nach Nachrichtenklasse prüfen
|
||||||
derivedEntity.MessageCore = entity.MessageCore; // some instance we need info from core (NOA / Transit)
|
derivedEntity.MessageCore = entity.MessageCore; // some instance we need info from core (NOA / Transit)
|
||||||
if ((derivedEntity is LADG) && entity.MessageCore.IsTransit) continue; // kein error reporting für LADG bei Transit (CH, 1.2.16)
|
if ((derivedEntity is LADG) && entity.MessageCore.IsTransit) continue; // kein error reporting für LADG bei Transit (CH, 1.2.16)
|
||||||
RuleEngine.ValidateProperties(derivedEntity, errors);
|
RuleEngine.ValidateProperties(derivedEntity, errors, violations);
|
||||||
derivedEntity.Validate(errors, violations);
|
derivedEntity.Validate(errors, violations);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -371,13 +371,13 @@ namespace bsmd.database
|
|||||||
|
|
||||||
foreach (LastTenPortFacilitiesCalled L10Called in this.LastTenPortFacilitesCalled)
|
foreach (LastTenPortFacilitiesCalled L10Called in this.LastTenPortFacilitesCalled)
|
||||||
{
|
{
|
||||||
RuleEngine.ValidateProperties(L10Called, errors);
|
RuleEngine.ValidateProperties(L10Called, errors, violations);
|
||||||
L10Called.Validate(errors, violations);
|
L10Called.Validate(errors, violations);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s in this.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)
|
foreach (ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s in this.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)
|
||||||
{
|
{
|
||||||
RuleEngine.ValidateProperties(s2s, errors);
|
RuleEngine.ValidateProperties(s2s, errors, violations);
|
||||||
s2s.Validate(errors, violations);
|
s2s.Validate(errors, violations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ namespace bsmd.database
|
|||||||
public string ShipName { get; set; }
|
public string ShipName { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
[Validation(ValidationCode.FRZ)]
|
||||||
[MaxLength(50)]
|
[MaxLength(50)]
|
||||||
[ENI2Validation]
|
[ENI2Validation]
|
||||||
public string CallSign { get; set; }
|
public string CallSign { get; set; }
|
||||||
|
|||||||
@ -11,6 +11,7 @@ using System;
|
|||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
namespace bsmd.database
|
namespace bsmd.database
|
||||||
{
|
{
|
||||||
@ -18,6 +19,7 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
private static Regex regexVisit = new Regex("(DE)([A-Z]{3})-([0-9]{4})-([A-Z]{6})", RegexOptions.IgnoreCase);
|
private static Regex regexVisit = new Regex("(DE)([A-Z]{3})-([0-9]{4})-([A-Z]{6})", RegexOptions.IgnoreCase);
|
||||||
private static Regex regexTransit = new Regex("(ZZNOK)-([0-9]{4})-([A-Z]{6})", RegexOptions.IgnoreCase);
|
private static Regex regexTransit = new Regex("(ZZNOK)-([0-9]{4})-([A-Z]{6})", RegexOptions.IgnoreCase);
|
||||||
|
private static ILog _log = LogManager.GetLogger(typeof(Util));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extension helper to add values that can be null:
|
/// Extension helper to add values that can be null:
|
||||||
@ -127,7 +129,13 @@ namespace bsmd.database
|
|||||||
if(!existingMessages.IsNullOrEmpty())
|
if(!existingMessages.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
foreach (Message aMessage in existingMessages)
|
foreach (Message aMessage in existingMessages)
|
||||||
messageDict.Add(aMessage.MessageNotificationClass, aMessage);
|
{
|
||||||
|
if(messageDict.ContainsKey(aMessage.MessageNotificationClass))
|
||||||
|
{
|
||||||
|
_log.WarnFormat("Core {0} [{1}] has more than one message class for {2}", core.Id, core.DisplayId, aMessage.MessageNotificationClassDisplay);
|
||||||
|
}
|
||||||
|
messageDict[aMessage.MessageNotificationClass] = aMessage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDE, isDK;
|
bool isDE, isDK;
|
||||||
|
|||||||
@ -37,12 +37,14 @@ namespace bsmd.database
|
|||||||
DOT_NO_COMMA,
|
DOT_NO_COMMA,
|
||||||
VESSEL_TYPE,
|
VESSEL_TYPE,
|
||||||
NOT_NULL_MAX_LEN,
|
NOT_NULL_MAX_LEN,
|
||||||
|
FRZ,
|
||||||
POSITION_COUNT = 22,
|
POSITION_COUNT = 22,
|
||||||
STRING_UNNUMBER = 23,
|
STRING_UNNUMBER = 23,
|
||||||
STRING_IMOCLASS = 24,
|
STRING_IMOCLASS = 24,
|
||||||
DRAUGHT_IMPLAUSIBLE = 25,
|
DRAUGHT_IMPLAUSIBLE = 25,
|
||||||
TIME_IMPLAUSIBLE = 26,
|
TIME_IMPLAUSIBLE = 26,
|
||||||
PORTAREA,
|
PORTAREA,
|
||||||
|
TRUNCATE = 28,
|
||||||
E121 = 121,
|
E121 = 121,
|
||||||
E122 = 122,
|
E122 = 122,
|
||||||
E123 = 123,
|
E123 = 123,
|
||||||
|
|||||||
@ -312,10 +312,16 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
foreach (Waste waste in this.Waste)
|
foreach (Waste waste in this.Waste)
|
||||||
{
|
{
|
||||||
RuleEngine.ValidateProperties(waste, errors);
|
RuleEngine.ValidateProperties(waste, errors, violations);
|
||||||
waste.Validate(errors, violations);
|
waste.Validate(errors, violations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach(WasteDisposalServiceProvider wdsp in this.WasteDisposalServiceProvider)
|
||||||
|
{
|
||||||
|
RuleEngine.ValidateProperties(wdsp, errors, violations);
|
||||||
|
wdsp.Validate(errors, violations);
|
||||||
|
}
|
||||||
|
|
||||||
bool entryMissing = false;
|
bool entryMissing = false;
|
||||||
int missingType = 0;
|
int missingType = 0;
|
||||||
|
|
||||||
|
|||||||
@ -108,10 +108,12 @@ namespace bsmd.database
|
|||||||
[ShowReport]
|
[ShowReport]
|
||||||
[MaxLength(5)]
|
[MaxLength(5)]
|
||||||
[ENI2Validation]
|
[ENI2Validation]
|
||||||
|
[Validation(ValidationCode.LOCODE)]
|
||||||
public string WasteDisposalPort { get; set; }
|
public string WasteDisposalPort { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[ENI2Validation]
|
[ENI2Validation]
|
||||||
|
[Validation(ValidationCode.NOT_NULL)]
|
||||||
public double? WasteAmountGeneratedTillNextPort_MTQ { get; set; }
|
public double? WasteAmountGeneratedTillNextPort_MTQ { get; set; }
|
||||||
|
|
||||||
[ENI2Validation]
|
[ENI2Validation]
|
||||||
|
|||||||
@ -27,8 +27,9 @@ namespace bsmd.database
|
|||||||
public WAS WAS { get; set; }
|
public WAS WAS { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[MaxLength(100)]
|
[MaxLength(99)]
|
||||||
[ENI2Validation]
|
[ENI2Validation]
|
||||||
|
[Validation(ValidationCode.STRING_MAXLEN, 99)]
|
||||||
public string WasteDisposalServiceProviderName { get; set; }
|
public string WasteDisposalServiceProviderName { get; set; }
|
||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user