// Copyright (c) 2017 schick Informatik // Description: Marpol Annex I item Bearbeitungsdialog // using System.Windows; using bsmd.database; using ENI2.Controls; using ENI2.Util; namespace ENI2.EditControls { /// /// Interaction logic for EditMarpolDialog.xaml /// public partial class EditMarpolDialog : EditWindowBase { public EditMarpolDialog() { InitializeComponent(); AddClicked += () => { this.textBoxIdentifier.Focus(); }; Loaded += EditMarpolDialog_Loaded; } public MARPOL_Annex_I_Position MARPOL { get; set; } public string Identifier { get { return this.textBoxIdentifier.Text; } set { this.textBoxIdentifier.Text = value; } } private void EditMarpolDialog_Loaded(object sender, RoutedEventArgs e) { this.textBoxFlashpoint.Text = this.MARPOL.Flashpoint_CEL; this.textBoxIdentifier.Text = this.MARPOL.Identifier; this.textBoxName.Text = this.MARPOL.Name; this.textBoxRemarks.Text = this.MARPOL.Remarks; this.textBoxStowagePosition.Text = this.MARPOL.StowagePosition; this.comboBoxFlashpointInformation.ItemsSource = IBCPosition.flashpointInformations; //this.comboBoxFlashpointInformation.KeyUp += ComboBox_KeyUp; this.comboBoxFlashpointInformation.SelectedIndex = (this.MARPOL.FlashpointInformation == null) ? -1 : ((int)this.MARPOL.FlashpointInformation); this.doubleUpDownQuantity.Value = this.MARPOL.Quantity_KGM; this.locodeControlPortOfDischarge.LocodeValue = this.MARPOL.PortOfDischarge; this.locodeControlPortOfLoading.LocodeValue = this.MARPOL.PortOfLoading; this.AddVisible = true; this.OKClicked += EditMarpolDialog_OKClicked; } public void CopyValuesToEntity() { this.MARPOL.Flashpoint_CEL = this.textBoxFlashpoint.Text.Trim(); this.MARPOL.Identifier = this.textBoxIdentifier.Text.Trim(); this.MARPOL.Name = this.textBoxName.Text.Trim(); this.MARPOL.Remarks = this.textBoxRemarks.Text.Trim(); this.MARPOL.StowagePosition = this.textBoxStowagePosition.Text.Trim(); this.MARPOL.FlashpointInformation = (this.comboBoxFlashpointInformation.SelectedIndex == -1) ? null : ((byte?)this.comboBoxFlashpointInformation.SelectedIndex); this.MARPOL.Quantity_KGM = this.doubleUpDownQuantity.Value; this.MARPOL.PortOfDischarge = this.locodeControlPortOfDischarge.LocodeValue; this.MARPOL.PortOfLoading = this.locodeControlPortOfLoading.LocodeValue; } private void EditMarpolDialog_OKClicked() { this.CopyValuesToEntity(); } } }