diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config index 77790c5b..b657c69b 100644 --- a/ENI-2/ENI2/ENI2/App.config +++ b/ENI-2/ENI2/ENI2/App.config @@ -26,12 +26,12 @@ 1000 - - http://heupferd/bsmd.LockingService/LockingService.svc + http://192.168.2.4/LockingService/LockingService.svc + - - Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False + Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False + diff --git a/ENI-2/ENI2/ENI2/App.xaml.cs b/ENI-2/ENI2/ENI2/App.xaml.cs index 63f11d5e..8df0fa91 100644 --- a/ENI-2/ENI2/ENI2/App.xaml.cs +++ b/ENI-2/ENI2/ENI2/App.xaml.cs @@ -41,7 +41,7 @@ namespace ENI2 public static SplashScreenWindow SplashScreen { get { return _splashScreenWindow; } } - public static Guid? UserId { get { return _userId; } } + public static Guid? UserId { get { return _userId; } set { _userId = value; } } protected override void OnStartup(StartupEventArgs e) { @@ -65,11 +65,8 @@ namespace ENI2 LADG.CargoHandlingDict.Add(key, cargoHandlingDict[key]); EventManager.RegisterClassHandler(typeof(DatePicker), DatePicker.PreviewKeyDownEvent, new KeyEventHandler(this.DatePicker_PreviewKeyDown)); - - // perform logon - // TODO: Benutzerverwaltung - - + CREW.NationalityDict = LocalizedLookup.getNationalities(); + // Connect to locking service (if enabled) try diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs index f1b84bf2..29f1fb80 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/ArrivalNotificationDetailControl.xaml.cs @@ -149,9 +149,11 @@ namespace ENI2.DetailViewControls ebd.AddClicked += () => { ebd.CopyValuesToEntity(); - this._bkraMessage.Elements.Add(ebd.BRKA); + this._bkraMessage.Elements.Add(ebd.BRKA); + ebd.BRKA.MessageHeader = _bkraMessage; this.dataGridBKRA.Items.Refresh(); ebd.BRKA = new BRKA(); + this.SublistElementChanged(Message.NotificationClass.BKRA); }; if (ebd.ShowDialog() ?? false) @@ -185,15 +187,19 @@ namespace ENI2.DetailViewControls eld.AddClicked += () => { - eld.CopyValuesToEntity(); + eld.CopyValuesToEntity(); _bkraMessage.Elements.Add(eld.BRKA); this.dataGridBKRA.Items.Refresh(); eld.BRKA = new BRKA(); + eld.BRKA.MessageHeader = _bkraMessage; + this.SublistElementChanged(Message.NotificationClass.BKRA); }; if (eld.ShowDialog() ?? false) + { this.dataGridBKRA.Items.Refresh(); - this.SublistElementChanged(Message.NotificationClass.BKRA); + this.SublistElementChanged(Message.NotificationClass.BKRA); + } } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml index 8ff93a87..82cd3b72 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml @@ -3,11 +3,91 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:p="clr-namespace:ENI2.Properties" + xmlns:enictrl="clr-namespace:ENI2.Controls" + xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:local="clr-namespace:ENI2.DetailViewControls" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> - - - + d:DesignHeight="800" d:DesignWidth="1024"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs index 5167bcb0..9629503c 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml.cs @@ -1,21 +1,13 @@ // Copyright (c) 2017 schick Informatik -// Description: +// Description: Detailansicht für BPOL, CREW(D), PAS(D) // -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; +using ENI2.EditControls; + +using bsmd.database; namespace ENI2.DetailViewControls { @@ -24,9 +16,319 @@ namespace ENI2.DetailViewControls /// public partial class BorderPoliceDetailControl : DetailBaseControl { + private Message _bpolMessage; + private Message _crewMessage; + private Message _crewdMessage; + private Message _pasMessage; + private Message _pasdMessage; + private BPOL _bpol; + public BorderPoliceDetailControl() { InitializeComponent(); + this.Loaded += BorderPoliceDetailControl_Loaded; } + + private void BorderPoliceDetailControl_Loaded(object sender, RoutedEventArgs e) + { + this.RegisterCheckboxChange(this.checkBoxCruiseShip, Message.NotificationClass.BPOL); + this.RegisterCheckboxChange(this.checkBoxStowaways, Message.NotificationClass.BPOL); + } + + public override void Initialize() + { + base.Initialize(); + + foreach (Message aMessage in this.Messages) + { + if (aMessage.MessageNotificationClass == Message.NotificationClass.BPOL) { this._bpolMessage = aMessage; this.ControlMessages.Add(aMessage); } + if (aMessage.MessageNotificationClass == Message.NotificationClass.CREW) { this._crewMessage = aMessage; this.ControlMessages.Add(aMessage); } + if (aMessage.MessageNotificationClass == Message.NotificationClass.PAS) { this._pasMessage = aMessage; this.ControlMessages.Add(aMessage); } + if (aMessage.MessageNotificationClass == Message.NotificationClass.CREWD) { this._crewdMessage = aMessage; this.ControlMessages.Add(aMessage); } + if (aMessage.MessageNotificationClass == Message.NotificationClass.PASD) { this._pasdMessage = aMessage; this.ControlMessages.Add(aMessage); } + } + + #region init BPOL + + if (this._bpolMessage == null) + { + this._bpolMessage = this.Core.CreateMessage(Message.NotificationClass.BPOL); + this.Messages.Add(this._bpolMessage); + } + + BPOL bpol = null; + if (this._bpolMessage.Elements.Count > 0) + bpol = this._bpolMessage.Elements[0] as BPOL; + if (bpol == null) + { + bpol = new BPOL(); + bpol.MessageCore = this.Core; + bpol.MessageHeader = this._bpolMessage; + _bpolMessage.Elements.Add(bpol); + } + + this.groupBoxBorderPolice.DataContext = bpol; + this._bpol = bpol; + this.dataGridPortOfItinerary.Initialize(); + this.dataGridPortOfItinerary.ItemsSource = bpol.PortOfItineraries; + this.dataGridPortOfItinerary.AddingNewItem += DataGridPortOfItinerary_AddingNewItem; + this.dataGridPortOfItinerary.EditRequested += DataGridPortOfItinerary_EditRequested; + this.dataGridPortOfItinerary.DeleteRequested += DataGridPortOfItinerary_DeleteRequested; + this.dataGridPortOfItinerary.CreateRequested += DataGridPortOfItinerary_CreateRequested; + + #endregion + + #region init CREW + + if (this._crewMessage == null) + { + this._crewMessage = this.Core.CreateMessage(Message.NotificationClass.CREW); + this.Messages.Add(this._crewMessage); + } + + this.dataGridCrewList.Initialize(); + this.dataGridCrewList.ItemsSource = this._crewMessage.Elements; + this.dataGridCrewList.AddingNewItem += DataGridCrewList_AddingNewItem; + this.dataGridCrewList.EditRequested += DataGridCrewList_EditRequested; + this.dataGridCrewList.DeleteRequested += DataGridCrewList_DeleteRequested; + this.dataGridCrewList.CreateRequested += DataGridCrewList_CreateRequested; + + #endregion + + #region init PAS + + if (this._pasMessage == null) + { + this._pasMessage = this.Core.CreateMessage(Message.NotificationClass.PAS); + this.Messages.Add(this._pasMessage); + } + + this.dataGridPassengerList.Initialize(); + this.dataGridPassengerList.ItemsSource = this._pasMessage.Elements; + this.dataGridPassengerList.AddingNewItem += DataGridPassengerList_AddingNewItem; + this.dataGridPassengerList.EditRequested += DataGridPassengerList_EditRequested; + this.dataGridPassengerList.DeleteRequested += DataGridPassengerList_DeleteRequested; + this.dataGridPassengerList.CreateRequested += DataGridPassengerList_CreateRequested; + + #endregion + + } + + #region port of itinerary grid + + private void DataGridPortOfItinerary_CreateRequested() + { + PortOfItinerary poi = new PortOfItinerary(); + EditPortOfItineraryDialog epid = new EditPortOfItineraryDialog(); + epid.PortOfItinerary = poi; + + epid.AddClicked += () => + { + epid.CopyValuesToEntity(); + epid.PortOfItinerary.BPOL = _bpol; + this._bpol.PortOfItineraries.Add(epid.PortOfItinerary); + this.dataGridPortOfItinerary.Items.Refresh(); + epid.PortOfItinerary = new PortOfItinerary(); + this.SublistElementChanged(Message.NotificationClass.BPOL); + }; + + if (epid.ShowDialog() ?? false) + { + _bpol.PortOfItineraries.Add(epid.PortOfItinerary); + epid.PortOfItinerary.BPOL = _bpol; + this.dataGridPortOfItinerary.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.BPOL); + } + } + + private void DataGridPortOfItinerary_DeleteRequested(DatabaseEntity obj) + { + PortOfItinerary poi = obj as PortOfItinerary; + if (poi != null) + { + // are you sure dialog is in base class + _bpol.PortOfItineraries.Remove(poi); + // DBManager.Instance.Delete(serv); // not yet + this.dataGridPortOfItinerary.Items.Refresh(); + } + } + + private void DataGridPortOfItinerary_EditRequested(DatabaseEntity obj) + { + PortOfItinerary poi = obj as PortOfItinerary; + if (poi != null) + { + EditPortOfItineraryDialog epid = new EditPortOfItineraryDialog(); + epid.PortOfItinerary = poi; + + epid.AddClicked += () => + { + epid.CopyValuesToEntity(); + _bpol.PortOfItineraries.Add(epid.PortOfItinerary); + this.dataGridPortOfItinerary.Items.Refresh(); + epid.PortOfItinerary = new PortOfItinerary(); + epid.PortOfItinerary.BPOL = this._bpol; + this.SublistElementChanged(Message.NotificationClass.BPOL); + }; + + if (epid.ShowDialog() ?? false) + { + this.dataGridPortOfItinerary.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.BPOL); + } + } + } + + private void DataGridPortOfItinerary_AddingNewItem(object sender, AddingNewItemEventArgs e) + { + this.DataGridPortOfItinerary_CreateRequested(); + } + + #endregion + + #region passenger grid + + private void DataGridPassengerList_CreateRequested() + { + PAS pas = new PAS(); + EditPASDialog epd = new EditPASDialog(); + epd.PAS = pas; + + epd.AddClicked += () => + { + epd.CopyValuesToEntity(); + epd.PAS.MessageHeader = this._pasMessage; + this._pasMessage.Elements.Add(epd.PAS); + this.dataGridPassengerList.Items.Refresh(); + epd.PAS = new PAS(); + this.SublistElementChanged(Message.NotificationClass.PAS); + }; + + if (epd.ShowDialog() ?? false) + { + _pasMessage.Elements.Add(epd.PAS); + epd.PAS.MessageHeader = this._pasMessage; + this.dataGridPassengerList.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.PAS); + } + } + + private void DataGridPassengerList_DeleteRequested(DatabaseEntity obj) + { + PAS pas = obj as PAS; + if (pas != null) + { + // are you sure dialog is in base class + _pasMessage.Elements.Remove(pas); + // DBManager.Instance.Delete(serv); // not yet + this.dataGridPassengerList.Items.Refresh(); + } + } + + private void DataGridPassengerList_EditRequested(DatabaseEntity obj) + { + PAS pas = obj as PAS; + if (pas != null) + { + EditPASDialog epd = new EditPASDialog(); + epd.PAS = pas; + + epd.AddClicked += () => + { + epd.CopyValuesToEntity(); + _pasMessage.Elements.Add(epd.PAS); + this.dataGridPassengerList.Items.Refresh(); + epd.PAS = new PAS(); + epd.PAS.MessageHeader = _pasMessage; + this.SublistElementChanged(Message.NotificationClass.PAS); + }; + + if (epd.ShowDialog() ?? false) + { + this.dataGridPassengerList.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.PAS); + } + } + } + + private void DataGridPassengerList_AddingNewItem(object sender, AddingNewItemEventArgs e) + { + this.DataGridPassengerList_CreateRequested(); + } + + #endregion + + #region crew grid + + private void DataGridCrewList_CreateRequested() + { + CREW crew = new CREW(); + EditCREWDialog ecd = new EditCREWDialog(); + ecd.CREW = crew; + + ecd.AddClicked += () => + { + ecd.CopyValuesToEntity(); + ecd.CREW.MessageHeader = this._crewMessage; + this._crewMessage.Elements.Add(ecd.CREW); + this.dataGridCrewList.Items.Refresh(); + ecd.CREW = new CREW(); + this.SublistElementChanged(Message.NotificationClass.CREW); + }; + + if (ecd.ShowDialog() ?? false) + { + _crewMessage.Elements.Add(ecd.CREW); + ecd.CREW.MessageHeader = this._crewMessage; + this.dataGridCrewList.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.CREW); + } + } + + private void DataGridCrewList_DeleteRequested(DatabaseEntity obj) + { + CREW crew = obj as CREW; + if (crew != null) + { + // are you sure dialog is in base class + _crewMessage.Elements.Remove(crew); + // DBManager.Instance.Delete(serv); // not yet + this.dataGridCrewList.Items.Refresh(); + } + } + + private void DataGridCrewList_EditRequested(DatabaseEntity obj) + { + CREW crew = obj as CREW; + if (crew != null) + { + EditCREWDialog ecd = new EditCREWDialog(); + ecd.CREW = crew; + + ecd.AddClicked += () => + { + ecd.CopyValuesToEntity(); + _crewMessage.Elements.Add(ecd.CREW); + this.dataGridCrewList.Items.Refresh(); + ecd.CREW = new CREW(); + ecd.CREW.MessageHeader = _crewMessage; + this.SublistElementChanged(Message.NotificationClass.CREW); + }; + + if (ecd.ShowDialog() ?? false) + { + this.dataGridCrewList.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.CREW); + } + } + } + + private void DataGridCrewList_AddingNewItem(object sender, AddingNewItemEventArgs e) + { + this.DataGridCrewList_CreateRequested(); + } + + #endregion + } } diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml index c41a4380..782f9c66 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml @@ -32,13 +32,13 @@