// Copyright (c) 2017 schick Informatik // Description: IMDG item Bearbeitungsdialog // using System.Windows; using bsmd.database; using ENI2.Controls; using ENI2.Util; namespace ENI2.EditControls { /// /// Interaction logic for EditIMDGDialog.xaml /// public partial class EditIMDGDialog : EditWindowBase { public EditIMDGDialog() { InitializeComponent(); Loaded += EditIMDGDialog_Loaded; AddClicked += () => { this.textBoxIdentifier.Focus(); }; } public IMDGPosition IMDG { get; set; } public string Identifier { get { return this.textBoxIdentifier.Text; } set { this.textBoxIdentifier.Text = value; } } private void EditIMDGDialog_Loaded(object sender, RoutedEventArgs e) { this.textBoxClass7NuclideName.Text = this.IMDG.Class7NuclideName; this.textBoxContainerNo.Text = this.IMDG.ContainerNumber; this.textBoxContainerPositionBay.Text = this.IMDG.Bay; this.textBoxContainerPositionRow.Text = this.IMDG.Row; this.textBoxContainerPositionTier.Text = this.IMDG.Tier; this.textBoxFlashpoint.Text = this.IMDG.Flashpoint_CEL; this.textBoxIdentifier.Text = this.IMDG.Identifier; this.textBoxIMOClass.Text = this.IMDG.IMOClass; this.textBoxProperShippingName.Text = this.IMDG.ProperShippingName; this.textBoxRemarks.Text = this.IMDG.Remarks; this.textBoxStowagePosition.Text = this.IMDG.StowagePosition; this.textBoxSubsidiaryRisks.Text = this.IMDG.SubsidiaryRiskText; this.textBoxTechnicalName.Text = this.IMDG.TechnicalName; this.textBoxUNNumber.Text = this.IMDG.UNNumber; this.textBoxVehicleLicensePlate.Text = this.IMDG.VehicleLicenseNumber; this.decimalUpdownClass7TransportIndex.Value = this.IMDG.Class7TransportIndex; this.decimalUpdownControlTemperature.Value = this.IMDG.ControlTemperature_CEL; this.decimalUpDownCSI.Value = this.IMDG.Class7CSI; this.decimalUpDownEmergencyTemperature.Value = this.IMDG.EmergencyTemperature_CEL; this.decimalUpDownGrossQuantity.Value = this.IMDG.GrossQuantity_KGM; this.decimalUpDownMaxActivity.Value = this.IMDG.Class7MaxActivity_BQL; this.decimalUpDownNetExplosiveMass.Value = this.IMDG.NetExplosiveMass_KGM; this.decimalUpDownNetQuantity.Value = this.IMDG.NetQuantity_KGM; this.doubleUpDownCargoVolume.Value = this.IMDG.Volume_MTQ; this.integerUpDownCategory.Value = this.IMDG.Class7Category; this.integerUpDownNumberOfPackages.Value = this.IMDG.NumberOfPackages; this.checkBoxExceptedQuantities.IsChecked = this.IMDG.ExceptedQuantities; this.checkBoxGeneralCargo.IsChecked = this.IMDG.GeneralCargoIBC; this.checkBoxLimitedQuantities.IsChecked = this.IMDG.LimitedQuantities; this.checkBoxMarinePollutant.IsChecked = this.IMDG.MarinePollutant; this.comboBoxPackageType.ItemsSource = HAZ.PackageTypes; //if((this.IMDG.PackageType != null) && HAZ.PackageTypes.ContainsKey(this.IMDG.PackageType)) // this.comboBoxPackageType.SelectedValue = this.IMDG.PackageType; this.textBoxPackageType.Text = this.IMDG.PackageType; this.comboBoxPackingGroup.ItemsSource = GlobalStructures.packingGroups; this.comboBoxPackingGroup.SelectedIndex = (int) (this.IMDG.PackingGroup ?? -1); this.locodeControlPortOfDischarge.LocodeValue = this.IMDG.PortOfDischarge; this.locodeControlPortOfLoading.LocodeValue = this.IMDG.PortOfLoading; this.OKClicked += EditIMDGDialog_OKClicked; this.AddVisible = true; } public void CopyValuesToEntity() { this.IMDG.Class7NuclideName = this.textBoxClass7NuclideName.Text.Trim(); this.IMDG.ContainerNumber = this.textBoxContainerNo.Text.Trim(); this.IMDG.Bay = this.textBoxContainerPositionBay.Text.Trim(); this.IMDG.Row = this.textBoxContainerPositionRow.Text.Trim(); this.IMDG.Tier = this.textBoxContainerPositionTier.Text.Trim(); this.IMDG.Flashpoint_CEL = this.textBoxFlashpoint.Text.Trim(); this.IMDG.Identifier = this.textBoxIdentifier.Text.Trim(); this.IMDG.IMOClass = this.textBoxIMOClass.Text.Trim(); this.IMDG.PackageType = this.textBoxPackageType.Text.Trim(); this.IMDG.ProperShippingName = this.textBoxProperShippingName.Text.Trim(); this.IMDG.Remarks = this.textBoxRemarks.Text.Trim(); this.IMDG.StowagePosition = this.textBoxStowagePosition.Text.Trim(); this.IMDG.SubsidiaryRiskText = this.textBoxSubsidiaryRisks.Text.Trim(); this.IMDG.TechnicalName = this.textBoxTechnicalName.Text.Trim(); this.IMDG.UNNumber = this.textBoxUNNumber.Text.Trim(); this.IMDG.VehicleLicenseNumber = this.textBoxVehicleLicensePlate.Text.Trim(); this.IMDG.Class7TransportIndex = this.decimalUpdownClass7TransportIndex.Value; this.IMDG.ControlTemperature_CEL = this.decimalUpdownControlTemperature.Value; this.IMDG.Class7CSI = (int?) this.decimalUpDownCSI.Value; this.IMDG.EmergencyTemperature_CEL = this.decimalUpDownEmergencyTemperature.Value; this.IMDG.GrossQuantity_KGM = this.decimalUpDownGrossQuantity.Value; this.IMDG.Class7MaxActivity_BQL = this.decimalUpDownMaxActivity.Value; this.IMDG.NetExplosiveMass_KGM = this.decimalUpDownNetExplosiveMass.Value; this.IMDG.NetQuantity_KGM = this.decimalUpDownNetQuantity.Value; this.IMDG.Volume_MTQ = this.doubleUpDownCargoVolume.Value; this.IMDG.Class7Category = this.integerUpDownCategory.Value; this.IMDG.NumberOfPackages = this.integerUpDownNumberOfPackages.Value; this.IMDG.ExceptedQuantities = this.checkBoxExceptedQuantities.IsChecked; this.IMDG.GeneralCargoIBC = this.checkBoxGeneralCargo.IsChecked; this.IMDG.LimitedQuantities = this.checkBoxLimitedQuantities.IsChecked; this.IMDG.MarinePollutant = this.checkBoxMarinePollutant.IsChecked; this.IMDG.PackingGroup = (this.comboBoxPackingGroup.SelectedIndex == -1) ? null : ((byte?)this.comboBoxPackingGroup.SelectedIndex); this.IMDG.PortOfDischarge = this.locodeControlPortOfDischarge.LocodeValue; this.IMDG.PortOfLoading = this.locodeControlPortOfLoading.LocodeValue; } private void EditIMDGDialog_OKClicked() { this.CopyValuesToEntity(); } private void comboBoxPackageType_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { if(this.comboBoxPackageType.SelectedValue != null) this.textBoxPackageType.Text = this.comboBoxPackageType.SelectedValue as string; } private void textBoxPackageType_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) { string pText = this.textBoxPackageType.Text; if (pText.IsNullOrEmpty() || !HAZ.PackageTypes.ContainsKey(pText)) this.comboBoxPackageType.SelectedIndex = -1; else this.comboBoxPackageType.SelectedValue = pText; } } }