// Copyright (c) 2017 schick Informatik // Description: IMSBC item Bearbeitungsdialog // using System.Windows; using bsmd.database; using ENI2.Controls; using ENI2.Util; namespace ENI2.EditControls { /// /// Interaction logic for EditIMSBCDialog.xaml /// public partial class EditIMSBCDialog : EditWindowBase { public EditIMSBCDialog() { InitializeComponent(); Loaded += EditIMSBCDialog_Loaded; AddClicked += () => { this.textBoxIdentifier.Focus(); }; } public IMSBCPosition IMSBC { get; set; } public string Identifier { get { return this.textBoxIdentifier.Text; } set { this.textBoxIdentifier.Text = value; } } private void EditIMSBCDialog_Loaded(object sender, RoutedEventArgs e) { this.textBoxBulkCargoShippingName.Text = this.IMSBC.BulkCargoShippingName; this.textBoxIdentifier.Text = this.IMSBC.Identifier; this.textBoxIMOClass.Text = this.IMSBC.IMOClass; this.textBoxRemarks.Text = this.IMSBC.Remarks; this.textBoxStowagePosition.Text = this.IMSBC.StowagePosition; this.textBoxUNNumber.Text = this.IMSBC.UNNumber; this.checkBoxMaterialHazardous.IsChecked = this.IMSBC.MHB; this.doubleUpDownQuantity.Value = this.IMSBC.Quantity_KGM; this.locodePortOfDischarge.LocodeValue = this.IMSBC.PortOfDischarge; this.locodePortOfLoading.LocodeValue = this.IMSBC.PortOfLoading; this.comboBoxIMOHazardClass.ItemsSource = GlobalStructures.imoHazardClasses; this.comboBoxIMOHazardClass.SelectedIndex = (int)(this.IMSBC.IMOHazardClass ?? -1); this.OKClicked += EditIMSBCDialog_OKClicked; this.AddVisible = true; } public void CopyValuesToEntity() { this.IMSBC.BulkCargoShippingName = this.textBoxBulkCargoShippingName.Text.Trim(); this.IMSBC.Identifier = this.textBoxIdentifier.Text.Trim(); this.IMSBC.IMOClass = this.textBoxIMOClass.Text.Trim(); this.IMSBC.Remarks = this.textBoxRemarks.Text.Trim(); this.IMSBC.StowagePosition = this.textBoxStowagePosition.Text.Trim(); this.IMSBC.UNNumber = this.textBoxUNNumber.Text.Trim(); this.IMSBC.MHB = this.checkBoxMaterialHazardous.IsChecked; this.IMSBC.Quantity_KGM = this.doubleUpDownQuantity.Value; this.IMSBC.PortOfDischarge = this.locodePortOfDischarge.LocodeValue; this.IMSBC.PortOfLoading = this.locodePortOfLoading.LocodeValue; this.IMSBC.IMOHazardClass = (this.comboBoxIMOHazardClass.SelectedIndex == -1) ? null : ((int?)this.comboBoxIMOHazardClass.SelectedIndex); } private void EditIMSBCDialog_OKClicked() { this.CopyValuesToEntity(); } } }