diff --git a/ENI2/Controls/StatusWindowBase.cs b/ENI2/Controls/StatusWindowBase.cs index e461435a..dc7f5358 100644 --- a/ENI2/Controls/StatusWindowBase.cs +++ b/ENI2/Controls/StatusWindowBase.cs @@ -14,7 +14,7 @@ namespace ENI2.Controls { [TemplatePart(Name = "buttonRefresh", Type = typeof(Button))] - [TemplatePart(Name = "buttonClose", Type = typeof(Button))] + [TemplatePart(Name = "buttonClose", Type = typeof(Button))] public class StatusWindowBase : Window { @@ -36,13 +36,22 @@ namespace ENI2.Controls closeButton.Click += (s, e) => { if (this.IsModal()) DialogResult = true; CloseClicked?.Invoke(); this.Close(); }; refreshButton.Click += (s, e) => { RefreshClicked?.Invoke(); }; - SettingBindingExtension stBinding = new SettingBindingExtension("W2Top"); + string topProperty = "W2Top"; + string leftProperty = "W2Left"; + if(this.GetType().Name == "ViolationListDialog") + { + topProperty = "W3Top"; + leftProperty = "W3Left"; + } + + + SettingBindingExtension stBinding = new SettingBindingExtension(topProperty); this.SetBinding(Window.TopProperty, stBinding); - SettingBindingExtension slBinding = new SettingBindingExtension("W2Left"); - this.SetBinding (Window.LeftProperty, slBinding); - }; - } + SettingBindingExtension slBinding = new SettingBindingExtension(leftProperty); + this.SetBinding (Window.LeftProperty, slBinding); + }; + } public bool RefreshVisible { diff --git a/ENI2/DetailRootControl.xaml.cs b/ENI2/DetailRootControl.xaml.cs index 7925f615..d50b7551 100644 --- a/ENI2/DetailRootControl.xaml.cs +++ b/ENI2/DetailRootControl.xaml.cs @@ -31,7 +31,7 @@ namespace ENI2 private readonly List _listBoxList = new List(); private List _messages; private readonly Dictionary controlCache = new Dictionary(); - // private readonly Dictionary messageClassControlDict = new Dictionary(); + // private readonly Dictionary messageClassControlDict = new Dictionary(); private readonly object messageListLock = new object(); private readonly HighlightService highlightService = new HighlightService(); @@ -65,7 +65,7 @@ namespace ENI2 get { // Bedingung: - // wenn in einer Meldeklasse zwar Daten vorhanden sind, eingespielt durch Excel import oder + // wenn in einer Meldeklasse zwar Daten vorhanden sind, eingespielt durch Excel import oder // Handeingabe, diese aber NICHT gesendet wurden. // TODO: Hier wird noch ein Flag benötigt, dass die erfolgte Anzeige des Warndialogs speichert List result = new List(); @@ -74,7 +74,7 @@ namespace ENI2 { if (((aMessage.InternalStatus == Message.BSMDStatus.UPDATED) || (aMessage.InternalStatus == Message.BSMDStatus.SAVED)) && // || - // (aMessage.InternalStatus == Message.BSMDStatus.EXCEL)) && + // (aMessage.InternalStatus == Message.BSMDStatus.EXCEL)) && !aMessage.UnsentMessageWarningShown) { aMessage.UnsentMessageWarningShown = true; @@ -82,7 +82,7 @@ namespace ENI2 result.Add(aMessage.MessageNotificationClassDisplay); } } - + return result; } } @@ -108,26 +108,40 @@ namespace ENI2 } } - public bool HasCriticalInfoMissing(out string messageText) + public bool HasCriticalInfoMissing(out string messageText, string locode) { messageText = ""; // Hier haben wir Logik für Spezialfälle, z.B. dass für BRE und BRV bestimmte Meldeklassen gesendet werden *müssen* - if(this.Core.PoC.Equals("DEBRV") || this.Core.PoC.Equals("DEBRE")) + switch (locode) { - foreach(Message aMessage in _messages) - { - if((aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "NOA_NOD"; return true; } - if ((aMessage.MessageNotificationClass == Message.NotificationClass.AGNT) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "AGNT"; return true; } - if ((aMessage.MessageNotificationClass == Message.NotificationClass.INFO) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "INFO"; return true; } - if ((aMessage.MessageNotificationClass == Message.NotificationClass.SEC) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "SEC"; return true; } - if ((aMessage.MessageNotificationClass == Message.NotificationClass.TIEFA) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "TIEFA"; return true; } - } - } + case "DEBRV": + case "DEBRE": + { + foreach (Message aMessage in _messages) + { + if ((aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "NOA_NOD"; return true; } + if ((aMessage.MessageNotificationClass == Message.NotificationClass.AGNT) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "AGNT"; return true; } + if ((aMessage.MessageNotificationClass == Message.NotificationClass.INFO) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "INFO"; return true; } + if ((aMessage.MessageNotificationClass == Message.NotificationClass.SEC) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "SEC"; return true; } + if ((aMessage.MessageNotificationClass == Message.NotificationClass.TIEFA) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "TIEFA"; return true; } + } + } + break; + case "DEHAM": + foreach (Message aMessage in _messages) + { + if ((aMessage.MessageNotificationClass == Message.NotificationClass.SERV) && (aMessage.InternalStatus != Message.BSMDStatus.CONFIRMED)) { messageText = "SERV"; return true; } + } + break; + default: + break; + } return false; } + #endregion #region Construction @@ -139,7 +153,7 @@ namespace ENI2 shipNameLabel.Text = aCore.Shipname; shipEMailLabel.Text = aCore.HerbergEmailContactReportingVessel; displayIdLabel.Text = aCore.DisplayId; - + // Listbox befüllen this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textOverview, MessageGroupControlType = typeof(OverViewDetailControl), ImagePath = "Resources/documents.png" }); @@ -152,7 +166,7 @@ namespace ENI2 this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textMDH, MessageGroupControlType = typeof(MaritimeHealthDeclarationDetailControl), ImagePath = "Resources/medical_bag.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDepartureNotification, MessageGroupControlType = typeof(DepartureNotificationDetailControl), ImagePath = "Resources/arrow_up_right_green.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textShipData, MessageGroupControlType = typeof(ShipDataDetailControl), ImagePath = "Resources/containership.png" }); - this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textBorderPolice, MessageGroupControlType = typeof(BorderPoliceDetailControl), ImagePath = "Resources/policeman_german.png" }); + this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textBorderPolice, MessageGroupControlType = typeof(BorderPoliceDetailControl), ImagePath = "Resources/policeman_german.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDGArrival, MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textDGDeparture, MessageGroupControlType = typeof(DangerousGoodsDetailControl), ImagePath = "Resources/sign_warning_radiation.png" }); this._listBoxList.Add(new MessageGroup() { MessageGroupName = Properties.Resources.textTowage, MessageGroupControlType = typeof(TowageDetailControl), ImagePath = "Resources/ship2.png" }); @@ -263,7 +277,7 @@ namespace ENI2 detailControl.SetEnabled(isEnabled); if (!isEnabled && (detailControl is OverViewDetailControl control) && !(Core.Cancelled ?? false)) - control.ShowLockedBy(this.LockedBy); + control.ShowLockedBy(this.LockedBy); controlCache.Add(mg.MessageGroupName, detailControl); this.buttonSave.Visibility = Visibility.Hidden; @@ -297,7 +311,7 @@ namespace ENI2 MessageCore newCore = new MessageCore(); cdd.NewCore = newCore; cdd.OldCore = this.Core; - + cdd.Closed += (senderDialog, closeArgs) => { CopyDeclarationDialog closedDialog = senderDialog as CopyDeclarationDialog; @@ -330,19 +344,19 @@ namespace ENI2 if(existingCore != null) { - if(MessageBox.Show(Properties.Resources.textDeclarationAlreadyExists, Properties.Resources.textCaptionExists, + if(MessageBox.Show(Properties.Resources.textDeclarationAlreadyExists, Properties.Resources.textCaptionExists, MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK) { List existingMessages = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessagesForCore(existingCore, DBManager.MessageLoad.ALL); foreach(Message existingMessage in existingMessages) { - if((existingMessage.InternalStatus == Message.BSMDStatus.SENT) && + if((existingMessage.InternalStatus == Message.BSMDStatus.SENT) && (existingMessage.MessageNotificationClass != Message.NotificationClass.VISIT) && (existingMessage.MessageNotificationClass != Message.NotificationClass.TRANSIT)) { MessageBox.Show(Properties.Resources.textMessagesAlreadySent, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Stop); return; - } + } } // delete all existing data of core @@ -356,7 +370,7 @@ namespace ENI2 // Bearbeitungsinformationen für bestehende ID-Beantragung beibehalten, falls bereits vorhanden if(existingCore.IsTransit && - (existingMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT) && + (existingMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT) && (existingMessage.InternalStatus == Message.BSMDStatus.CONFIRMED)) { skipCopyTransit = true; @@ -388,7 +402,7 @@ namespace ENI2 DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(newCore); - // Meldeklassen für neuen Anlauf erzeugen + // Meldeklassen für neuen Anlauf erzeugen List newMessages = new List(); foreach (Message oldMessage in this._messages) { @@ -416,6 +430,7 @@ namespace ENI2 newMessage.SaveElements(); } + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).LoadXtraData(newCore); // reload data from DB and set all rel properites this.OnOpenNewCoreRequested(newCore); } }; @@ -426,7 +441,7 @@ namespace ENI2 { this.LockedByOtherUser = true; // fake flag - // clear existing controls + // clear existing controls this.detailView.Children.Clear(); this.controlCache.Clear(); @@ -443,7 +458,7 @@ namespace ENI2 private void buttonSave_Click(object sender, RoutedEventArgs e) { - MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSavePage, Properties.Resources.textConfirmation, + MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSavePage, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { @@ -494,7 +509,7 @@ namespace ENI2 if(message.MessageNotificationClass == Message.NotificationClass.ATA) { - DetailBaseControl currentControl = this.detailView.Children[0] as DetailBaseControl; + DetailBaseControl currentControl = this.detailView.Children[0] as DetailBaseControl; // ggf. hat sich die Ticketnr geändert.. DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core); } @@ -511,7 +526,7 @@ namespace ENI2 private void buttonSaveAll_Click(object sender, RoutedEventArgs e) { - MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSaveAll, Properties.Resources.textConfirmation, + MessageBoxResult result = MessageBox.Show(Properties.Resources.textQuestionSaveAll, Properties.Resources.textConfirmation, MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { @@ -707,16 +722,16 @@ namespace ENI2 { vViolations = new List(); vErrors = new List(); - + // TODO: clear highlighting Util.UIHelper.SetBusyState(); RuleEngine ruleEngine = new RuleEngine(); foreach (Message aMessage in _messages) - { + { if (!aMessage.EvaluateForValidation(this.Core.IsTransit)) continue; - + List errors = new List(); List violations = new List(); ruleEngine.ValidateMessage(aMessage, out errors, out violations); @@ -748,6 +763,7 @@ namespace ENI2 Message mdhMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.MDH); Message was_rcptMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.WAS_RCPT); Message wasMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.WAS); + Message servMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.SERV); #region CREW / PAS Count Plausibility @@ -791,7 +807,7 @@ namespace ENI2 #region CREW/PAS Schengen Plausibility - // Wir können davon ausgehen, dass bei allen Unterelementen die Flags gleich gesetzt sind. Das wird im Import und BorderPoliceDetailControl sichergestellt. + // Wir können davon ausgehen, dass bei allen Unterelementen die Flags gleich gesetzt sind. Das wird im Import und BorderPoliceDetailControl sichergestellt. if(crewaMessage.Elements.Count > 0) { @@ -800,7 +816,7 @@ namespace ENI2 if (!((crewaFirst.NotificationPAX ?? false) || crewaIsSchengen)) // mindestens eins der beiden { vErrors.Add(RuleEngine.CreateError(ValidationCode.V181, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "CREWA")); ; - } + } } if (crewdMessage != null) @@ -812,7 +828,7 @@ namespace ENI2 if (!((crewdFirst.NotificationPAX ?? false) || crewdIsSchengen)) // mindestens eins der beiden { vErrors.Add(RuleEngine.CreateError(ValidationCode.V181, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "CREWD")); ; - } + } } } @@ -824,7 +840,7 @@ namespace ENI2 if (!(pasIsPAX || pasIsSchengen)) // mindestens eins der beiden { vErrors.Add(RuleEngine.CreateError (ValidationCode.V201, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "PASA")); - } + } } if (pasdMessage != null) @@ -837,7 +853,7 @@ namespace ENI2 if (!(pasdIsPAX || pasdIsSchengen)) // mindestens eins der beiden { vErrors.Add(RuleEngine.CreateError(ValidationCode.V201, "Pax / Schengen: one must be set", null, Properties.Resources.textOverview, null, "PASD")); - } + } } } @@ -853,7 +869,7 @@ namespace ENI2 MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.NO_PAX, "No PAX set (PASA > 12)", null, Properties.Resources.textOverview, null, "PASA"); vViolations.Add(mv); } - + if((crewaMessage != null) && (crewaMessage.Elements.Count > 0)) { CREW firstCREW = crewaMessage.Elements[0] as CREW; @@ -895,8 +911,8 @@ namespace ENI2 crewaMessage.ViolationList.Remove(mv); } - if(crewdMessage != null) - { + if(crewdMessage != null) + { MessageViolation mvd = crewdMessage.ViolationList.Find((x) => x.PropertyName.Equals("Effects") && (x.ViolationCode == (int)ValidationCode.TRUNCATE)); if ((mvd != null) && !Core.IsDK) crewdMessage.ViolationList.Remove(mvd); @@ -1041,7 +1057,7 @@ namespace ENI2 { if (poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && !poc30d.PortOfCallLast30DaysLocode.IsNullOrEmpty()) { - if((poc30d.PortOfCallLast30DaysDateOfDeparture.Value.Date == l10c.PortFacilityDateOfDeparture.Value.Date) && + if((poc30d.PortOfCallLast30DaysDateOfDeparture.Value.Date == l10c.PortFacilityDateOfDeparture.Value.Date) && poc30d.PortOfCallLast30DaysLocode.Equals(l10c.PortFacilityPortLoCode, StringComparison.OrdinalIgnoreCase)) { matchIsFound = true; @@ -1085,6 +1101,22 @@ namespace ENI2 #endregion + #region SERV existence for DEHAM / DEBRE / DEBRV + + if ((!this.Core.DisplayId.IsNullOrEmpty() && this.Core.DisplayId.StartsWith("DEHAM")) || this.Core.PoC.Equals("DEHAM") || + (!this.Core.DisplayId.IsNullOrEmpty() && this.Core.DisplayId.StartsWith("DEBRE")) || this.Core.PoC.Equals("DEBRE") || + (!this.Core.DisplayId.IsNullOrEmpty() && this.Core.DisplayId.StartsWith("DEBRV")) || this.Core.PoC.Equals("DEBRV")) + { + if (servMessage.Elements.Count == 0) + { + MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.LIST_EMPTY, "No entry for SERV found", null, "SERV service provider", null, "SERV"); + mv.MessageGroupName = Properties.Resources.textPortNotification; + vViolations.Add(mv); + } + } + + #endregion + #endregion foreach (MessageError me in vErrors) @@ -1136,8 +1168,8 @@ namespace ENI2 this._errorListDialog.Loaded += (o, e) => this._errorListDialog.RefreshVisible = true; this._errorListDialog.ErrorSelected += _errorListDialog_ErrorSelected; this._errorListDialog.RefreshClicked += _errorListDialog_RefreshClicked; - this._errorListDialog.Show(); - } + this._errorListDialog.Show(); + } else { this._errorListDialog.BringUp(); @@ -1149,12 +1181,12 @@ namespace ENI2 { if(this._violationListDialog == null) { - this._violationListDialog = new ViolationListDialog(); + this._violationListDialog = new ViolationListDialog(); this._violationListDialog.Closed += (o, e) => this._violationListDialog = null; this._violationListDialog.Loaded += (o, e) => this._violationListDialog.RefreshVisible = true; this._violationListDialog.ViolationSelected += _errorListDialog_ErrorSelected; this._violationListDialog.RefreshClicked += _errorListDialog_RefreshClicked; - this._violationListDialog.Show(); + this._violationListDialog.Show(); } else { diff --git a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs index 50d44f47..df66ee58 100644 --- a/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/PortNotificationDetailControl.xaml.cs @@ -173,12 +173,12 @@ namespace ENI2.DetailViewControls #region datagrid LADG private void DataGridLADG_CreateRequested() - { + { EditLADGDialog eld = new EditLADGDialog(); eld.LADG = new LADG(); eld.LADG.MessageHeader = _ladgMessage; eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements); - eld.Core = this.Core; + eld.Core = this.Core; eld.AddClicked += () => { @@ -186,7 +186,7 @@ namespace ENI2.DetailViewControls if (!this._ladgMessage.Elements.Contains(eld.LADG)) this._ladgMessage.Elements.Add(eld.LADG); this.dataGridLADG.Items.Refresh(); - + eld.LADG = new LADG(); eld.LADG.MessageHeader = _ladgMessage; eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements); @@ -195,7 +195,7 @@ namespace ENI2.DetailViewControls if (eld.ShowDialog() ?? false) { - if(!_ladgMessage.Elements.Contains(eld.LADG)) + if(!_ladgMessage.Elements.Contains(eld.LADG)) _ladgMessage.Elements.Add(eld.LADG); this.dataGridLADG.Items.Refresh(); this.SublistElementChanged(Message.NotificationClass.LADG); @@ -231,7 +231,7 @@ namespace ENI2.DetailViewControls this.dataGridLADG.Items.Refresh(); eld.LADG = new LADG(); - eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements); + eld.LADG.Identifier = LADG.GetNewIdentifier(_ladgMessage.Elements); eld.LADG.MessageHeader = _ladgMessage; this.SublistElementChanged(Message.NotificationClass.LADG); }; @@ -256,7 +256,7 @@ namespace ENI2.DetailViewControls #region datagrid SERV private void DataGridSERV_CreateRequested() - { + { EditSERVDialog esd = new EditSERVDialog(); esd.SERV = new SERV(); esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); @@ -266,7 +266,7 @@ namespace ENI2.DetailViewControls { esd.CopyValuesToEntity(); if(!_servMessage.Elements.Contains(esd.SERV)) - _servMessage.Elements.Add(esd.SERV); + _servMessage.Elements.Add(esd.SERV); this.dataGridSERV.Items.Refresh(); esd.SERV = new SERV(); esd.SERV.MessageHeader = _servMessage; @@ -297,7 +297,7 @@ namespace ENI2.DetailViewControls } private void DataGridSERV_EditRequested(DatabaseEntity obj) - { + { EditSERVDialog esd = new EditSERVDialog(); esd.SERV = obj as SERV; @@ -309,7 +309,7 @@ namespace ENI2.DetailViewControls this.dataGridSERV.Items.Refresh(); esd.SERV = new SERV(); - esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); + esd.SERV.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); esd.SERV.MessageHeader = _servMessage; this.SublistElementChanged(Message.NotificationClass.SERV); }; @@ -334,7 +334,7 @@ namespace ENI2.DetailViewControls public override void HighlightErrorMessageContainer() { - if (this._nameMessage.HasErrors) + if (this._nameMessage.HasErrors) HighlightService.HighlightControl(this.nameGroupBox, HighlightService.HighlightStyle.ERROR, this._nameMessage); if (this._infoMessage.HasErrors) HighlightService.HighlightControl(this.infoGroupBox, HighlightService.HighlightStyle.ERROR, this._infoMessage); @@ -400,7 +400,7 @@ namespace ENI2.DetailViewControls DBManager.Instance.Save(this.Core); } } - } + } #endregion @@ -419,14 +419,14 @@ namespace ENI2.DetailViewControls { SERV newServ = new SERV(); newServ.ServiceBeneficiary = "Maersk A/S, Esplanaden 50, DK-1263 Copenhagen K, VAT-ID: DK53139655"; - newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co.KG, Ericusspitze 2-4, 20457 Hamburg"; + newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co.KG, Johanniswall 7, 20095 Hamburg"; newServ.ServiceName = "Maersk BHV"; newServ.MessageHeader = this._servMessage; newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); this._servMessage.Elements.Add(newServ); this.dataGridSERV.Items.Refresh(); this.SublistElementChanged(Message.NotificationClass.SERV); - } + } } private void CheckServiceEntrySeaGoBHV() @@ -442,7 +442,7 @@ namespace ENI2.DetailViewControls { SERV newServ = new SERV(); newServ.ServiceBeneficiary = "Sealand Europe A/S, Dampfaergevej 10, 3.tv, DK- 2100 Copenhagen, VAT-ID: DK53139655"; - newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co. KG on behalf of Sealand Europe A/S, Ericusspitze 2-4, 20457 Hamburg"; + newServ.ServiceInvoiceRecipient = "Maersk Deutschland A/S & Co. KG on behalf of Sealand Europe A/S, Johanniswall 7, 20095 Hamburg"; newServ.ServiceName = "SeaGo BHV"; newServ.MessageHeader = this._servMessage; newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements); @@ -480,7 +480,7 @@ namespace ENI2.DetailViewControls bool found = false; foreach (SERV serv in this._servMessage.Elements) { - if (serv.ServiceName.Equals("FCT JUNGE")) + if (serv.ServiceName.Equals("Fct Junge - Hamburg")) found = true; } @@ -503,7 +503,7 @@ namespace ENI2.DetailViewControls bool found = false; foreach (SERV serv in this._servMessage.Elements) { - if (serv.ServiceName.Equals("ELBE BULK")) + if (serv.ServiceName.Equals("Elbe Bulk Schiffe - Hamburg")) found = true; } @@ -523,15 +523,18 @@ namespace ENI2.DetailViewControls private void buttonSearchPortArea_Click(object sender, RoutedEventArgs e) { - SelectPortAreaDialog spad = new SelectPortAreaDialog(this.Core.PoC); - if(spad.ShowDialog() ?? false) + if (portAreas != null) { - if(spad.SelectedArea != null) + SelectPortAreaDialog spad = new SelectPortAreaDialog(this.Core.PoC); + if (spad.ShowDialog() ?? false) { - if (portAreas.ContainsKey(spad.SelectedArea)) + if (spad.SelectedArea != null) { - var pair = portAreas.SingleOrDefault(p => p.Key == spad.SelectedArea); - this.comboBoxPortArea.SelectedItem = pair; + if (portAreas.ContainsKey(spad.SelectedArea)) + { + var pair = portAreas.SingleOrDefault(p => p.Key == spad.SelectedArea); + this.comboBoxPortArea.SelectedItem = pair; + } } } } diff --git a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs index 861b0782..6bcf8b99 100644 --- a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs @@ -185,12 +185,8 @@ namespace ENI2.DetailViewControls #region init WSDP provider - if(_wsdpTemplates == null) - { - _wsdpTemplates = await DBManagerAsync.GetWastDisposalServiceProviderTemplatesAsync(); - _wsdpTemplates.Sort(); - Trace.WriteLine($"{_wsdpTemplates.Count} WSDP templates loaded"); - } + InitTemplates(); + this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates; #endregion @@ -230,6 +226,7 @@ namespace ENI2.DetailViewControls this.dataGridWasteReceived.ItemsSource = null; dataGridWasteReceipt_SelectionChanged(this, null); } + InitTemplates(); // templates might have changed in the dialog } private void DataGridWasteReceipt_DeleteRequested(DatabaseEntity obj) @@ -275,6 +272,7 @@ namespace ENI2.DetailViewControls this.dataGridWasteReceipt.Items.Refresh(); this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); dataGridWasteReceipt_SelectionChanged(this, null); + InitTemplates(); // templates might have changed in the dialog } private void DataGridWasteReceipt_AddingNewItem(object sender, AddingNewItemEventArgs e) @@ -601,6 +599,15 @@ namespace ENI2.DetailViewControls #region Waste disposal Service Provider templates event handler + private async void InitTemplates() + { + _wsdpTemplates = await DBManagerAsync.GetWastDisposalServiceProviderTemplatesAsync(); + _wsdpTemplates.Sort(); + this.comboBox_WSDPTemplate.ItemsSource = null; + this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates; + Trace.WriteLine($"{_wsdpTemplates.Count} WSDP templates loaded"); + } + private void comboBox_WSDPTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e) { Trace.WriteLine("WSDP combo selection changed"); diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index 13aedfed..0e2780ab 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -36,8 +36,8 @@ 5.4.0.0 true publish.html - 8 - 7.2.2.8 + 3 + 7.2.3.3 false true true @@ -460,9 +460,6 @@ - - VorgaengeControl.xaml - Designer @@ -759,10 +756,6 @@ MSBuild:Compile Designer - - Designer - MSBuild:Compile - diff --git a/ENI2/EditControls/EditWasteReceiptDialog.xaml b/ENI2/EditControls/EditWasteReceiptDialog.xaml index 9a5e8ec3..3179da1b 100644 --- a/ENI2/EditControls/EditWasteReceiptDialog.xaml +++ b/ENI2/EditControls/EditWasteReceiptDialog.xaml @@ -14,6 +14,7 @@ + @@ -30,16 +31,48 @@