95 lines
5.2 KiB
C#
95 lines
5.2 KiB
C#
// Copyright (c) 2017 schick Informatik
|
|
// Description: PAS Bearbeitungsdialog
|
|
//
|
|
|
|
using System.Windows;
|
|
|
|
using bsmd.database;
|
|
using ENI2.Controls;
|
|
using ENI2.Util;
|
|
|
|
namespace ENI2.EditControls
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for EditPasDialog.xaml
|
|
/// </summary>
|
|
public partial class EditPASDialog : EditWindowBase
|
|
{
|
|
public EditPASDialog()
|
|
{
|
|
InitializeComponent();
|
|
Loaded += EditPasDialog_Loaded;
|
|
AddClicked += () => { this.textBoxLastName.Focus(); };
|
|
}
|
|
|
|
public PAS PAS { get; set; }
|
|
|
|
private void EditPasDialog_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
// copy into fields
|
|
this.textBoxLastName.Text = this.PAS.PassengerLastName;
|
|
this.textBoxFirstName.Text = this.PAS.PassengerFirstName;
|
|
this.comboBoxGender.ItemsSource = GlobalStructures.GenderList;
|
|
//this.comboBoxGender.KeyUp += ComboBox_KeyUp;
|
|
this.comboBoxGender.SelectedIndex = this.PAS.PassengerGender ?? -1;
|
|
if (this.PAS.PassengerGender == 9)
|
|
this.comboBoxGender.SelectedIndex = 3;
|
|
this.textBoxPlaceOfBirth.Text = this.PAS.PassengerPlaceOfBirth;
|
|
this.comboBoxNationality.ItemsSource = bsmd.database.CREW.NationalityDict;
|
|
//this.comboBoxNationality.KeyUp += ComboBox_KeyUp;
|
|
this.comboBoxNationality.SelectedValue = this.PAS.PassengerNationality;
|
|
this.datePickerDateOfBirth.SelectedDate = this.PAS.PassengerDateOfBirth;
|
|
this.comboBoxIdDocType.ItemsSource = GlobalStructures.IDDocTypeList;
|
|
//this.comboBoxIdDocType.KeyUp += ComboBox_KeyUp;
|
|
this.comboBoxIdDocType.SelectedIndex = this.PAS.PassengerIdentityDocumentType ?? -1;
|
|
this.textBoxIdDocNumber.Text = this.PAS.PassengerIdentityDocumentId;
|
|
this.textBoxVisaNumber.Text = this.PAS.PassengerVisaNumber;
|
|
this.locodePortOfEmbarkation.LocodeValue = this.PAS.PassengerPortOfEmbarkation;
|
|
this.locodePortOfDisembarkation.LocodeValue = this.PAS.PassengerPortOfDisembarkation;
|
|
this.checkBoxTransitPassenger.IsChecked = this.PAS.PassengerInTransit;
|
|
this.comboBoxIssuingState.ItemsSource = bsmd.database.CREW.NationalityDict;
|
|
this.comboBoxIssuingState.SelectedValue = this.PAS.PassengerIdentityDocumentIssuingState;
|
|
if(this.PAS.PassengerIdentityDocumentExpiryDate.HasValue)
|
|
this.datePickerExpiryDate.SelectedDate = this.PAS.PassengerIdentityDocumentExpiryDate;
|
|
// XXX : TODO
|
|
//this.comboBoxCountryOfBirth.ItemsSource = bsmd.database.CREW.NationalityDict;
|
|
//this.comboBoxCountryOfBirth.SelectedValue = this.PAS.PassengerCountryOfBirth;
|
|
//this.textBoxEmergencyCare.Text = this.PAS.EmergencyCare;
|
|
//this.textBoxEmergencyContactNumber.Text = this.PAS.EmergencyContactNumber;
|
|
|
|
this.OKClicked += EditPasDialog_OKClicked;
|
|
this.AddVisible = true;
|
|
}
|
|
|
|
public void CopyValuesToEntity()
|
|
{
|
|
// copy back
|
|
this.PAS.PassengerLastName = this.textBoxLastName.Text.Trim();
|
|
this.PAS.PassengerFirstName = this.textBoxFirstName.Text.Trim();
|
|
this.PAS.PassengerGender = (this.comboBoxGender.SelectedIndex == -1) ? null : (byte?)this.comboBoxGender.SelectedIndex;
|
|
if (this.PAS.PassengerGender == 3)
|
|
this.PAS.PassengerGender = 9;
|
|
this.PAS.PassengerPlaceOfBirth = this.textBoxPlaceOfBirth.Text.Trim();
|
|
this.PAS.PassengerNationality = (this.comboBoxNationality.SelectedValue == null) ? "" : (string)this.comboBoxNationality.SelectedValue;
|
|
this.PAS.PassengerDateOfBirth = this.datePickerDateOfBirth.SelectedDate;
|
|
this.PAS.PassengerIdentityDocumentType = (this.comboBoxIdDocType.SelectedIndex == -1) ? null : (byte?)this.comboBoxIdDocType.SelectedIndex;
|
|
this.PAS.PassengerIdentityDocumentId = this.textBoxIdDocNumber.Text.Trim();
|
|
this.PAS.PassengerVisaNumber = this.textBoxVisaNumber.Text.Trim();
|
|
this.PAS.PassengerPortOfEmbarkation = this.locodePortOfEmbarkation.LocodeValue;
|
|
this.PAS.PassengerPortOfDisembarkation = this.locodePortOfDisembarkation.LocodeValue;
|
|
this.PAS.PassengerInTransit = this.checkBoxTransitPassenger.IsChecked;
|
|
this.PAS.PassengerIdentityDocumentIssuingState = (this.comboBoxIssuingState.SelectedValue == null) ? "" : (string)this.comboBoxIssuingState.SelectedValue;
|
|
this.PAS.PassengerIdentityDocumentExpiryDate = this.datePickerExpiryDate.SelectedDate;
|
|
// XXX : TODO
|
|
// this.PAS.PassengerCountryOfBirth = (this.comboBoxCountryOfBirth.SelectedValue == null) ? "" : (string)this.comboBoxCountryOfBirth.SelectedValue;
|
|
//this.PAS.EmergencyCare = this.textBoxEmergencyCare.Text.Trim();
|
|
//this.PAS.EmergencyContactNumber = this.textBoxEmergencyContactNumber.Text.Trim();
|
|
}
|
|
|
|
private void EditPasDialog_OKClicked()
|
|
{
|
|
this.CopyValuesToEntity();
|
|
}
|
|
}
|
|
}
|