Version 3.8.9 Validierung (zu Fuß)
This commit is contained in:
parent
94d3062770
commit
07b57ed259
@ -382,6 +382,8 @@ namespace ENI2
|
||||
RuleEngine ruleEngine = new RuleEngine();
|
||||
foreach (Message aMessage in _messages)
|
||||
{
|
||||
if (!aMessage.EvaluateForValidation(this.Core.IsTransit)) continue;
|
||||
|
||||
List<MessageError> errors = new List<MessageError>();
|
||||
List<MessageViolation> violations = new List<MessageViolation>();
|
||||
ruleEngine.ValidateMessage(aMessage, out errors, out violations);
|
||||
@ -455,6 +457,12 @@ namespace ENI2
|
||||
vld.Violations = this._vViolations;
|
||||
vld.Show();
|
||||
}
|
||||
|
||||
if((this._vErrors.Count == 0) && (this._vViolations.Count == 0))
|
||||
{
|
||||
MessageBox.Show(Properties.Resources.textValidationOK, Properties.Resources.textValidation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -501,8 +509,7 @@ namespace ENI2
|
||||
return Properties.Resources.textDepartureNotification;
|
||||
case Message.NotificationClass.MDH:
|
||||
return Properties.Resources.textMDH;
|
||||
case Message.NotificationClass.NOA_NOD:
|
||||
return Properties.Resources.textOverview;
|
||||
case Message.NotificationClass.NOA_NOD:
|
||||
case Message.NotificationClass.AGNT:
|
||||
return Properties.Resources.textPortCall;
|
||||
case Message.NotificationClass.NAME:
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
</GroupBox>
|
||||
<GroupBox Name="servGroupBox" Header="{x:Static p:Resources.textServ}" Grid.Row="2">
|
||||
<enictrl:ENIDataGrid x:Name="dataGridSERV" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0">
|
||||
AutoGenerateColumns="False" Margin="0,5,0,0">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textServiceName}" Binding="{Binding ServiceName, Mode=TwoWay}" IsReadOnly="True" Width="0.3*" />
|
||||
@ -80,7 +80,7 @@
|
||||
</GroupBox>
|
||||
<GroupBox Name="ladgGroupBox" Header="{x:Static p:Resources.textLadg}" Grid.Row="3">
|
||||
<enictrl:ENIDataGrid x:Name="dataGridLADG" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0">
|
||||
AutoGenerateColumns="False" Margin="0,5,0,0">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textCargoHandlingType}" Binding="{Binding CargoHandlingTypeDisplay}" IsReadOnly="True" Width="0.15*" />
|
||||
|
||||
@ -93,6 +93,10 @@ namespace ENI2.DetailViewControls
|
||||
this.dataGridShip2ShipActivities.DeleteRequested += DataGridShip2ShipActivities_DeleteRequested;
|
||||
this.dataGridShip2ShipActivities.CreateRequested += DataGridShip2ShipActivities_CreateRequested;
|
||||
|
||||
this.checkBoxSECSimplification.Checked += CheckBoxSECSimplification_Checked;
|
||||
this.checkBoxSECSimplification.Unchecked += CheckBoxSECSimplification_Checked;
|
||||
this.checkBoxKielCanalPassagePlanned.Checked += CheckBoxKielCanalPassagePlanned_Checked;
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@ -288,10 +292,7 @@ namespace ENI2.DetailViewControls
|
||||
this.RegisterCheckboxChange(this.checkBoxValidISSCOnBoard, Message.NotificationClass.SEC);
|
||||
|
||||
this.RegisterLocodeChange(this.locodePortOfCallWhereCompleteSECNotified, Message.NotificationClass.SEC);
|
||||
|
||||
this.checkBoxSECSimplification.Checked += CheckBoxSECSimplification_Checked;
|
||||
this.checkBoxSECSimplification.Unchecked += CheckBoxSECSimplification_Checked;
|
||||
this.checkBoxKielCanalPassagePlanned.Checked += CheckBoxKielCanalPassagePlanned_Checked;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
|
||||
<TextBox Name="textBoxVesselName" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding ShipName}" Margin="2" VerticalContentAlignment="Center"/>
|
||||
<ComboBox Name="comboBoxVesselType" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" SelectedValue="{Binding ShipType}" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
|
||||
<TextBox Name="textBoxCallsign" Grid.Column="4" Grid.Row="1" Text="{Binding CallSign}" Margin="2" VerticalContentAlignment="Center"/>
|
||||
<TextBox Name="textBoxCallsign" Grid.Column="4" Grid.Row="1" Text="{Binding CallSign}" Margin="2" VerticalContentAlignment="Center" MaxLength="7"/>
|
||||
<ComboBox Name="comboBoxTransportMode" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="2" Margin="2" SelectedValue="{Binding TransportMode}" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
|
||||
<ComboBox Name="comboBoxFlag" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="2" Margin="2" SelectedValue="{Binding Flag}" SelectedValuePath="Key" DisplayMemberPath="Value" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True" />
|
||||
<enictrl:LocodeControl x:Name="locodePortOfRegistry" Grid.Column="4" Grid.Row="3" Grid.ColumnSpan="2" LocodeValue="{Binding PortOfRegistry, Mode=TwoWay}" LocodeSource="NO_PORT_FLAG" />
|
||||
@ -61,7 +61,7 @@
|
||||
<Label Content="m" Grid.Column="2" Grid.Row="5" />
|
||||
<xctk:DoubleUpDown Name="doubleUpDownBeam" Grid.Column="4" Grid.Row="5" Margin="2" Value="{Binding Beam_MTR}" ShowButtonSpinner="False" TextAlignment="Left" ParsingNumberStyle="Any" FormatString="N2" />
|
||||
<Label Content="m" Grid.Column="5" Grid.Row="5" />
|
||||
<TextBox Name="textBoxMMSI" Grid.Column="1" Grid.Row="6" Margin="2" Text="{Binding MMSINumber}" VerticalContentAlignment="Center"/>
|
||||
<TextBox Name="textBoxMMSI" Grid.Column="1" Grid.Row="6" Margin="2" Text="{Binding MMSINumber}" VerticalContentAlignment="Center" MaxLength="10"/>
|
||||
<TextBox Name="textBoxInmarsatCallNumber" Grid.Column="4" Grid.ColumnSpan="2" Grid.Row="6" Margin="2" Text="{Binding InmarsatCallNumber}" VerticalContentAlignment="Center" />
|
||||
|
||||
</Grid>
|
||||
|
||||
@ -35,14 +35,14 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
private void WasteDetailControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
this.RegisterLocodeChange(this.locodeCtrlLastWastePort, Message.NotificationClass.WAS);
|
||||
this.RegisterCheckboxChange(this.checkBoxAccurateCorrectDetails, Message.NotificationClass.WAS);
|
||||
this.RegisterCheckboxChange(this.checkBoxValidExemption, Message.NotificationClass.WAS);
|
||||
this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS);
|
||||
this.RegisterComboboxIndexChange(this.comboBoxWasteDisposal, Message.NotificationClass.WAS);
|
||||
this.RegisterTextboxChange(this.textBoxWasteDisposalServiceProviders, Message.NotificationClass.WAS);
|
||||
this.checkBoxValidExemption.Checked += CheckBoxValidExemption_Checked;
|
||||
this.checkBoxValidExemption.Unchecked += CheckBoxValidExemption_Checked;
|
||||
|
||||
}
|
||||
|
||||
private void CheckBoxValidExemption_Checked(object sender, RoutedEventArgs e)
|
||||
@ -102,7 +102,8 @@ namespace ENI2.DetailViewControls
|
||||
this.dataGridWaste.DeleteRequested += DataGridWaste_DeleteRequested;
|
||||
this.dataGridWaste.CreateRequested += DataGridWaste_CreateRequested;
|
||||
|
||||
|
||||
this.checkBoxValidExemption.Checked += CheckBoxValidExemption_Checked;
|
||||
this.checkBoxValidExemption.Unchecked += CheckBoxValidExemption_Checked;
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.html</WebPage>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>3.8.8.%2a</ApplicationVersion>
|
||||
<ApplicationVersion>3.8.9.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
|
||||
@ -28,9 +28,9 @@ namespace ENI2.EditControls
|
||||
private void EditWasteDialog_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Dictionary<int, string> codeDict = new Dictionary<int, string>();
|
||||
for (int i = 0; i < WAS.DKWasteCodes.Length; i++)
|
||||
for (int i = 0; i < WAS.RequiredCodes.Length; i++)
|
||||
{
|
||||
codeDict[WAS.DKWasteCodes[i]] = string.Format("{0} - {1}", WAS.DKWasteCodes[i], WAS.DKWasteTypes[i]);
|
||||
codeDict[WAS.RequiredCodes[i]] = string.Format("{0} - {1}", WAS.RequiredCodes[i], WAS.RequiredTypes[i]);
|
||||
}
|
||||
this.comboBoxWasteCode.ItemsSource = codeDict;
|
||||
this.comboBoxWasteCode.SelectedValue = this.Waste.WasteType;
|
||||
|
||||
@ -74,9 +74,9 @@
|
||||
<Button Grid.Column="1" x:Name="buttonNewId" Content="{x:Static p:Resources.textNewVisitTransitId}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="buttonNewTransitIdClick" Background="Transparent" Margin="2"/>
|
||||
<Button Grid.Column="2" x:Name="buttonNewWithId" Content="{x:Static p:Resources.textNewWithId}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="buttonNewWithIdClick" Background="Transparent" Margin="2"/>
|
||||
<RadioButton Grid.Column="3" x:Name="buttonNotifications" Content="{x:Static p:Resources.textNotifications}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Margin="2,5,0,0" IsChecked="True" />
|
||||
<RadioButton Grid.Column="4" x:Name="buttonUserAdmin" Content="{x:Static p:Resources.textUserAdministration}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Visibility="Hidden" Margin="2,5,0,0"/>
|
||||
<RadioButton Grid.Column="5" x:Name="buttonEditRules" Content="{x:Static p:Resources.textEditRules}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Visibility="Hidden" Margin="2,5,0,0" />
|
||||
<RadioButton Grid.Column="6" x:Name="buttonStatus" Content="{x:Static p:Resources.textServerStatus}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Visibility="Hidden" Margin="2,5,0,0" />
|
||||
<RadioButton Grid.Column="4" x:Name="buttonStatus" Content="{x:Static p:Resources.textServerStatus}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Margin="2,5,0,0" />
|
||||
<RadioButton Grid.Column="5" x:Name="buttonUserAdmin" Content="{x:Static p:Resources.textUserAdministration}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Visibility="Hidden" Margin="2,5,0,0"/>
|
||||
<RadioButton Grid.Column="6" x:Name="buttonEditRules" Content="{x:Static p:Resources.textEditRules}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Click="radioButton_Click" Background="Transparent" Visibility="Hidden" Margin="2,5,0,0" />
|
||||
<Button Grid.Column="7" x:Name="buttonAbout" Content="?" HorizontalAlignment="Right" VerticalAlignment="Top" Background="Transparent" Margin="2" Padding="5,0,5,0" Click="buttonAbout_Click"/>
|
||||
</Grid>
|
||||
|
||||
|
||||
@ -510,13 +510,8 @@ namespace ENI2
|
||||
if (this.userEntity.IsAdmin)
|
||||
{
|
||||
this.buttonUserAdmin.Visibility = Visibility.Visible;
|
||||
this.buttonEditRules.Visibility = Visibility.Visible;
|
||||
this.buttonStatus.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.buttonNotifications.IsEnabled = false;
|
||||
}
|
||||
this.buttonEditRules.Visibility = Visibility.Visible;
|
||||
}
|
||||
break;
|
||||
case ReportingParty.LogonResult.FAILED:
|
||||
this.labelLoginResult.Content = Properties.Resources.textWrongPassword;
|
||||
|
||||
9
ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
generated
9
ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
generated
@ -4289,6 +4289,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to No errors or violations detected.
|
||||
/// </summary>
|
||||
public static string textValidationOK {
|
||||
get {
|
||||
return ResourceManager.GetString("textValidationOK", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Valid exemption.
|
||||
/// </summary>
|
||||
|
||||
@ -1591,4 +1591,7 @@
|
||||
<data name="textServerStatus" xml:space="preserve">
|
||||
<value>Server status</value>
|
||||
</data>
|
||||
<data name="textValidationOK" xml:space="preserve">
|
||||
<value>No errors or violations detected</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -396,7 +396,7 @@ namespace bsmd.ExcelReadService
|
||||
hazaMessage.Elements.Add(newHaza);
|
||||
}
|
||||
HAZ haza = hazaMessage.Elements[0] as HAZ;
|
||||
haza.DeleteElements();
|
||||
// haza.DeleteElements();
|
||||
|
||||
haza.NoDPGOnBoardOnArrival = !reader.ReadBoolean("HAZA.DGOnBoard");
|
||||
haza.DPGManifestOnBoardOnArrival = reader.ReadBoolean("HAZA.DPGManifestOnBoardOnArrival");
|
||||
@ -701,7 +701,7 @@ namespace bsmd.ExcelReadService
|
||||
hazdMessage.Elements.Add(newHazd);
|
||||
}
|
||||
HAZ hazd = hazdMessage.Elements[0] as HAZ;
|
||||
hazd.DeleteElements();
|
||||
// hazd.DeleteElements();
|
||||
|
||||
hazd.NoDPGOnBoardOnArrival = !reader.ReadBoolean("HAZD.DGOnBoard");
|
||||
hazd.DPGManifestOnBoardOnArrival = reader.ReadBoolean("HAZD.DPGManifestOnBoardOnDeparture");
|
||||
|
||||
@ -440,6 +440,10 @@ namespace bsmd.database
|
||||
if ((this.GeneralCargoIBC ?? false) && this.ContainerNumber.IsNullOrEmpty() && this.VehicleLicenseNumber.IsNullOrEmpty())
|
||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V808, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD": "HAZA"));
|
||||
|
||||
if((this.NetQuantity_KGM.HasValue && this.NetQuantity_KGM.Value > 100000) ||
|
||||
(this.GrossQuantity_KGM.HasValue && this.GrossQuantity_KGM.Value > 100000))
|
||||
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);
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ namespace bsmd.database
|
||||
scmd.Parameters.AddWithNullableValue("@P10", this.Remarks);
|
||||
scmd.Parameters.AddWithNullableValue("@P11", this.Identifier);
|
||||
|
||||
if(this.IsNew)
|
||||
if (this.IsNew)
|
||||
{
|
||||
scmd.CommandText = string.Format("INSERT INTO {0} (HAZId, BulkCargoShippingName, MHB, UNNumber, " +
|
||||
"IMOClass, Quantity_KGM, StowagePosition, PortOfLoading, PortOfDischarge, Remarks, Identifier) " +
|
||||
@ -184,5 +184,18 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
#region Validation
|
||||
|
||||
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||
{
|
||||
if(!MHB ?? false)
|
||||
{
|
||||
if(this.UNNumber.IsNullOrEmpty() || this.IMOClass.IsNullOrEmpty())
|
||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V803, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ namespace bsmd.database
|
||||
|
||||
[ShowReport]
|
||||
[LookupName("INFO.PortArea")]
|
||||
// [Validation(ValidationCode.NOT_NULL)] // ist bei NOK Transit leer
|
||||
[Validation(ValidationCode.NOT_NULL)] // ist bei NOK Transit leer
|
||||
[MaxLength(50)]
|
||||
[ENI2Validation]
|
||||
public string PortArea { get; set; }
|
||||
|
||||
@ -161,14 +161,14 @@ namespace bsmd.database
|
||||
|
||||
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||
{
|
||||
bool locationInsufficient = (this.PortFacilityPortLoCode.IsNullOrEmpty()) &&
|
||||
(this.PortFacilityPortName.IsNullOrEmpty() || this.PortFacilityPortCountry.IsNullOrEmpty());
|
||||
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 ?? "");
|
||||
RuleEngine.CreateViolation(ValidationCode.V703, null, val, this.Title, this.Identifier, this.SEC.Tablename);
|
||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V703, null, val, this.Title, this.Identifier, this.SEC.Tablename));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -572,6 +572,42 @@ namespace bsmd.database
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Some message classes are (currently) skipped for validation
|
||||
/// </summary>
|
||||
public bool EvaluateForValidation(bool isTransit)
|
||||
{
|
||||
|
||||
bool result = true;
|
||||
switch (this.MessageNotificationClass)
|
||||
{
|
||||
case NotificationClass.BKRD:
|
||||
case NotificationClass.PRE72H:
|
||||
case NotificationClass.TIEFD:
|
||||
case NotificationClass.NAME:
|
||||
case NotificationClass.INFO:
|
||||
case NotificationClass.ATA:
|
||||
case NotificationClass.ATD:
|
||||
case NotificationClass.LADG:
|
||||
case NotificationClass.SERV:
|
||||
case NotificationClass.WAS:
|
||||
case NotificationClass.TOWD:
|
||||
if (isTransit) result = false;
|
||||
break;
|
||||
case NotificationClass.VISIT:
|
||||
case NotificationClass.TRANSIT:
|
||||
case NotificationClass.CREWD:
|
||||
case NotificationClass.PASD:
|
||||
case NotificationClass.STO:
|
||||
result = false;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ISublistContainer implementation
|
||||
|
||||
@ -222,7 +222,7 @@ namespace bsmd.database
|
||||
(this.ETDFromPortOfCall < this.ETAToPortOfCall))
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETDFromPortOfCall", this.ETDFromPortOfCall.ToString(), this.Title, null));
|
||||
|
||||
if(this.CallPurposes.Count == 0)
|
||||
if(this.CallPurposes.IsNullOrEmpty())
|
||||
{
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.LIST_EMPTY, null, "CallPurpose", this.Title, null));
|
||||
}
|
||||
@ -238,12 +238,18 @@ namespace bsmd.database
|
||||
if((this.LastPort != null) && !this.LastPort.Equals("ZZUKN") && !this.ETDFromLastPort.HasValue)
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "ETDFromLastPort", null, this.Title, null));
|
||||
|
||||
if((this.LastPort != null) && this.LastPort.Equals("ZZUKN") && this.ETDFromLastPort.HasValue)
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "ETDFromLastPort", null, this.Title, null));
|
||||
|
||||
if (this.ETDFromPortOfCall.HasValue && this.ETAToNextPort.HasValue &&
|
||||
this.ETAToNextPort < ETDFromPortOfCall)
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETAToNextPort", null, this.Title, null));
|
||||
|
||||
if ((this.NextPort != null) && !this.NextPort.Equals("ZZUKN") && !this.ETAToNextPort.HasValue)
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "ETAToNextPort", null, this.Title, null));
|
||||
|
||||
if((this.NextPort != null) && this.NextPort.Equals("ZZUKN") && this.ETAToNextPort.HasValue)
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "ETAToNextPort", null, this.Title, null));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -125,5 +125,17 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Validation
|
||||
|
||||
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||
{
|
||||
if (((TotalCrewMembersOnBoardUponArrival ?? 0) + (TotalPassengersOnBoardUponArrival ?? 0) + (TotalStowawaysOnBoardUponArrival ?? 0)) != (TotalPersonsOnBoardUponArrival ?? 0))
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "TotalPersonsOnBoardUponArrival", null, this.Title, null));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -124,5 +124,15 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
#region Validation
|
||||
|
||||
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||
{
|
||||
if (((TotalCrewMembersOnBoardUponDeparture ?? 0) + (TotalPassengersOnBoardUponDeparture ?? 0) + (TotalStowawaysOnBoardUponDeparture ?? 0)) != (TotalPersonsOnBoardUponDeparture ?? 0))
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "TotalPersonsOnBoardUponDeparture", null, this.Title, null));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,14 +240,19 @@ namespace bsmd.database
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Validation
|
||||
|
||||
public override ValidationBlock GetValidationBlock()
|
||||
{
|
||||
return ValidationBlock.BLOCK2;
|
||||
}
|
||||
|
||||
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||
{
|
||||
if((this.PortOfCallLast30DaysCrewMembersJoined ?? false) && (this.CrewJoinedShip.Count == 0))
|
||||
RuleEngine.CreateViolation(ValidationCode.V767, "PortOfCallLast30DaysCrewMembersJoined", null, this.Title, this.Identifier, this.MDH.Tablename);
|
||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V767, "PortOfCallLast30DaysCrewMembersJoined", null, this.Title, this.Identifier, this.MDH.Tablename));
|
||||
|
||||
if (this.PortOfCallLast30DaysCrewMembersJoined ?? false)
|
||||
{
|
||||
@ -258,11 +263,6 @@ namespace bsmd.database
|
||||
}
|
||||
}
|
||||
|
||||
public override DatabaseEntity.ValidationBlock GetValidationBlock()
|
||||
{
|
||||
return ValidationBlock.BLOCK2;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ namespace bsmd.database
|
||||
[ShowReport]
|
||||
[Validation2(ValidationCode.NOT_NULL)]
|
||||
[MaxLength(255)]
|
||||
[ENI2Validation]
|
||||
[ENI2Validation]
|
||||
public string PortOfCallLast30DaysCrewJoinedShipName { get; set; }
|
||||
|
||||
public string Identifier { get; set; }
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
|
||||
[assembly: AssemblyCompany("schick Informatik")]
|
||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||
[assembly: AssemblyInformationalVersion("3.8.8")]
|
||||
[assembly: AssemblyInformationalVersion("3.8.9")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014-2017 schick Informatik")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("3.8.8.*")]
|
||||
[assembly: AssemblyVersion("3.8.9.*")]
|
||||
|
||||
|
||||
@ -265,7 +265,7 @@ namespace bsmd.database
|
||||
if (value.Length == 0) errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, property.Name, value, entity.Title, identifier, entity.Tablename));
|
||||
if (DateTime.TryParse(value, out aTime))
|
||||
{
|
||||
if ((aTime - DateTime.UtcNow).Minutes > 30)
|
||||
if ((aTime - DateTime.UtcNow).Minutes > 15)
|
||||
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
|
||||
}
|
||||
}
|
||||
|
||||
@ -345,7 +345,7 @@ namespace bsmd.database
|
||||
}
|
||||
|
||||
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||
{
|
||||
{
|
||||
|
||||
if (this.GetValidationBlock() == ValidationBlock.BLOCK1)
|
||||
{
|
||||
@ -354,23 +354,32 @@ namespace bsmd.database
|
||||
}
|
||||
else
|
||||
{
|
||||
if((!this.ValidISSCOnBoard ?? true) && this.ReasonsForNoValidISSC.IsNullOrEmpty())
|
||||
if ((!this.ValidISSCOnBoard ?? true) && this.ReasonsForNoValidISSC.IsNullOrEmpty())
|
||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V702, "ReasonsForNoValidISSC", null, this.Title, null, this.Tablename));
|
||||
|
||||
}
|
||||
if ((this.LastTenPortFacilitesCalled.Count == 0) || (this.LastTenPortFacilitesCalled.Count > 10))
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "LastTenPortFacilitiesCalled", null, this.Title, null, this.Tablename));
|
||||
|
||||
foreach (LastTenPortFacilitiesCalled L10Called in this.LastTenPortFacilitesCalled)
|
||||
{
|
||||
RuleEngine.ValidateProperties(L10Called, errors);
|
||||
L10Called.Validate(errors, violations);
|
||||
}
|
||||
if(this.KielCanalPassagePlanned ?? false)
|
||||
{
|
||||
if(!KielCanalPassagePlannedIncomming.HasValue && !KielCanalPassagePlannedOutgoing.HasValue)
|
||||
{
|
||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V706, null, null, this.Title, null, this.Tablename));
|
||||
}
|
||||
}
|
||||
|
||||
foreach(ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s in this.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)
|
||||
{
|
||||
RuleEngine.ValidateProperties(s2s, errors);
|
||||
s2s.Validate(errors, violations);
|
||||
}
|
||||
foreach (LastTenPortFacilitiesCalled L10Called in this.LastTenPortFacilitesCalled)
|
||||
{
|
||||
RuleEngine.ValidateProperties(L10Called, errors);
|
||||
L10Called.Validate(errors, violations);
|
||||
}
|
||||
|
||||
foreach (ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s in this.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)
|
||||
{
|
||||
RuleEngine.ValidateProperties(s2s, errors);
|
||||
s2s.Validate(errors, violations);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ISublistElement ISublistContainer.GetSublistElementWithIdentifier(string identifier)
|
||||
|
||||
@ -162,14 +162,25 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
#region overrides
|
||||
|
||||
public override ValidationBlock GetValidationBlock()
|
||||
{
|
||||
return ValidationBlock.BLOCK2;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Validate
|
||||
|
||||
public override void Validate(List<MessageError> errors, List<MessageViolation> violations)
|
||||
{
|
||||
|
||||
// check violation 701
|
||||
bool locationInsufficient = (this.ShipToShipActivityLocationLoCode.IsNullOrEmpty()) &&
|
||||
(!this.ShipToShipActivityLocationCoordinatesLatitude.HasValue || !this.ShipToShipActivityLocationCoordinatesLongitude.HasValue);
|
||||
bool locationInsufficient = this.ShipToShipActivityLocationLoCode.IsNullOrEmpty() &&
|
||||
this.ShipToShipActivityLocationName.IsNullOrEmpty() &&
|
||||
!(this.ShipToShipActivityLocationCoordinatesLatitude.HasValue && (this.ShipToShipActivityLocationCoordinatesLatitude.Value != 0) &&
|
||||
this.ShipToShipActivityLocationCoordinatesLongitude.HasValue && (this.ShipToShipActivityLocationCoordinatesLongitude.Value != 0));
|
||||
|
||||
if (locationInsufficient)
|
||||
{
|
||||
|
||||
@ -30,6 +30,8 @@ namespace bsmd.database
|
||||
STRING_MAXLEN,
|
||||
STRING_EXACT_LEN,
|
||||
LIST_EMPTY,
|
||||
IMPLAUSIBLE,
|
||||
POSITION_COUNT = 22,
|
||||
STRING_UNNUMBER = 23,
|
||||
STRING_IMOCLASS = 24,
|
||||
DRAUGHT_IMPLAUSIBLE = 25,
|
||||
@ -44,6 +46,7 @@ namespace bsmd.database
|
||||
V702 = 702,
|
||||
V703 = 703,
|
||||
V704 = 704,
|
||||
V706 = 706,
|
||||
V721 = 721,
|
||||
V741 = 741,
|
||||
V761 = 761,
|
||||
@ -65,6 +68,7 @@ namespace bsmd.database
|
||||
V806 = 806,
|
||||
V807 = 807,
|
||||
V808 = 808,
|
||||
V809 = 809,
|
||||
V821 = 821,
|
||||
}
|
||||
|
||||
|
||||
@ -326,7 +326,8 @@ namespace bsmd.database
|
||||
_lookupDict.Add(field, core);
|
||||
break;
|
||||
case "ReportingParty":
|
||||
_lookupDict.Add(field, DBManager.Instance.GetReportingPartyDict()[core.DefaultReportingPartyId.Value]);
|
||||
if(core.DefaultReportingPartyId.HasValue)
|
||||
_lookupDict.Add(field, DBManager.Instance.GetReportingPartyDict()[core.DefaultReportingPartyId.Value]);
|
||||
break;
|
||||
default:
|
||||
_log.WarnFormat("Unknown class type {0}", field.NotificationClassText);
|
||||
|
||||
@ -23,7 +23,9 @@ namespace bsmd.database
|
||||
private ObservableCollection<DatabaseEntity> waste = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
private static readonly int[] dkWasteCodes = { 1100, 1200, 1300, 2100, 2200, 2300, 2311, 2308, 2600, 2300, 2309, 3000, 5100, 5200, 5300, 2300 };
|
||||
private static readonly int[] requiredCodes = { 1100, 1200, 1300, 2100, 2200, 2300, 2311, 2308, 2313, 2309, 3000, 5100, 5200, 5300 };
|
||||
private static readonly string[] dkWasteTypes = { "Waste oils - Sludge", "Waste oils - Bilge water", "Waste oils - Other", "Garbage - Food waste", "Garbage - Plastic", "Garbage - Other", "Garbage - Other - Cooking oil", "Garbage - Other - Incinerator ashes and clinkers", "Operational wastes", "Garbage - Other", "Garbage - Other - Animal carcasses", "Sewage", "Cargo residues - Marpol Annex I - Other", "Cargo residues - Marpol Annex II - Other", "Cargo residues - Marpol Annex V - Other", "Garbage - Other" };
|
||||
private static readonly string[] requiredTypes = { "Oily Residues (sludge)", "Oily Bilge Water", "Waste oil - others (specify)", "Food waste", "Plastics", "Domestic wastes", "Cooking oil", "Incinerator ashes", "Operational wastes", "Animal carcass(es)", "Sewage", "Cargo residues - Marpol Annex I", "Cargo residues - Marpol Annex II", "Cargo residues - Marpol Annex V" };
|
||||
|
||||
public WAS()
|
||||
{
|
||||
@ -37,6 +39,10 @@ namespace bsmd.database
|
||||
|
||||
public static string[] DKWasteTypes { get { return dkWasteTypes; } }
|
||||
|
||||
public static int[] RequiredCodes { get { return requiredCodes; } }
|
||||
|
||||
public static string[] RequiredTypes { get { return requiredTypes; } }
|
||||
|
||||
[ShowReport]
|
||||
[ENI2Validation]
|
||||
public bool? WasteDisposalValidExemption { get; set; }
|
||||
@ -308,6 +314,34 @@ namespace bsmd.database
|
||||
RuleEngine.ValidateProperties(waste, errors);
|
||||
waste.Validate(errors, violations);
|
||||
}
|
||||
|
||||
bool entryMissing = false;
|
||||
int missingType = 0;
|
||||
|
||||
foreach(int wasteCode in requiredCodes)
|
||||
{
|
||||
bool codeFound = false;
|
||||
foreach(Waste w in this.Waste)
|
||||
{
|
||||
if((w.WasteType ?? 0) == wasteCode)
|
||||
{
|
||||
codeFound = true; break;
|
||||
}
|
||||
}
|
||||
if(!codeFound)
|
||||
{
|
||||
missingType = wasteCode;
|
||||
entryMissing = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(entryMissing)
|
||||
{
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.POSITION_COUNT, string.Format("Waste {0}", missingType), null, this.Title, null, this.Tablename));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -353,7 +387,7 @@ namespace bsmd.database
|
||||
public void AddMissingWaste()
|
||||
{
|
||||
|
||||
foreach (int wasteCode in WAS.DKWasteCodes)
|
||||
foreach (int wasteCode in WAS.requiredCodes)
|
||||
{
|
||||
Waste foundWaste = null;
|
||||
foreach (Waste waste in this.Waste)
|
||||
|
||||
@ -62,6 +62,7 @@ namespace bsmd.database
|
||||
case 2300: return "Domestic wastes";
|
||||
case 2311: return "Cooking oil";
|
||||
case 2308: return "Incinerator ashes";
|
||||
case 2313: return "Operational wastes";
|
||||
case 2600: return "Operational wastes";
|
||||
case 2309: return "Animal carcass(es)";
|
||||
case 3000: return "Sewage";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user