Korrekturen warnings und Validierung
This commit is contained in:
parent
fff9d05290
commit
1e0dbb8c8c
@ -15,6 +15,8 @@ using ENI2.Util;
|
|||||||
|
|
||||||
using ENI2.EditControls;
|
using ENI2.EditControls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using Microsoft.Office.Interop.Excel;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace ENI2
|
namespace ENI2
|
||||||
{
|
{
|
||||||
@ -163,7 +165,7 @@ namespace ENI2
|
|||||||
_messages.AddRange(missingMessages);
|
_messages.AddRange(missingMessages);
|
||||||
|
|
||||||
BindingOperations.EnableCollectionSynchronization(_messages, this.messageListLock);
|
BindingOperations.EnableCollectionSynchronization(_messages, this.messageListLock);
|
||||||
Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages.SelectedIndex = 0));
|
Dispatcher.BeginInvoke((System.Action)(() => this.listBoxMessages.SelectedIndex = 0));
|
||||||
|
|
||||||
RoutedCommand saveCmd = new RoutedCommand();
|
RoutedCommand saveCmd = new RoutedCommand();
|
||||||
saveCmd.InputGestures.Add(new KeyGesture(Key.S, ModifierKeys.Control));
|
saveCmd.InputGestures.Add(new KeyGesture(Key.S, ModifierKeys.Control));
|
||||||
@ -190,7 +192,7 @@ namespace ENI2
|
|||||||
public void CoreChanged(MessageCore newCore)
|
public void CoreChanged(MessageCore newCore)
|
||||||
{
|
{
|
||||||
this.Core = newCore;
|
this.Core = newCore;
|
||||||
Application.Current.Dispatcher.Invoke(delegate
|
System.Windows.Application.Current.Dispatcher.Invoke(delegate
|
||||||
{
|
{
|
||||||
if(controlCache.ContainsKey(Properties.Resources.textOverview))
|
if(controlCache.ContainsKey(Properties.Resources.textOverview))
|
||||||
{
|
{
|
||||||
@ -429,7 +431,7 @@ namespace ENI2
|
|||||||
this.controlCache.Clear();
|
this.controlCache.Clear();
|
||||||
|
|
||||||
// return to "new" overview
|
// return to "new" overview
|
||||||
Dispatcher.BeginInvoke((Action)(() => this.listBoxMessages_SelectionChanged(this, null)));
|
Dispatcher.BeginInvoke((System.Action)(() => this.listBoxMessages_SelectionChanged(this, null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DetailControl_ResetControlCache(string messageGroupName)
|
private void DetailControl_ResetControlCache(string messageGroupName)
|
||||||
@ -607,7 +609,7 @@ namespace ENI2
|
|||||||
this.controlCache.Clear();
|
this.controlCache.Clear();
|
||||||
|
|
||||||
// return to "new" overviewdan
|
// return to "new" overviewdan
|
||||||
Dispatcher.BeginInvoke((Action)(() =>
|
Dispatcher.BeginInvoke((System.Action)(() =>
|
||||||
{
|
{
|
||||||
this.listBoxMessages_SelectionChanged(this, null);
|
this.listBoxMessages_SelectionChanged(this, null);
|
||||||
shipNameLabel.Text = this.Core.Shipname;
|
shipNameLabel.Text = this.Core.Shipname;
|
||||||
@ -778,20 +780,8 @@ namespace ENI2
|
|||||||
bool crewaIsSchengen = crewaFirst.NotificationSchengen ?? false;
|
bool crewaIsSchengen = crewaFirst.NotificationSchengen ?? false;
|
||||||
if (!((crewaFirst.NotificationPAX ?? false) || crewaIsSchengen)) // mindestens eins der beiden
|
if (!((crewaFirst.NotificationPAX ?? false) || crewaIsSchengen)) // mindestens eins der beiden
|
||||||
{
|
{
|
||||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V181, "Wrong selection", null, "CREWA", null, "CREWA");
|
vErrors.Add(RuleEngine.CreateError(ValidationCode.V181, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "CREWA")); ;
|
||||||
mv.MessageGroupName = Properties.Resources.textOverview;
|
}
|
||||||
vViolations.Add(mv);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach(CREW crewa in crewaMessage.Elements)
|
|
||||||
{
|
|
||||||
if(crewaIsSchengen && !crewa.HasSchengenDetails)
|
|
||||||
{
|
|
||||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V182, "No Schengen details", null, "CREWA", crewa.Identifier, "CREWA");
|
|
||||||
mv.MessageGroupName = Properties.Resources.textOverview;
|
|
||||||
vViolations.Add(mv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crewdMessage != null)
|
if (crewdMessage != null)
|
||||||
@ -802,20 +792,8 @@ namespace ENI2
|
|||||||
bool crewdIsSchengen = crewdFirst.NotificationSchengen ?? false;
|
bool crewdIsSchengen = crewdFirst.NotificationSchengen ?? false;
|
||||||
if (!((crewdFirst.NotificationPAX ?? false) || crewdIsSchengen)) // mindestens eins der beiden
|
if (!((crewdFirst.NotificationPAX ?? false) || crewdIsSchengen)) // mindestens eins der beiden
|
||||||
{
|
{
|
||||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V181, "Wrong selection", null, "CREWD", null, "CREWD");
|
vErrors.Add(RuleEngine.CreateError(ValidationCode.V181, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "CREWD")); ;
|
||||||
mv.MessageGroupName = Properties.Resources.textOverview;
|
}
|
||||||
vViolations.Add(mv);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (CREWD crewd in crewdMessage.Elements)
|
|
||||||
{
|
|
||||||
if (crewdIsSchengen && !crewd.HasSchengenDetails)
|
|
||||||
{
|
|
||||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V182, "No Schengen details", null, "CREWD", crewd.Identifier, "CREWD");
|
|
||||||
mv.MessageGroupName = Properties.Resources.textOverview;
|
|
||||||
vViolations.Add(mv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -826,26 +804,8 @@ namespace ENI2
|
|||||||
bool pasIsPAX = pasFirst.NotificationPAX ?? false;
|
bool pasIsPAX = pasFirst.NotificationPAX ?? false;
|
||||||
if (!(pasIsPAX || pasIsSchengen)) // mindestens eins der beiden
|
if (!(pasIsPAX || pasIsSchengen)) // mindestens eins der beiden
|
||||||
{
|
{
|
||||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V201, "Wrong selection", null, "PASA", null, "PASA");
|
vErrors.Add(RuleEngine.CreateError (ValidationCode.V201, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "PASA"));
|
||||||
mv.MessageGroupName = Properties.Resources.textOverview;
|
}
|
||||||
vViolations.Add(mv);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (PAS pasa in pasaMessage.Elements)
|
|
||||||
{
|
|
||||||
if (pasIsSchengen && !pasa.HasSchengenDetails)
|
|
||||||
{
|
|
||||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V202, "No Schengen details", null, "PASA", pasa.Identifier, "PASA");
|
|
||||||
mv.MessageGroupName = Properties.Resources.textOverview;
|
|
||||||
vViolations.Add(mv);
|
|
||||||
}
|
|
||||||
if(pasIsPAX && !pasa.HasPAXDetails)
|
|
||||||
{
|
|
||||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V203, "No PAX details", null, "PASA", pasa.Identifier, "PASA");
|
|
||||||
mv.MessageGroupName = Properties.Resources.textOverview;
|
|
||||||
vViolations.Add(mv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pasdMessage != null)
|
if (pasdMessage != null)
|
||||||
@ -857,26 +817,8 @@ namespace ENI2
|
|||||||
bool pasdIsPAX = pasdFirst.NotificationPAX ?? false;
|
bool pasdIsPAX = pasdFirst.NotificationPAX ?? false;
|
||||||
if (!(pasdIsPAX || pasdIsSchengen)) // mindestens eins der beiden
|
if (!(pasdIsPAX || pasdIsSchengen)) // mindestens eins der beiden
|
||||||
{
|
{
|
||||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V201, "Wrong selection", null, "PASD", null, "PASD");
|
vErrors.Add(RuleEngine.CreateError(ValidationCode.V201, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "PASD"));
|
||||||
mv.MessageGroupName = Properties.Resources.textOverview;
|
}
|
||||||
vViolations.Add(mv);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (PASD pasd in pasdMessage.Elements)
|
|
||||||
{
|
|
||||||
if (pasdIsSchengen && !pasd.HasSchengenDetails)
|
|
||||||
{
|
|
||||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V202, "No Schengen details", null, "PASD", pasd.Identifier, "PASD");
|
|
||||||
mv.MessageGroupName = Properties.Resources.textOverview;
|
|
||||||
vViolations.Add(mv);
|
|
||||||
}
|
|
||||||
if (pasdIsPAX && !pasd.HasPAXDetails)
|
|
||||||
{
|
|
||||||
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.V203, "No PAX details", null, "PASD", pasd.Identifier, "PASD");
|
|
||||||
mv.MessageGroupName = Properties.Resources.textOverview;
|
|
||||||
vViolations.Add(mv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -942,7 +884,7 @@ namespace ENI2
|
|||||||
|
|
||||||
Dictionary<string, string> identDict = new Dictionary<string, string>();
|
Dictionary<string, string> identDict = new Dictionary<string, string>();
|
||||||
|
|
||||||
foreach (WAS_RCPT was_rcpt in was_rcptMessage.Elements)
|
foreach (WAS_RCPT was_rcpt in was_rcptMessage.Elements.Cast<WAS_RCPT>())
|
||||||
{
|
{
|
||||||
if (!was_rcpt.IdentificationNumber.IsNullOrEmpty())
|
if (!was_rcpt.IdentificationNumber.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -516,8 +516,7 @@ namespace ENI2.DetailViewControls
|
|||||||
this.DataGridPassengerListDeparture_CreateRequested();
|
this.DataGridPassengerListDeparture_CreateRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region crew grid arrival
|
#region crew grid arrival
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ using System;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace bsmd.database
|
namespace bsmd.database
|
||||||
{
|
{
|
||||||
@ -281,53 +282,52 @@ namespace bsmd.database
|
|||||||
if (this.CrewMemberIdentityDocumentType.HasValue)
|
if (this.CrewMemberIdentityDocumentType.HasValue)
|
||||||
{
|
{
|
||||||
if (this.CrewMemberIdentityDocumentType.Value == 5)
|
if (this.CrewMemberIdentityDocumentType.Value == 5)
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Doc. type set to OTHER_LEGAL_IDENTITY_DOCUMENT", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Doc. type set to OTHER_LEGAL_IDENTITY_DOCUMENT", null, this.Title, this.Identifier, this.IsDeparture ? "CREWD" : "CREWA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.CrewMemberIdentityDocumentIssuingState != null)
|
if (this.CrewMemberIdentityDocumentIssuingState != null)
|
||||||
{
|
{
|
||||||
if (this.CrewMemberIdentityDocumentIssuingState.Equals("XX"))
|
if (this.CrewMemberIdentityDocumentIssuingState.Equals("XX"))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Id. doc issuing state set to XX", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Id. doc issuing state set to XX", null, this.Title, this.Identifier, this.IsDeparture ? "CREWD" : "CREWA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.CrewMemberNationality != null)
|
if (this.CrewMemberNationality != null)
|
||||||
{
|
{
|
||||||
if (this.CrewMemberNationality.Equals("XX"))
|
if (this.CrewMemberNationality.Equals("XX"))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Nationality set to XX", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Nationality set to XX", null, this.Title, this.Identifier, this.IsDeparture ? "CREWD" : "CREWA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.CrewMemberIdentityDocumentExpiryDate.HasValue)
|
if (this.CrewMemberIdentityDocumentExpiryDate.HasValue)
|
||||||
{
|
{
|
||||||
if (this.CrewMemberIdentityDocumentExpiryDate.Equals(new DateTime(2100, 12, 31)))
|
if (this.CrewMemberIdentityDocumentExpiryDate.Equals(new DateTime(2100, 12, 31)))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Id doc expiry date set to 31/12/2100", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Id doc expiry date set to 31/12/2100", null, this.Title, this.Identifier, this.IsDeparture ? "CREWD" : "CREWA"));
|
||||||
|
|
||||||
if ((this.CrewMemberIdentityDocumentExpiryDate >= CLAMPMAXDATE) || (this.CrewMemberIdentityDocumentExpiryDate <= CLAMPMINDATE))
|
if ((this.CrewMemberIdentityDocumentExpiryDate >= CLAMPMAXDATE) || (this.CrewMemberIdentityDocumentExpiryDate <= CLAMPMINDATE))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Check id doc expiry date", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Check id doc expiry date", null, this.Title, this.Identifier, this.IsDeparture ? "CREWD" : "CREWA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.CrewMemberGender.HasValue)
|
if (this.CrewMemberGender.HasValue)
|
||||||
{
|
{
|
||||||
if (this.CrewMemberGender == 0)
|
if (this.CrewMemberGender == 0)
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gender set to unknown", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gender set to unknown", null, this.Title, this.Identifier, this.IsDeparture ? "CREWD" : "CREWA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.CrewMemberDateOfBirth.HasValue && (this.CrewMemberDateOfBirth.Value > DateTime.Today))
|
if (this.CrewMemberDateOfBirth.HasValue && (this.CrewMemberDateOfBirth.Value > DateTime.Today))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of birth is in the future", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of birth is in the future", null, this.Title, this.Identifier, this.IsDeparture ? "CREWD" : "CREWA"));
|
||||||
|
|
||||||
if (this.CrewMemberDateOfBirth.HasValue && (this.CrewMemberDateOfBirth.Value <= CLAMPMINDATE))
|
if (this.CrewMemberDateOfBirth.HasValue && (this.CrewMemberDateOfBirth.Value <= CLAMPMINDATE))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check date of birth", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check date of birth", null, this.Title, this.Identifier, this.IsDeparture ? "CREWD" : "CREWA"));
|
||||||
|
|
||||||
// NSW 7.2 rules
|
// NSW 7.2 rules
|
||||||
|
|
||||||
if(!((this.NotificationPAX ?? false) || (this.NotificationSchengen ?? false)))
|
if((this.NotificationSchengen ?? false) && (!this.HasSchengenDetails))
|
||||||
{
|
{
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V181, "Pax / Schengen", null, this.Title, null, this.Tablename));
|
errors.Add(RuleEngine.CreateError(ValidationCode.V182, "Schengen flag set but no data", null, this.Title, null, this.IsDeparture ? "CREWD" : "CREWA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(((this.NotificationSchengen ?? false) && (!this.HasSchengenDetails)) ||
|
if (!(this.NotificationSchengen ?? false) && (this.HasSchengenDetails))
|
||||||
((!(this.NotificationSchengen ?? false)) && this.HasSchengenDetails))
|
|
||||||
{
|
{
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V182, "Schengen", null, this.Title, null, this.Tablename));
|
errors.Add(RuleEngine.CreateError(ValidationCode.V182, "Schengen data given but flag not set", null, this.Title, null, this.IsDeparture ? "CREWD" : "CREWA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -360,7 +360,7 @@ namespace bsmd.database
|
|||||||
result.Columns.Add(new DataColumn { ColumnName = "CrewMemberCountryOfBirth", DataType = typeof(string), AllowDBNull = true });
|
result.Columns.Add(new DataColumn { ColumnName = "CrewMemberCountryOfBirth", DataType = typeof(string), AllowDBNull = true });
|
||||||
result.Columns.Add(new DataColumn { ColumnName = "Effects", DataType = typeof(string), AllowDBNull = true });
|
result.Columns.Add(new DataColumn { ColumnName = "Effects", DataType = typeof(string), AllowDBNull = true });
|
||||||
|
|
||||||
foreach (CREW crew in databaseEntities)
|
foreach (CREW crew in databaseEntities.Cast<CREW>())
|
||||||
{
|
{
|
||||||
DataRow row = result.NewRow();
|
DataRow row = result.NewRow();
|
||||||
row[0] = crew.MessageHeader.Id;
|
row[0] = crew.MessageHeader.Id;
|
||||||
|
|||||||
@ -17,6 +17,7 @@ using log4net;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace bsmd.database
|
namespace bsmd.database
|
||||||
{
|
{
|
||||||
@ -142,7 +143,7 @@ namespace bsmd.database
|
|||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
|
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
|
||||||
List<MessageCore> result = new List<MessageCore>();
|
List<MessageCore> result = new List<MessageCore>();
|
||||||
foreach (MessageCore core in cores)
|
foreach (MessageCore core in cores.Cast<MessageCore>())
|
||||||
{
|
{
|
||||||
this.LoadCustomer(core);
|
this.LoadCustomer(core);
|
||||||
result.Add(core);
|
result.Add(core);
|
||||||
@ -162,7 +163,7 @@ namespace bsmd.database
|
|||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
|
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
|
||||||
List<MessageCore> result = new List<MessageCore>();
|
List<MessageCore> result = new List<MessageCore>();
|
||||||
foreach (MessageCore core in cores)
|
foreach (MessageCore core in cores.Cast<MessageCore>())
|
||||||
{
|
{
|
||||||
this.LoadCustomer(core);
|
this.LoadCustomer(core);
|
||||||
result.Add(core);
|
result.Add(core);
|
||||||
@ -182,7 +183,7 @@ namespace bsmd.database
|
|||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
|
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
|
||||||
List<MessageCore> result = new List<MessageCore>();
|
List<MessageCore> result = new List<MessageCore>();
|
||||||
foreach (MessageCore core in cores)
|
foreach (MessageCore core in cores.Cast<MessageCore>())
|
||||||
{
|
{
|
||||||
|
|
||||||
this.LoadCustomer(core);
|
this.LoadCustomer(core);
|
||||||
@ -204,7 +205,7 @@ namespace bsmd.database
|
|||||||
ih.PrepareLoadCommand(cmd, Message.LoadFilter.BY_CORE, messageCoreId);
|
ih.PrepareLoadCommand(cmd, Message.LoadFilter.BY_CORE, messageCoreId);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<ImportHeader> result = new List<ImportHeader>();
|
List<ImportHeader> result = new List<ImportHeader>();
|
||||||
foreach (ImportHeader existingHeader in ih.LoadList(reader))
|
foreach (ImportHeader existingHeader in ih.LoadList(reader).Cast<ImportHeader>())
|
||||||
result.Add(existingHeader);
|
result.Add(existingHeader);
|
||||||
|
|
||||||
if (this._closeConnectionAfterUse) this.Disconnect();
|
if (this._closeConnectionAfterUse) this.Disconnect();
|
||||||
@ -219,7 +220,7 @@ namespace bsmd.database
|
|||||||
iv.PrepareLoadCommand(cmd, Message.LoadFilter.IMPORTHEADER_ID, importHeader.Id.Value);
|
iv.PrepareLoadCommand(cmd, Message.LoadFilter.IMPORTHEADER_ID, importHeader.Id.Value);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<ImportValue> result = new List<ImportValue>();
|
List<ImportValue> result = new List<ImportValue>();
|
||||||
foreach (ImportValue existingValue in iv.LoadList(reader))
|
foreach (ImportValue existingValue in iv.LoadList(reader).Cast<ImportValue>())
|
||||||
result.Add(existingValue);
|
result.Add(existingValue);
|
||||||
|
|
||||||
if (this._closeConnectionAfterUse) this.Disconnect();
|
if (this._closeConnectionAfterUse) this.Disconnect();
|
||||||
@ -239,7 +240,7 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
|
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
|
||||||
|
|
||||||
foreach (MessageCore core in cores)
|
foreach (MessageCore core in cores.Cast<MessageCore>())
|
||||||
{
|
{
|
||||||
this.LoadCustomer(core);
|
this.LoadCustomer(core);
|
||||||
result.Add(core);
|
result.Add(core);
|
||||||
@ -261,7 +262,7 @@ namespace bsmd.database
|
|||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
if (reader != null)
|
if (reader != null)
|
||||||
{
|
{
|
||||||
foreach (MessageCore core in aMessageCore.LoadList(reader))
|
foreach (MessageCore core in aMessageCore.LoadList(reader).Cast<MessageCore>())
|
||||||
result.Add(core);
|
result.Add(core);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -292,7 +293,7 @@ namespace bsmd.database
|
|||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
|
List<DatabaseEntity> cores = aMessageCore.LoadList(reader);
|
||||||
List<MessageCore> result = new List<MessageCore>();
|
List<MessageCore> result = new List<MessageCore>();
|
||||||
foreach (MessageCore core in cores)
|
foreach (MessageCore core in cores.Cast<MessageCore>())
|
||||||
{
|
{
|
||||||
this.LoadCustomer(core);
|
this.LoadCustomer(core);
|
||||||
this.LoadSTATShipName(core);
|
this.LoadSTATShipName(core);
|
||||||
@ -355,7 +356,7 @@ namespace bsmd.database
|
|||||||
List<DatabaseEntity> messages = aMessage.LoadList(reader);
|
List<DatabaseEntity> messages = aMessage.LoadList(reader);
|
||||||
|
|
||||||
List<Message> messageList = new List<Message>();
|
List<Message> messageList = new List<Message>();
|
||||||
foreach (Message message in messages)
|
foreach (Message message in messages.Cast<Message>())
|
||||||
{
|
{
|
||||||
message.MessageCore = core;
|
message.MessageCore = core;
|
||||||
messageList.Add(message);
|
messageList.Add(message);
|
||||||
@ -413,7 +414,7 @@ namespace bsmd.database
|
|||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> reportingParties = aRep.LoadList(reader);
|
List<DatabaseEntity> reportingParties = aRep.LoadList(reader);
|
||||||
DBManager.allReportingParties = new Dictionary<Guid, ReportingParty>();
|
DBManager.allReportingParties = new Dictionary<Guid, ReportingParty>();
|
||||||
foreach (ReportingParty rp in reportingParties)
|
foreach (ReportingParty rp in reportingParties.Cast<ReportingParty>())
|
||||||
DBManager.allReportingParties.Add(rp.Id.Value, rp);
|
DBManager.allReportingParties.Add(rp.Id.Value, rp);
|
||||||
}
|
}
|
||||||
return DBManager.allReportingParties;
|
return DBManager.allReportingParties;
|
||||||
@ -427,7 +428,7 @@ namespace bsmd.database
|
|||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> allRules = vr.LoadList(reader);
|
List<DatabaseEntity> allRules = vr.LoadList(reader);
|
||||||
List<ValidationRule> result = new List<ValidationRule>();
|
List<ValidationRule> result = new List<ValidationRule>();
|
||||||
foreach (ValidationRule aVR in allRules)
|
foreach (ValidationRule aVR in allRules.Cast<ValidationRule>())
|
||||||
result.Add(aVR);
|
result.Add(aVR);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -443,7 +444,7 @@ namespace bsmd.database
|
|||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> portAreas = pa.LoadList(reader);
|
List<DatabaseEntity> portAreas = pa.LoadList(reader);
|
||||||
DBManager.allPortAreas = new Dictionary<string, PortArea>();
|
DBManager.allPortAreas = new Dictionary<string, PortArea>();
|
||||||
foreach (PortArea aPa in portAreas)
|
foreach (PortArea aPa in portAreas.Cast<PortArea>())
|
||||||
DBManager.allPortAreas[aPa.Code] = aPa; // TODO da gibt es doppelte Einträge
|
DBManager.allPortAreas[aPa.Code] = aPa; // TODO da gibt es doppelte Einträge
|
||||||
}
|
}
|
||||||
return DBManager.allPortAreas;
|
return DBManager.allPortAreas;
|
||||||
@ -460,7 +461,7 @@ namespace bsmd.database
|
|||||||
List<DatabaseEntity> messages = aMessage.LoadList(reader);
|
List<DatabaseEntity> messages = aMessage.LoadList(reader);
|
||||||
|
|
||||||
List<Message> messageList = new List<Message>();
|
List<Message> messageList = new List<Message>();
|
||||||
foreach (Message message in messages)
|
foreach (Message message in messages.Cast<Message>())
|
||||||
messageList.Add(message);
|
messageList.Add(message);
|
||||||
|
|
||||||
if (messageList.Count == 0) return null;
|
if (messageList.Count == 0) return null;
|
||||||
@ -483,7 +484,7 @@ namespace bsmd.database
|
|||||||
List<DatabaseEntity> messages = aMessage.LoadList(reader);
|
List<DatabaseEntity> messages = aMessage.LoadList(reader);
|
||||||
|
|
||||||
List<Message> messageList = new List<Message>();
|
List<Message> messageList = new List<Message>();
|
||||||
foreach (Message message in messages)
|
foreach (Message message in messages.Cast<Message>())
|
||||||
messageList.Add(message);
|
messageList.Add(message);
|
||||||
|
|
||||||
if (messageList.Count == 0) return null;
|
if (messageList.Count == 0) return null;
|
||||||
@ -756,7 +757,7 @@ namespace bsmd.database
|
|||||||
agnt_template.PrepareLoadCommand(cmd, Message.LoadFilter.ALL);
|
agnt_template.PrepareLoadCommand(cmd, Message.LoadFilter.ALL);
|
||||||
IDataReader reader = this.PerformCommand(cmd);
|
IDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> a_list = agnt_template.LoadList(reader);
|
List<DatabaseEntity> a_list = agnt_template.LoadList(reader);
|
||||||
foreach (AGNT_Template aTemplate in a_list)
|
foreach (AGNT_Template aTemplate in a_list.Cast<AGNT_Template>())
|
||||||
result.Add(aTemplate);
|
result.Add(aTemplate);
|
||||||
reader.Close();
|
reader.Close();
|
||||||
}
|
}
|
||||||
@ -1041,7 +1042,7 @@ namespace bsmd.database
|
|||||||
poi.PrepareLoadCommand(cmd, Message.LoadFilter.BPOL_ID, bpol.Id);
|
poi.PrepareLoadCommand(cmd, Message.LoadFilter.BPOL_ID, bpol.Id);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> pois = poi.LoadList(reader);
|
List<DatabaseEntity> pois = poi.LoadList(reader);
|
||||||
foreach (PortOfItinerary aPoi in pois)
|
foreach (PortOfItinerary aPoi in pois.Cast<PortOfItinerary>())
|
||||||
{
|
{
|
||||||
bpol.PortOfItineraries.Add(aPoi);
|
bpol.PortOfItineraries.Add(aPoi);
|
||||||
aPoi.BPOL = bpol;
|
aPoi.BPOL = bpol;
|
||||||
@ -1061,7 +1062,7 @@ namespace bsmd.database
|
|||||||
imdg.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
|
imdg.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> imdgs = imdg.LoadList(reader);
|
List<DatabaseEntity> imdgs = imdg.LoadList(reader);
|
||||||
foreach (IMDGPosition imdgPosition in imdgs)
|
foreach (IMDGPosition imdgPosition in imdgs.Cast<IMDGPosition>())
|
||||||
{
|
{
|
||||||
haz.IMDGPositions.Add(imdgPosition);
|
haz.IMDGPositions.Add(imdgPosition);
|
||||||
imdgPosition.HAZ = haz;
|
imdgPosition.HAZ = haz;
|
||||||
@ -1072,7 +1073,7 @@ namespace bsmd.database
|
|||||||
subsidiaryRisks.PrepareLoadCommand(srCmd, Message.LoadFilter.IMDG_ID, imdgPosition.Id);
|
subsidiaryRisks.PrepareLoadCommand(srCmd, Message.LoadFilter.IMDG_ID, imdgPosition.Id);
|
||||||
SqlDataReader srReader = this.PerformCommand(srCmd);
|
SqlDataReader srReader = this.PerformCommand(srCmd);
|
||||||
List<DatabaseEntity> sRisks = subsidiaryRisks.LoadList(srReader);
|
List<DatabaseEntity> sRisks = subsidiaryRisks.LoadList(srReader);
|
||||||
foreach (SubsidiaryRisks subsidiaryRisk in sRisks)
|
foreach (SubsidiaryRisks subsidiaryRisk in sRisks.Cast<SubsidiaryRisks>())
|
||||||
{
|
{
|
||||||
imdgPosition.SubsidiaryRiskList.Add(subsidiaryRisk);
|
imdgPosition.SubsidiaryRiskList.Add(subsidiaryRisk);
|
||||||
subsidiaryRisk.IMDGPosition = imdgPosition;
|
subsidiaryRisk.IMDGPosition = imdgPosition;
|
||||||
@ -1085,7 +1086,7 @@ namespace bsmd.database
|
|||||||
ibc.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
|
ibc.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
|
||||||
reader = this.PerformCommand(cmd);
|
reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> ibcs = ibc.LoadList(reader);
|
List<DatabaseEntity> ibcs = ibc.LoadList(reader);
|
||||||
foreach (IBCPosition ibcPosition in ibcs)
|
foreach (IBCPosition ibcPosition in ibcs.Cast<IBCPosition>())
|
||||||
{
|
{
|
||||||
haz.IBCPositions.Add(ibcPosition);
|
haz.IBCPositions.Add(ibcPosition);
|
||||||
ibcPosition.HAZ = haz;
|
ibcPosition.HAZ = haz;
|
||||||
@ -1097,7 +1098,7 @@ namespace bsmd.database
|
|||||||
igc.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
|
igc.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
|
||||||
reader = this.PerformCommand(cmd);
|
reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> igcs = igc.LoadList(reader);
|
List<DatabaseEntity> igcs = igc.LoadList(reader);
|
||||||
foreach (IGCPosition igcPosition in igcs)
|
foreach (IGCPosition igcPosition in igcs.Cast<IGCPosition>())
|
||||||
{
|
{
|
||||||
haz.IGCPositions.Add(igcPosition);
|
haz.IGCPositions.Add(igcPosition);
|
||||||
igcPosition.HAZ = haz;
|
igcPosition.HAZ = haz;
|
||||||
@ -1109,7 +1110,7 @@ namespace bsmd.database
|
|||||||
imsbc.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
|
imsbc.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
|
||||||
reader = this.PerformCommand(cmd);
|
reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> imsbcs = imsbc.LoadList(reader);
|
List<DatabaseEntity> imsbcs = imsbc.LoadList(reader);
|
||||||
foreach (IMSBCPosition imsbcPosition in imsbcs)
|
foreach (IMSBCPosition imsbcPosition in imsbcs.Cast<IMSBCPosition>())
|
||||||
{
|
{
|
||||||
haz.IMSBCPositions.Add(imsbcPosition);
|
haz.IMSBCPositions.Add(imsbcPosition);
|
||||||
imsbcPosition.HAZ = haz;
|
imsbcPosition.HAZ = haz;
|
||||||
@ -1120,7 +1121,7 @@ namespace bsmd.database
|
|||||||
marpol.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
|
marpol.PrepareLoadCommand(cmd, Message.LoadFilter.HAZ_ID, haz.Id);
|
||||||
reader = this.PerformCommand(cmd);
|
reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> marpols = marpol.LoadList(reader);
|
List<DatabaseEntity> marpols = marpol.LoadList(reader);
|
||||||
foreach (MARPOL_Annex_I_Position marpolPosition in marpols)
|
foreach (MARPOL_Annex_I_Position marpolPosition in marpols.Cast<MARPOL_Annex_I_Position>())
|
||||||
{
|
{
|
||||||
haz.MARPOLPositions.Add(marpolPosition);
|
haz.MARPOLPositions.Add(marpolPosition);
|
||||||
marpolPosition.HAZ = haz;
|
marpolPosition.HAZ = haz;
|
||||||
@ -1140,7 +1141,7 @@ namespace bsmd.database
|
|||||||
poc30.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
poc30.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> poc30s = poc30.LoadList(reader);
|
List<DatabaseEntity> poc30s = poc30.LoadList(reader);
|
||||||
foreach (PortOfCallLast30Days apoc30 in poc30s)
|
foreach (PortOfCallLast30Days apoc30 in poc30s.Cast<PortOfCallLast30Days>())
|
||||||
{
|
{
|
||||||
mdh.PortOfCallLast30Days.Add(apoc30);
|
mdh.PortOfCallLast30Days.Add(apoc30);
|
||||||
apoc30.MDH = mdh;
|
apoc30.MDH = mdh;
|
||||||
@ -1151,7 +1152,7 @@ namespace bsmd.database
|
|||||||
smd.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
smd.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
||||||
reader = this.PerformCommand(cmd);
|
reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> smds = smd.LoadList(reader);
|
List<DatabaseEntity> smds = smd.LoadList(reader);
|
||||||
foreach(SanitaryMeasuresDetail aSmd in smds)
|
foreach(SanitaryMeasuresDetail aSmd in smds.Cast<SanitaryMeasuresDetail>())
|
||||||
{
|
{
|
||||||
mdh.SanitaryMeasuresDetails.Add(aSmd);
|
mdh.SanitaryMeasuresDetails.Add(aSmd);
|
||||||
aSmd.MDH = mdh;
|
aSmd.MDH = mdh;
|
||||||
@ -1161,7 +1162,7 @@ namespace bsmd.database
|
|||||||
sjl.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
sjl.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
||||||
reader = this.PerformCommand(cmd);
|
reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> sjls = sjl.LoadList(reader);
|
List<DatabaseEntity> sjls = sjl.LoadList(reader);
|
||||||
foreach(StowawaysJoiningLocation aSjl in sjls)
|
foreach(StowawaysJoiningLocation aSjl in sjls.Cast<StowawaysJoiningLocation>())
|
||||||
{
|
{
|
||||||
mdh.StowawaysJoiningLocations.Add(aSjl);
|
mdh.StowawaysJoiningLocations.Add(aSjl);
|
||||||
aSjl.MDH = mdh;
|
aSjl.MDH = mdh;
|
||||||
@ -1171,7 +1172,7 @@ namespace bsmd.database
|
|||||||
ia.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
ia.PrepareLoadCommand(cmd, Message.LoadFilter.MDH_ID, mdh.Id);
|
||||||
reader = this.PerformCommand(cmd);
|
reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> ias = ia.LoadList(reader);
|
List<DatabaseEntity> ias = ia.LoadList(reader);
|
||||||
foreach(InfectedArea aIa in ias)
|
foreach(InfectedArea aIa in ias.Cast<InfectedArea>())
|
||||||
{
|
{
|
||||||
mdh.InfectedAreas.Add(aIa);
|
mdh.InfectedAreas.Add(aIa);
|
||||||
aIa.MDH = mdh;
|
aIa.MDH = mdh;
|
||||||
@ -1190,7 +1191,7 @@ namespace bsmd.database
|
|||||||
poc30s.PrepareLoadCommand(cmd, Message.LoadFilter.POC30_ID, poc30.Id);
|
poc30s.PrepareLoadCommand(cmd, Message.LoadFilter.POC30_ID, poc30.Id);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> poc30Names = poc30s.LoadList(reader);
|
List<DatabaseEntity> poc30Names = poc30s.LoadList(reader);
|
||||||
foreach (PortOfCallLast30DaysCrewJoinedShip poc30Name in poc30Names)
|
foreach (PortOfCallLast30DaysCrewJoinedShip poc30Name in poc30Names.Cast<PortOfCallLast30DaysCrewJoinedShip>())
|
||||||
{
|
{
|
||||||
poc30.CrewJoinedShip.Add(poc30Name);
|
poc30.CrewJoinedShip.Add(poc30Name);
|
||||||
poc30Name.PortOfCallLast30Days = poc30;
|
poc30Name.PortOfCallLast30Days = poc30;
|
||||||
@ -1208,7 +1209,7 @@ namespace bsmd.database
|
|||||||
ltp.PrepareLoadCommand(cmd, Message.LoadFilter.SEC_ID, sec.Id);
|
ltp.PrepareLoadCommand(cmd, Message.LoadFilter.SEC_ID, sec.Id);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> ltps = ltp.LoadList(reader);
|
List<DatabaseEntity> ltps = ltp.LoadList(reader);
|
||||||
foreach (LastTenPortFacilitiesCalled altp in ltps)
|
foreach (LastTenPortFacilitiesCalled altp in ltps.Cast<LastTenPortFacilitiesCalled>())
|
||||||
{
|
{
|
||||||
sec.LastTenPortFacilitesCalled.Add(altp);
|
sec.LastTenPortFacilitesCalled.Add(altp);
|
||||||
altp.SEC = sec;
|
altp.SEC = sec;
|
||||||
@ -1219,7 +1220,7 @@ namespace bsmd.database
|
|||||||
sts.PrepareLoadCommand(cmd, Message.LoadFilter.SEC_ID, sec.Id);
|
sts.PrepareLoadCommand(cmd, Message.LoadFilter.SEC_ID, sec.Id);
|
||||||
reader = this.PerformCommand(cmd);
|
reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> stss = sts.LoadList(reader);
|
List<DatabaseEntity> stss = sts.LoadList(reader);
|
||||||
foreach (ShipToShipActivitiesDuringLastTenPortFacilitiesCalled asts in stss)
|
foreach (ShipToShipActivitiesDuringLastTenPortFacilitiesCalled asts in stss.Cast<ShipToShipActivitiesDuringLastTenPortFacilitiesCalled>())
|
||||||
{
|
{
|
||||||
sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(asts);
|
sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(asts);
|
||||||
asts.SEC = sec;
|
asts.SEC = sec;
|
||||||
@ -1238,7 +1239,7 @@ namespace bsmd.database
|
|||||||
wdsp.PrepareLoadCommand(cmd, Message.LoadFilter.WAS_ID, was.Id);
|
wdsp.PrepareLoadCommand(cmd, Message.LoadFilter.WAS_ID, was.Id);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> wdsps = wdsp.LoadList(reader);
|
List<DatabaseEntity> wdsps = wdsp.LoadList(reader);
|
||||||
foreach (WasteDisposalServiceProvider awdsp in wdsps)
|
foreach (WasteDisposalServiceProvider awdsp in wdsps.Cast<WasteDisposalServiceProvider>())
|
||||||
{
|
{
|
||||||
was.WasteDisposalServiceProvider.Add(awdsp);
|
was.WasteDisposalServiceProvider.Add(awdsp);
|
||||||
awdsp.WAS = was;
|
awdsp.WAS = was;
|
||||||
@ -1249,7 +1250,7 @@ namespace bsmd.database
|
|||||||
waste.PrepareLoadCommand(cmd, Message.LoadFilter.WAS_ID, was.Id);
|
waste.PrepareLoadCommand(cmd, Message.LoadFilter.WAS_ID, was.Id);
|
||||||
SqlDataReader reader2 = this.PerformCommand(cmd);
|
SqlDataReader reader2 = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> wastes = waste.LoadList(reader2);
|
List<DatabaseEntity> wastes = waste.LoadList(reader2);
|
||||||
foreach (Waste aWaste in wastes)
|
foreach (Waste aWaste in wastes.Cast<Waste>())
|
||||||
{
|
{
|
||||||
was.Waste.Add(aWaste);
|
was.Waste.Add(aWaste);
|
||||||
aWaste.WAS = was;
|
aWaste.WAS = was;
|
||||||
@ -1268,7 +1269,7 @@ namespace bsmd.database
|
|||||||
tfp.PrepareLoadCommand(cmd, Message.LoadFilter.WASRCPT_ID, was_rcpt.Id);
|
tfp.PrepareLoadCommand(cmd, Message.LoadFilter.WASRCPT_ID, was_rcpt.Id);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> tfps = tfp.LoadList(reader);
|
List<DatabaseEntity> tfps = tfp.LoadList(reader);
|
||||||
foreach (TreatmentFacilityProvider aTfp in tfps)
|
foreach (TreatmentFacilityProvider aTfp in tfps.Cast<TreatmentFacilityProvider>())
|
||||||
{
|
{
|
||||||
was_rcpt.TreatmentFacilityProvider.Add(aTfp);
|
was_rcpt.TreatmentFacilityProvider.Add(aTfp);
|
||||||
aTfp.WAS_RCPT = was_rcpt;
|
aTfp.WAS_RCPT = was_rcpt;
|
||||||
@ -1279,7 +1280,7 @@ namespace bsmd.database
|
|||||||
wasteReceived.PrepareLoadCommand(cmd, Message.LoadFilter.WASRCPT_ID, was_rcpt.Id);
|
wasteReceived.PrepareLoadCommand(cmd, Message.LoadFilter.WASRCPT_ID, was_rcpt.Id);
|
||||||
SqlDataReader reader2 = this.PerformCommand(cmd);
|
SqlDataReader reader2 = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> wrs = wasteReceived.LoadList(reader2);
|
List<DatabaseEntity> wrs = wasteReceived.LoadList(reader2);
|
||||||
foreach (WasteReceived awrs in wrs)
|
foreach (WasteReceived awrs in wrs.Cast<WasteReceived>())
|
||||||
{
|
{
|
||||||
was_rcpt.WasteReceived.Add(awrs);
|
was_rcpt.WasteReceived.Add(awrs);
|
||||||
awrs.WAS_RCPT = was_rcpt;
|
awrs.WAS_RCPT = was_rcpt;
|
||||||
@ -1298,7 +1299,7 @@ namespace bsmd.database
|
|||||||
cp.PrepareLoadCommand(cmd, Message.LoadFilter.NOA_NODID, noa_nod.Id);
|
cp.PrepareLoadCommand(cmd, Message.LoadFilter.NOA_NODID, noa_nod.Id);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> cps = cp.LoadList(reader);
|
List<DatabaseEntity> cps = cp.LoadList(reader);
|
||||||
foreach (CallPurpose callPurpose in cps)
|
foreach (CallPurpose callPurpose in cps.Cast<CallPurpose>())
|
||||||
{
|
{
|
||||||
noa_nod.CallPurposes.Add(callPurpose);
|
noa_nod.CallPurposes.Add(callPurpose);
|
||||||
callPurpose.NOA_NOD = noa_nod;
|
callPurpose.NOA_NOD = noa_nod;
|
||||||
@ -1334,7 +1335,7 @@ namespace bsmd.database
|
|||||||
aMessageError.PrepareLoadCommand(cmd, Message.LoadFilter.MESSAGEHEADER, message.Id);
|
aMessageError.PrepareLoadCommand(cmd, Message.LoadFilter.MESSAGEHEADER, message.Id);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> errorList = aMessageError.LoadList(reader);
|
List<DatabaseEntity> errorList = aMessageError.LoadList(reader);
|
||||||
foreach (MessageError error in errorList)
|
foreach (MessageError error in errorList.Cast<MessageError>())
|
||||||
message.ErrorList.Add(error);
|
message.ErrorList.Add(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1345,7 +1346,7 @@ namespace bsmd.database
|
|||||||
aMessageViolation.PrepareLoadCommand(cmd, Message.LoadFilter.MESSAGEHEADER, message.Id);
|
aMessageViolation.PrepareLoadCommand(cmd, Message.LoadFilter.MESSAGEHEADER, message.Id);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> violationList = aMessageViolation.LoadList(reader);
|
List<DatabaseEntity> violationList = aMessageViolation.LoadList(reader);
|
||||||
foreach (MessageViolation violation in violationList)
|
foreach (MessageViolation violation in violationList.Cast<MessageViolation>())
|
||||||
message.ViolationList.Add(violation);
|
message.ViolationList.Add(violation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1356,7 +1357,7 @@ namespace bsmd.database
|
|||||||
aSystemError.PrepareLoadCommand(cmd, Message.LoadFilter.MESSAGEHEADER, message.Id);
|
aSystemError.PrepareLoadCommand(cmd, Message.LoadFilter.MESSAGEHEADER, message.Id);
|
||||||
SqlDataReader reader = this.PerformCommand(cmd);
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
List<DatabaseEntity> systemErrorList = aSystemError.LoadList(reader);
|
List<DatabaseEntity> systemErrorList = aSystemError.LoadList(reader);
|
||||||
foreach (SystemError sError in systemErrorList)
|
foreach (SystemError sError in systemErrorList.Cast<SystemError>())
|
||||||
message.SystemErrorList.Add(sError);
|
message.SystemErrorList.Add(sError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ using System;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace bsmd.database
|
namespace bsmd.database
|
||||||
{
|
{
|
||||||
@ -323,74 +324,77 @@ namespace bsmd.database
|
|||||||
if (this.PassengerPortOfDisembarkation != null)
|
if (this.PassengerPortOfDisembarkation != null)
|
||||||
{
|
{
|
||||||
if (this.PassengerPortOfDisembarkation.Equals("ZZUKN"))
|
if (this.PassengerPortOfDisembarkation.Equals("ZZUKN"))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.NOT_NULL, "Port of disembarkation set to ZZUKN", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.NOT_NULL, "Port of disembarkation set to ZZUKN", null, this.Title, this.Identifier, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.PassengerPortOfEmbarkation != null)
|
if (this.PassengerPortOfEmbarkation != null)
|
||||||
{
|
{
|
||||||
if (this.PassengerPortOfEmbarkation.Equals("ZZUKN"))
|
if (this.PassengerPortOfEmbarkation.Equals("ZZUKN"))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.NOT_NULL, "Port of embarkation set to ZZUKN", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.NOT_NULL, "Port of embarkation set to ZZUKN", null, this.Title, this.Identifier, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.PassengerIdentityDocumentType.HasValue)
|
if(this.PassengerIdentityDocumentType.HasValue)
|
||||||
{
|
{
|
||||||
if(this.PassengerIdentityDocumentType.Value == 5)
|
if(this.PassengerIdentityDocumentType.Value == 5)
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Doc. type set to OTHER_LEGAL_IDENTITY_DOCUMENT", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Doc. type set to OTHER_LEGAL_IDENTITY_DOCUMENT", null, this.Title, this.Identifier, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.PassengerNationality != null)
|
if(this.PassengerNationality != null)
|
||||||
{
|
{
|
||||||
if (this.PassengerNationality.Equals("XX"))
|
if (this.PassengerNationality.Equals("XX"))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Nationality set to XX", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Nationality set to XX", null, this.Title, this.Identifier, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.PassengerIdentityDocumentIssuingState != null)
|
if (this.PassengerIdentityDocumentIssuingState != null)
|
||||||
{
|
{
|
||||||
if (this.PassengerIdentityDocumentIssuingState.Equals("XX"))
|
if (this.PassengerIdentityDocumentIssuingState.Equals("XX"))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Id. doc issuing state set to XX", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Id. doc issuing state set to XX", null, this.Title, this.Identifier, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.PassengerIdentityDocumentExpiryDate.HasValue)
|
if (this.PassengerIdentityDocumentExpiryDate.HasValue)
|
||||||
{
|
{
|
||||||
if(this.PassengerIdentityDocumentExpiryDate.Equals(new DateTime(2100, 12, 31)))
|
if(this.PassengerIdentityDocumentExpiryDate.Equals(new DateTime(2100, 12, 31)))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Id doc expiry date set to 31/12/2100", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Id doc expiry date set to 31/12/2100", null, this.Title, this.Identifier, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
|
|
||||||
if ((this.PassengerIdentityDocumentExpiryDate >= CREW.CLAMPMAXDATE) || (this.PassengerIdentityDocumentExpiryDate <= CREW.CLAMPMINDATE))
|
if ((this.PassengerIdentityDocumentExpiryDate >= CREW.CLAMPMAXDATE) || (this.PassengerIdentityDocumentExpiryDate <= CREW.CLAMPMINDATE))
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Check identity document expiry date", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Check identity document expiry date", null, this.Title, this.Identifier, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.PassengerGender.HasValue)
|
if(this.PassengerGender.HasValue)
|
||||||
{
|
{
|
||||||
if(this.PassengerGender == 0)
|
if(this.PassengerGender == 0)
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gender set to unknown", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gender set to unknown", null, this.Title, this.Identifier, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.PassengerDateOfBirth.HasValue)
|
if (this.PassengerDateOfBirth.HasValue)
|
||||||
{
|
{
|
||||||
if (this.PassengerDateOfBirth.Value > DateTime.Today)
|
if (this.PassengerDateOfBirth.Value > DateTime.Today)
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of birth is in the future", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of birth is in the future", null, this.Title, this.Identifier, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
|
|
||||||
if(this.PassengerDateOfBirth <= CREW.CLAMPMINDATE)
|
if(this.PassengerDateOfBirth <= CREW.CLAMPMINDATE)
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check date of birth", null, this.Title, this.Identifier, this.Tablename));
|
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check date of birth", null, this.Title, this.Identifier, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// NSW 7.2 rules
|
// NSW 7.2 rules
|
||||||
|
|
||||||
if (!((this.NotificationPAX ?? false) || (this.NotificationSchengen ?? false)))
|
if ((this.NotificationSchengen ?? false) && (!this.HasSchengenDetails))
|
||||||
{
|
{
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V201, "Pax / Schengen", null, this.Title, null, this.Tablename));
|
errors.Add(RuleEngine.CreateError(ValidationCode.V202, "Schengen flag set but no data", null, this.Title, null, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((this.NotificationSchengen ?? false) && (!this.HasSchengenDetails)) ||
|
if (!(this.NotificationSchengen ?? false) && (this.HasSchengenDetails))
|
||||||
((!(this.NotificationSchengen ?? false)) && this.HasSchengenDetails))
|
|
||||||
{
|
{
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V202, "Schengen", null, this.Title, null, this.Tablename));
|
errors.Add(RuleEngine.CreateError(ValidationCode.V202, "Schengen data given but flag not set", null, this.Title, null, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((this.NotificationPAX ?? false) && (!this.HasPAXDetails)) ||
|
if ((this.NotificationPAX ?? false) && (!this.HasPAXDetails))
|
||||||
((!(this.NotificationPAX ?? false)) && this.HasPAXDetails))
|
|
||||||
{
|
{
|
||||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.V203, "PAX", null, this.Title, null, this.Tablename));
|
errors.Add(RuleEngine.CreateError(ValidationCode.V203, "PAX flag set but no data", null, this.Title, null, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(this.NotificationPAX ?? false) && (this.HasPAXDetails))
|
||||||
|
{
|
||||||
|
errors.Add(RuleEngine.CreateError(ValidationCode.V203, "PAX data given but flag not set", null, this.Title, null, this.IsDeparture ? "PASD" : "PASA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -426,7 +430,7 @@ namespace bsmd.database
|
|||||||
result.Columns.Add(new DataColumn { ColumnName = "EmergencyContactNumber", DataType = typeof(string), AllowDBNull = true });
|
result.Columns.Add(new DataColumn { ColumnName = "EmergencyContactNumber", DataType = typeof(string), AllowDBNull = true });
|
||||||
result.Columns.Add(new DataColumn { ColumnName = "PassengerCountryOfBirth", DataType = typeof(string), AllowDBNull = true });
|
result.Columns.Add(new DataColumn { ColumnName = "PassengerCountryOfBirth", DataType = typeof(string), AllowDBNull = true });
|
||||||
|
|
||||||
foreach (PAS pas in databaseEntities)
|
foreach (PAS pas in databaseEntities.Cast<PAS>())
|
||||||
{
|
{
|
||||||
DataRow row = result.NewRow();
|
DataRow row = result.NewRow();
|
||||||
|
|
||||||
|
|||||||
@ -505,7 +505,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#region private helper
|
#region private helper
|
||||||
|
|
||||||
internal static MessageError CreateError(ValidationCode validationCode, string p, string value, string entityName,
|
public static MessageError CreateError(ValidationCode validationCode, string p, string value, string entityName,
|
||||||
string identifier = "", string notificationClass = "")
|
string identifier = "", string notificationClass = "")
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user