Copy funcs CREWA <-> CREWD, PASA <-> PASD
This commit is contained in:
parent
c3b839635b
commit
a292caa666
@ -13,6 +13,7 @@ using ENI2.Util;
|
||||
using ENI2.Locode;
|
||||
using ExcelDataReader;
|
||||
using bsmd.database;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace ENI2.DetailViewControls
|
||||
{
|
||||
@ -119,6 +120,16 @@ namespace ENI2.DetailViewControls
|
||||
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
|
||||
|
||||
#region init CREWD
|
||||
@ -145,6 +156,16 @@ namespace ENI2.DetailViewControls
|
||||
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
|
||||
|
||||
#region init PASA
|
||||
@ -171,6 +192,16 @@ namespace ENI2.DetailViewControls
|
||||
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
|
||||
|
||||
#region init PASD
|
||||
@ -197,9 +228,91 @@ namespace ENI2.DetailViewControls
|
||||
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)
|
||||
|
||||
38
ENI2/Properties/Resources.Designer.cs
generated
38
ENI2/Properties/Resources.Designer.cs
generated
@ -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 {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copy to CREWA.
|
||||
/// </summary>
|
||||
public static string textCopyToCREWA {
|
||||
get {
|
||||
return ResourceManager.GetString("textCopyToCREWA", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copy to CREWD.
|
||||
/// </summary>
|
||||
public static string textCopyToCREWD {
|
||||
get {
|
||||
return ResourceManager.GetString("textCopyToCREWD", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copy to HAZD.
|
||||
/// </summary>
|
||||
@ -1667,6 +1685,24 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copy to PASA.
|
||||
/// </summary>
|
||||
public static string textCopyToPASA {
|
||||
get {
|
||||
return ResourceManager.GetString("textCopyToPASA", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copy to PASD.
|
||||
/// </summary>
|
||||
public static string textCopyToPASD {
|
||||
get {
|
||||
return ResourceManager.GetString("textCopyToPASD", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Do you want to copy / overwrite disposal amounts using values from WAS?.
|
||||
/// </summary>
|
||||
|
||||
@ -1888,4 +1888,16 @@
|
||||
<data name="textCopyToWASConfirmation" xml:space="preserve">
|
||||
<value>Do you want to copy / overwrite disposal amounts using values from WAS?</value>
|
||||
</data>
|
||||
<data name="textCopyToCREWA" xml:space="preserve">
|
||||
<value>Copy to CREWA</value>
|
||||
</data>
|
||||
<data name="textCopyToCREWD" xml:space="preserve">
|
||||
<value>Copy to CREWD</value>
|
||||
</data>
|
||||
<data name="textCopyToPASA" xml:space="preserve">
|
||||
<value>Copy to PASA</value>
|
||||
</data>
|
||||
<data name="textCopyToPASD" xml:space="preserve">
|
||||
<value>Copy to PASD</value>
|
||||
</data>
|
||||
</root>
|
||||
@ -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;
|
||||
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
|
||||
|
||||
@ -57,7 +57,8 @@ namespace bsmd.database
|
||||
|
||||
[ShowReport]
|
||||
[ReportDisplayName("Date of birth")]
|
||||
public string PassengerDateOfBirthDisplay {
|
||||
public string PassengerDateOfBirthDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.PassengerDateOfBirth.HasValue)
|
||||
@ -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,7 +374,7 @@ 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"));
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user