// Copyright (c) 2017 schick Informatik // Description: IBC item Bearbeitungsdialog // using System.Windows; using bsmd.database; using ENI2.Controls; using ENI2.Util; namespace ENI2.EditControls { /// /// Interaction logic for EditIBCDialog.xaml /// public partial class EditIBCDialog : EditWindowBase { public EditIBCDialog() { InitializeComponent(); Loaded += EditIBCDialog_Loaded; AddClicked += () => { this.textBoxIdentifier.Focus(); }; } public IBCPosition IBC { get; set; } public string Identifier { get { return this.textBoxIdentifier.Text; } set { this.textBoxIdentifier.Text = value; } } private void EditIBCDialog_Loaded(object sender, RoutedEventArgs e) { this.textBoxFlashpoint.Text = this.IBC.Flashpoint_CEL; this.textBoxIdentifier.Text = this.IBC.Identifier; this.textBoxProductName.Text = this.IBC.ProductName; this.textBoxRemarks.Text = this.IBC.Remarks; this.textBoxStowagePosition.Text = this.IBC.StowagePosition; this.checkBoxSpecRef15_19.IsChecked = this.IBC.SpecRef15_19; this.comboBoxFlashpointInformation.ItemsSource = IBCPosition.flashpointInformations; //this.comboBoxFlashpointInformation.KeyUp += ComboBox_KeyUp; this.comboBoxFlashpointInformation.SelectedIndex = this.IBC.FlashpointInformation ?? -1; this.comboBoxPollutionCategory.ItemsSource = IBCPosition.pollutionCategories; //this.comboBoxPollutionCategory.KeyUp += ComboBox_KeyUp; this.comboBoxPollutionCategory.SelectedIndex = this.IBC.PollutionCategory ?? -1; this.comboBoxRisks.ItemsSource = IBCPosition.hazards; //this.comboBoxRisks.KeyUp += ComboBox_KeyUp; this.comboBoxRisks.SelectedIndex = this.IBC.Hazards ?? -1; this.doubleUpDownQuantity.Value = this.IBC.Quantity_KGM; this.locodePortOfDischarge.LocodeValue = this.IBC.PortOfDischarge; this.locodePortOfLoading.LocodeValue = this.IBC.PortOfLoading; this.OKClicked += EditIBCDialog_OKClicked; this.AddVisible = true; } public void CopyValuesToEntity() { this.IBC.Flashpoint_CEL = this.textBoxFlashpoint.Text.Trim(); this.IBC.Identifier = this.textBoxIdentifier.Text.Trim(); this.IBC.ProductName = this.textBoxProductName.Text.Trim(); this.IBC.Remarks = this.textBoxRemarks.Text.Trim(); this.IBC.StowagePosition = this.textBoxStowagePosition.Text.Trim(); this.IBC.SpecRef15_19 = this.checkBoxSpecRef15_19.IsChecked; this.IBC.FlashpointInformation = (this.comboBoxFlashpointInformation.SelectedIndex == -1) ? null : ((byte?)this.comboBoxFlashpointInformation.SelectedIndex); this.IBC.PollutionCategory = (this.comboBoxPollutionCategory.SelectedIndex == -1) ? null : ((byte?)this.comboBoxPollutionCategory.SelectedIndex); this.IBC.Hazards = (this.comboBoxRisks.SelectedIndex == -1) ? null : ((byte?)this.comboBoxRisks.SelectedIndex); this.IBC.Quantity_KGM = this.doubleUpDownQuantity.Value; this.IBC.PortOfDischarge = this.locodePortOfDischarge.LocodeValue; this.IBC.PortOfLoading = this.locodePortOfLoading.LocodeValue; } private void EditIBCDialog_OKClicked() { this.CopyValuesToEntity(); } } }