// Copyright (c) 2017 schick Informatik
// Description: Mit diesem Dialog können neue Visit/Transit-Id's beantragt werden (DE only)
//
using System.Collections.Generic;
using System.Windows;
using ENI2.Controls;
using ENI2.Locode;
using bsmd.database;
namespace ENI2.EditControls
{
///
/// Interaction logic for VisitIdDialog.xaml
///
public partial class VisitIdDialog : EditWindowBase
{
private bool _isOK;
public VisitIdDialog()
{
InitializeComponent();
Loaded += VisitIdDialog_Loaded;
}
private void VisitIdDialog_Loaded(object sender, RoutedEventArgs e)
{
this.OKClicked += VisitIdDialog_OKClicked;
List> comboDataSource = new List>()
{
new KeyValuePair( Message.NSWProvider.DBH, "DBH" ),
new KeyValuePair( Message.NSWProvider.DUDR, "HIS-Nord" ),
};
this.comboBoxInitialHIS.ItemsSource = comboDataSource;
this.comboBoxInitialHIS.SelectedIndex = 1;
this.EnableOK(false);
this.locodePoC.PropertyChanged += LocodePoC_PropertyChanged;
}
private void VisitIdDialog_OKClicked()
{
// Validate entries, write back to model etc pp
if(this.locodePoC.LocodeValue == "ZZNOK")
{
this.Core.IsTransit = true;
this.Core.ETAKielCanal = this.datePickerETA.SelectedDate;
}
else
{
this.Core.IsTransit = false;
this.Core.ETA = this.datePickerETA.SelectedDate;
}
if (this.doubleUpDownIMO.Value.HasValue)
this.Core.IMO = this.doubleUpDownIMO.Value.Value.ToString("0000000");
if (this.doubleUpDownENI.Value.HasValue)
this.Core.ENI = this.doubleUpDownENI.Value.Value.ToString("00000000");
this.Core.PoC = this.locodePoC.LocodeValue;
this.Core.Portname = LocodeDB.PortNameFromLocode(this.Core.PoC);
this.Core.InitialHIS = (Message.NSWProvider) this.comboBoxInitialHIS.SelectedValue;
this._isOK = true;
}
public MessageCore Core { get; set; }
public bool IsOK { get { return this._isOK; } }
#region event handler
private void doubleUpDownIMO_ValueChanged(object sender, RoutedPropertyChangedEventArgs