diff --git a/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs b/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
index 18f7f900..baa81bde 100644
--- a/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
+++ b/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs
@@ -13,6 +13,7 @@ using ENI2.Util;
using ENI2.Locode;
using ExcelDataReader;
using bsmd.database;
+using System.Windows.Media.Imaging;
namespace ENI2.DetailViewControls
{
@@ -117,7 +118,17 @@ namespace ENI2.DetailViewControls
{
this.checkBoxCrewNotificationSchengen.IsChecked = ((CREW)this._crewMessage.Elements[0]).NotificationSchengen;
this.checkBoxCrewNotificationPAX.IsChecked = ((CREW)this._crewMessage.Elements[0]).NotificationPAX;
- }
+ }
+
+ // extra menu copy to CREWD
+ {
+ this.dataGridCrewList.ContextMenu.Items.Add(new Separator());
+ MenuItem copyCREWAItem = new MenuItem();
+ copyCREWAItem.Header = Properties.Resources.textCopyToCREWD;
+ copyCREWAItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
+ copyCREWAItem.Click += CopyCREWAItem_Click;
+ this.dataGridCrewList.ContextMenu.Items.Add(copyCREWAItem);
+ }
#endregion
@@ -143,7 +154,17 @@ namespace ENI2.DetailViewControls
{
this.checkBoxCrewNotificationSchengenDeparture.IsChecked = ((CREWD)this._crewdMessage.Elements[0]).NotificationSchengen;
this.checkBoxCrewNotificationPAXDeparture.IsChecked = ((CREWD)this._crewdMessage.Elements[0]).NotificationPAX;
- }
+ }
+
+ // extra menu copy to CREWA
+ {
+ this.dataGridCrewListDeparture.ContextMenu.Items.Add(new Separator());
+ MenuItem copyCREWDItem = new MenuItem();
+ copyCREWDItem.Header = Properties.Resources.textCopyToCREWA;
+ copyCREWDItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
+ copyCREWDItem.Click += CopyCREWDItem_Click;
+ this.dataGridCrewListDeparture.ContextMenu.Items.Add(copyCREWDItem);
+ }
#endregion
@@ -169,7 +190,17 @@ namespace ENI2.DetailViewControls
{
this.checkBoxPasNotificationSchengen.IsChecked = ((PAS)this._pasMessage.Elements[0]).NotificationSchengen;
this.checkBoxPasNotificationPAX.IsChecked = ((PAS)this._pasMessage.Elements[0]).NotificationPAX;
- }
+ }
+
+ // extra menu copy to PASD
+ {
+ this.dataGridPassengerList.ContextMenu.Items.Add(new Separator());
+ MenuItem copyPASAItem = new MenuItem();
+ copyPASAItem.Header = Properties.Resources.textCopyToPASD;
+ copyPASAItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
+ copyPASAItem.Click += CopyPASAItem_Click;
+ this.dataGridPassengerList.ContextMenu.Items.Add(copyPASAItem);
+ }
#endregion
@@ -195,11 +226,93 @@ namespace ENI2.DetailViewControls
{
this.checkBoxPasNotificationSchengenDeparture.IsChecked = ((PASD)this._pasdMessage.Elements[0]).NotificationSchengen;
this.checkBoxPasNotificationPAXDeparture.IsChecked = ((PASD)this._pasdMessage.Elements[0]).NotificationPAX;
- }
+ }
+
+ // extra menu copy to PASA
+ {
+ this.dataGridPassengerListDeparture.ContextMenu.Items.Add(new Separator());
+ MenuItem copyPASDItem = new MenuItem();
+ copyPASDItem.Header = Properties.Resources.textCopyToPASA;
+ copyPASDItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
+ copyPASDItem.Click += CopyPASDItem_Click; ;
+ this.dataGridPassengerListDeparture.ContextMenu.Items.Add(copyPASDItem);
+ }
#endregion
}
+ #region Grid copy handlers
+
+ private void CopyPASDItem_Click(object sender, RoutedEventArgs e)
+ {
+ if (this.dataGridPassengerListDeparture.SelectedItems != null)
+ {
+ foreach (PASD pasd in this.dataGridPassengerListDeparture.SelectedItems)
+ {
+ PAS pasa = new PAS();
+ pasa.MessageHeader = this._pasMessage;
+ pasa.CopyFromPAS(pasd);
+ pasa.IsDeparture = false;
+ pasa.Identifier = DatabaseEntity.GetNewIdentifier(this._pasMessage.Elements);
+ this._pasMessage.Elements.Add(pasa);
+ this.SublistElementChanged(Message.NotificationClass.PASA);
+ }
+ }
+ }
+
+ private void CopyPASAItem_Click(object sender, RoutedEventArgs e)
+ {
+ if (this.dataGridPassengerList.SelectedItems != null)
+ {
+ foreach (PAS pasa in this.dataGridPassengerList.SelectedItems)
+ {
+ PASD pasd = new PASD();
+ pasd.MessageHeader = this._pasdMessage;
+ pasd.CopyFromPAS(pasa);
+ pasd.IsDeparture = true;
+ pasd.Identifier = DatabaseEntity.GetNewIdentifier(this._pasdMessage.Elements);
+ this._pasdMessage.Elements.Add(pasd);
+ this.SublistElementChanged(Message.NotificationClass.PASD);
+ }
+ }
+ }
+
+ private void CopyCREWDItem_Click(object sender, RoutedEventArgs e)
+ {
+ if (this.dataGridCrewListDeparture.SelectedItems != null)
+ {
+ foreach (CREWD crewd in this.dataGridCrewListDeparture.SelectedItems)
+ {
+ CREW crewa = new CREW();
+ crewa.MessageHeader = this._crewMessage;
+ crewa.CopyFromCREW(crewd);
+ crewa.IsDeparture = false;
+ crewa.Identifier = DatabaseEntity.GetNewIdentifier(this._crewMessage.Elements);
+ this._crewMessage.Elements.Add(crewa);
+ this.SublistElementChanged(Message.NotificationClass.CREWA);
+ }
+ }
+ }
+
+ private void CopyCREWAItem_Click(object sender, RoutedEventArgs e)
+ {
+ if(this.dataGridCrewList.SelectedItems != null)
+ {
+ foreach(CREW crewa in this.dataGridCrewList.SelectedItems)
+ {
+ CREWD crewd = new CREWD();
+ crewd.MessageHeader = this._crewdMessage;
+ crewd.CopyFromCREW(crewa);
+ crewd.IsDeparture = true;
+ crewd.Identifier = DatabaseEntity.GetNewIdentifier(this._crewdMessage.Elements);
+ this._crewdMessage.Elements.Add(crewd);
+ this.SublistElementChanged(Message.NotificationClass.CREWD);
+ }
+ }
+ }
+
+ #endregion
+
#region SetEnabled
public override void SetEnabled(bool enabled)
diff --git a/ENI2/Properties/Resources.Designer.cs b/ENI2/Properties/Resources.Designer.cs
index c7c1bba9..70934f43 100644
--- a/ENI2/Properties/Resources.Designer.cs
+++ b/ENI2/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace ENI2.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources {
@@ -1649,6 +1649,24 @@ namespace ENI2.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to Copy to CREWA.
+ ///
+ public static string textCopyToCREWA {
+ get {
+ return ResourceManager.GetString("textCopyToCREWA", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Copy to CREWD.
+ ///
+ public static string textCopyToCREWD {
+ get {
+ return ResourceManager.GetString("textCopyToCREWD", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Copy to HAZD.
///
@@ -1667,6 +1685,24 @@ namespace ENI2.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to Copy to PASA.
+ ///
+ public static string textCopyToPASA {
+ get {
+ return ResourceManager.GetString("textCopyToPASA", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Copy to PASD.
+ ///
+ public static string textCopyToPASD {
+ get {
+ return ResourceManager.GetString("textCopyToPASD", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Do you want to copy / overwrite disposal amounts using values from WAS?.
///
diff --git a/ENI2/Properties/Resources.resx b/ENI2/Properties/Resources.resx
index 61813aac..1d8a7ae4 100644
--- a/ENI2/Properties/Resources.resx
+++ b/ENI2/Properties/Resources.resx
@@ -1888,4 +1888,16 @@
Do you want to copy / overwrite disposal amounts using values from WAS?
+
+ Copy to CREWA
+
+
+ Copy to CREWD
+
+
+ Copy to PASA
+
+
+ Copy to PASD
+
\ No newline at end of file
diff --git a/bsmd.database/CREW.cs b/bsmd.database/CREW.cs
index 7e4ba5ad..fdc96ecd 100644
--- a/bsmd.database/CREW.cs
+++ b/bsmd.database/CREW.cs
@@ -371,14 +371,20 @@ namespace bsmd.database
row[3] = crew.CrewMemberPlaceOfBirth ?? (object)DBNull.Value;
row[4] = crew.CrewMemberDateOfBirth ?? (object)DBNull.Value;
row[5] = crew.CrewMemberGender ?? (object)DBNull.Value;
- row[6] = crew.CrewMemberNationality?.Substring(0,2) ?? (object)DBNull.Value;
+ if (crew.CrewMemberNationality?.Length == 2)
+ row[6] = crew.CrewMemberNationality;
+ else
+ row[6] = DBNull.Value;
row[7] = crew.CrewMemberIdentityDocumentType ?? (object)DBNull.Value;
row[8] = crew.CrewMemberIdentityDocumentId ?? (object)DBNull.Value;
row[9] = crew.CrewMemberVisaNumber ?? (object)DBNull.Value;
row[10] = crew.CrewMemberDuty ?? (object)DBNull.Value;
row[11] = crew.Identifier ?? (object)DBNull.Value;
- row[12] = crew.IsDeparture;
- row[13] = crew.CrewMemberIdentityDocumentIssuingState?.Substring(0,2) ?? (object)DBNull.Value;
+ row[12] = crew.IsDeparture;
+ if (crew.CrewMemberIdentityDocumentIssuingState?.Length == 2)
+ row[13] = crew.CrewMemberIdentityDocumentIssuingState;
+ else
+ row[13] = DBNull.Value;
row[14] = crew.CrewMemberIdentityDocumentExpiryDate ?? (object)DBNull.Value;
row[15] = crew.NotificationSchengen ?? (object)DBNull.Value;
row[16] = crew.NotificationPAX ?? (object)DBNull.Value;
@@ -393,7 +399,7 @@ namespace bsmd.database
else
row[17] = crew.CrewMemberCountryOfBirth;
}
- row[18] = crew.Effects ?? (object)DBNull.Value;
+ row[18] = crew.Effects ?? (object) DBNull.Value;
result.Rows.Add(row);
}
@@ -418,6 +424,31 @@ namespace bsmd.database
#endregion
+ #region public copy func
+
+ public void CopyFromCREW(CREW crew)
+ {
+ if (crew == null) return;
+ this.CrewMemberLastName = crew.CrewMemberLastName;
+ this.CrewMemberFirstName = crew.CrewMemberFirstName;
+ this.CrewMemberPlaceOfBirth = crew.CrewMemberPlaceOfBirth;
+ this.CrewMemberCountryOfBirth = crew.CrewMemberCountryOfBirth;
+ this.CrewMemberDateOfBirth = crew.CrewMemberDateOfBirth;
+ this.CrewMemberGender = crew.CrewMemberGender;
+ this.CrewMemberNationality = crew.CrewMemberNationality;
+ this.CrewMemberIdentityDocumentType = crew.CrewMemberIdentityDocumentType;
+ this.CrewMemberIdentityDocumentId = crew.CrewMemberIdentityDocumentId;
+ this.CrewMemberVisaNumber = crew.CrewMemberVisaNumber;
+ this.CrewMemberDuty = crew.CrewMemberDuty;
+ this.CrewMemberIdentityDocumentIssuingState = crew.CrewMemberIdentityDocumentIssuingState;
+ this.CrewMemberIdentityDocumentExpiryDate = crew.CrewMemberIdentityDocumentExpiryDate;
+ this.Effects = crew.Effects;
+ this.NotificationPAX = crew.NotificationPAX;
+ this.NotificationSchengen = crew.NotificationSchengen;
+ }
+
+ #endregion
+
}
#region CREWD
diff --git a/bsmd.database/PAS.cs b/bsmd.database/PAS.cs
index 8337dec0..e493fd67 100644
--- a/bsmd.database/PAS.cs
+++ b/bsmd.database/PAS.cs
@@ -57,7 +57,8 @@ namespace bsmd.database
[ShowReport]
[ReportDisplayName("Date of birth")]
- public string PassengerDateOfBirthDisplay {
+ public string PassengerDateOfBirthDisplay
+ {
get
{
if (this.PassengerDateOfBirth.HasValue)
@@ -86,7 +87,7 @@ namespace bsmd.database
[ShowReport]
[ReportDisplayName("Identity document type")]
- public string PassengerIdentityDocumentTypeDisplay { get { return Util.GetIdentityDocumentTypeDisplay(this.PassengerIdentityDocumentType); } }
+ public string PassengerIdentityDocumentTypeDisplay { get { return Util.GetIdentityDocumentTypeDisplay(this.PassengerIdentityDocumentType); } }
[ShowReport]
[ReportDisplayName("Identity document id")]
@@ -162,7 +163,7 @@ namespace bsmd.database
{
get
{
- return PassengerIdentityDocumentType.HasValue && !PassengerIdentityDocumentId.IsNullOrEmpty() && !PassengerIdentityDocumentIssuingState.IsNullOrEmpty() &&
+ return PassengerIdentityDocumentType.HasValue && !PassengerIdentityDocumentId.IsNullOrEmpty() && !PassengerIdentityDocumentIssuingState.IsNullOrEmpty() &&
PassengerIdentityDocumentExpiryDate.HasValue && !PassengerPortOfEmbarkation.IsNullOrEmpty() && !PassengerPortOfDisembarkation.IsNullOrEmpty();
}
}
@@ -335,13 +336,13 @@ namespace bsmd.database
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.IsDeparture ? "PASD" : "PASA"));
}
- if(this.PassengerNationality != null)
+ if (this.PassengerNationality != null)
{
if (this.PassengerNationality.Equals("XX"))
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Nationality set to XX", null, this.Title, this.Identifier, this.IsDeparture ? "PASD" : "PASA"));
@@ -355,16 +356,16 @@ namespace bsmd.database
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.IsDeparture ? "PASD" : "PASA"));
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.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.IsDeparture ? "PASD" : "PASA"));
}
@@ -373,13 +374,13 @@ namespace bsmd.database
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.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.IsDeparture ? "PASD" : "PASA"));
}
// NSW 7.2 rules
- if ((this.NotificationSchengen ?? false) && (!this.HasSchengenDetails))
+ if ((this.NotificationSchengen ?? false) && (!this.HasSchengenDetails))
{
errors.Add(RuleEngine.CreateError(ValidationCode.V202, "Schengen flag set but no data", null, this.Title, null, this.IsDeparture ? "PASD" : "PASA"));
}
@@ -483,6 +484,33 @@ namespace bsmd.database
#endregion
+ #region public copy func
+
+ public void CopyFromPAS(PAS pas)
+ {
+ if (pas == null) return;
+ this.PassengerLastName = pas.PassengerLastName;
+ this.PassengerFirstName = pas.PassengerFirstName;
+ this.PassengerPlaceOfBirth = pas.PassengerPlaceOfBirth;
+ this.PassengerDateOfBirth = pas.PassengerDateOfBirth;
+ this.PassengerGender = pas.PassengerGender;
+ this.PassengerNationality = pas.PassengerNationality;
+ this.PassengerIdentityDocumentType = pas.PassengerIdentityDocumentType;
+ this.PassengerIdentityDocumentId = pas.PassengerIdentityDocumentId;
+ this.PassengerVisaNumber = pas.PassengerVisaNumber;
+ this.PassengerPortOfEmbarkation = pas.PassengerPortOfEmbarkation;
+ this.PassengerPortOfDisembarkation = pas.PassengerPortOfDisembarkation;
+ this.PassengerInTransit = pas.PassengerInTransit;
+ this.PassengerIdentityDocumentIssuingState = pas.PassengerIdentityDocumentIssuingState;
+ this.PassengerIdentityDocumentExpiryDate = pas.PassengerIdentityDocumentExpiryDate;
+ this.NotificationSchengen = pas.NotificationSchengen;
+ this.NotificationPAX = pas.NotificationPAX;
+ this.PassengerCountryOfBirth = pas.PassengerCountryOfBirth;
+ this.EmergencyCare = pas.EmergencyCare;
+ this.EmergencyContactNumber = pas.EmergencyContactNumber;
+ }
+
+ #endregion
}
#region class PASD