diff --git a/ENI-2/ENI2/ENI2/App.xaml.cs b/ENI-2/ENI2/ENI2/App.xaml.cs index 17208fc6..d47cc03c 100644 --- a/ENI-2/ENI2/ENI2/App.xaml.cs +++ b/ENI-2/ENI2/ENI2/App.xaml.cs @@ -80,13 +80,15 @@ namespace ENI2 // Preload validation fields List vFields = bsmd.database.ValidationRule.ValidationFields; - RuleEngine.RegisterLocodeChecker(bsmd.ExcelReadService.LocodeDB.IsValidLocode); + RuleEngine.RegisterLocodeChecker(Util.GlobalStructures.IsValidLocode); // Connect to locking service (if enabled) try { if (ENI2.Properties.Settings.Default.UseLocking) - App._lockingServiceClient = new ServiceClient("BasicHttpBinding_IService", ENI2.Properties.Settings.Default.LockingServerAddress); + { + App._lockingServiceClient = new ServiceClient("BasicHttpBinding_IService", ENI2.Properties.Settings.Default.LockingServerAddress); + } } catch (Exception ex) { diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index 442eee90..d31947a9 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -369,7 +369,8 @@ namespace ENI2 private void DetailControl_RequestSendValidation() { - this.Validate(false); + this.Validate(false); + foreach(Message aMessage in this._messages) { if(aMessage.InternalStatus == Message.BSMDStatus.TOSEND) @@ -387,6 +388,56 @@ namespace ENI2 } } } + + // NOA_NOD vor ATA vor ATD Versendereihenfolge sicherstellen + bool noa_nod_queued_or_sent = false; + bool ata_queued_or_sent = false; + foreach(Message aMessage in this._messages) + { + if(aMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) + { + if ((aMessage.SendSuccess ?? false) || (aMessage.InternalStatus == Message.BSMDStatus.TOSEND)) + noa_nod_queued_or_sent = true; + } + if (aMessage.MessageNotificationClass == Message.NotificationClass.ATA) + { + if ((aMessage.SendSuccess ?? false) || (aMessage.InternalStatus == Message.BSMDStatus.TOSEND)) + ata_queued_or_sent = true; + } + } + + foreach(Message aMessage in this._messages) + { + if((aMessage.MessageNotificationClass == Message.NotificationClass.ATA) && (aMessage.InternalStatus == Message.BSMDStatus.TOSEND)) + { + if(!noa_nod_queued_or_sent) + { + aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED; + aMessage.ChangedBy = ""; + aMessage.StatusInfo = string.Format("Validation error: NOA_NOD must be sent before ATA"); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); + } + } + + if ((aMessage.MessageNotificationClass == Message.NotificationClass.ATD) && (aMessage.InternalStatus == Message.BSMDStatus.TOSEND)) + { + if (!noa_nod_queued_or_sent) + { + aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED; + aMessage.ChangedBy = ""; + aMessage.StatusInfo = string.Format("Validation error: NOA_NOD must be sent before ATD"); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); + } + + if(!ata_queued_or_sent) + { + aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED; + aMessage.ChangedBy = ""; + aMessage.StatusInfo = string.Format("Validation error: ATA must be sent before ATD"); + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); + } + } + } } private void DetailControl_RequestValidate() diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs index f908c96b..8d84a26d 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs @@ -84,7 +84,7 @@ namespace ENI2.DetailViewControls vtBinding.Source = this.Core; vtBinding.Path = this.Core.IsTransit ? new PropertyPath("TransitId") : new PropertyPath("VisitId"); vtBinding.Mode = BindingMode.TwoWay; - vtBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; + vtBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; BindingOperations.SetBinding(textBoxDisplayId, TextBox.TextProperty, vtBinding); if (this.Core.Cancelled ?? false) this.ShowCancelledLabel(); @@ -379,9 +379,13 @@ namespace ENI2.DetailViewControls { this.textBoxDisplayId.DataContext = null; this.textBoxDisplayId.DataContext = this.Core; + this.textBoxDisplayId.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); + this.labelBSMDStatusInternal.DataContext = null; this.labelBSMDStatusInternal.DataContext = this.Core; - MessageBox.Show("Visit/Transit ID updated!"); + this.labelBSMDStatusInternal.GetBindingExpression(Label.ContentProperty)?.UpdateTarget(); + + MessageBox.Show(string.Format("Visit/Transit ID updated: {0}", this.Core.DisplayId)); } #endregion diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml index 3d1481eb..aea79bb5 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/SecurityDetailControl.xaml @@ -92,7 +92,13 @@ - + + + + +