diff --git a/ENI-2/ENI2/ENI2/Controls/POListControl.xaml b/ENI-2/ENI2/ENI2/Controls/POListControl.xaml
index 07e87b8e..e31fee13 100644
--- a/ENI-2/ENI2/ENI2/Controls/POListControl.xaml
+++ b/ENI-2/ENI2/ENI2/Controls/POListControl.xaml
@@ -45,7 +45,7 @@
-
+
diff --git a/ENI-2/ENI2/ENI2/Controls/POListControl.xaml.cs b/ENI-2/ENI2/ENI2/Controls/POListControl.xaml.cs
index dced08f9..040ec95f 100644
--- a/ENI-2/ENI2/ENI2/Controls/POListControl.xaml.cs
+++ b/ENI-2/ENI2/ENI2/Controls/POListControl.xaml.cs
@@ -106,6 +106,16 @@ namespace ENI2.Controls
{
DBManager.Instance.Save(messageCore);
messageCore.IsDirty = false;
+ // load ATA for this Core
+ Message ataMessage = DBManager.Instance.GetMessage(messageCore, Message.NotificationClass.ATA);
+ if(ataMessage?.Elements.Count == 1)
+ {
+ if(messageCore.ATA != ((ATA)ataMessage.Elements[0]).ATAPortOfCall)
+ {
+ ((ATA)ataMessage.Elements[0]).ATAPortOfCall = messageCore.ATA;
+ DBManager.Instance.Save(ataMessage.Elements[0]);
+ }
+ }
}
}
this.buttonSaveChanges.IsEnabled = false;
@@ -174,6 +184,22 @@ namespace ENI2.Controls
buttonSaveChanges.IsEnabled = true;
editedCore.IsDirty = true;
}
+ if(e.Column == gridColumnATA)
+ {
+ var el = e.EditingElement as System.Windows.Controls.TextBox;
+ if(DateTime.TryParse(el.Text, out DateTime localATA))
+ {
+ MessageCore editedCore = this.filteredResult[e.Row.GetIndex()];
+ editedCore.ATA = DateTime.SpecifyKind(localATA, DateTimeKind.Local).ToUniversalTime();
+ buttonSaveChanges.IsEnabled = true;
+ editedCore.IsDirty = true;
+ }
+ else
+ {
+ el.Text = string.Empty;
+ e.Cancel = true;
+ }
+ }
}
}
diff --git a/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs b/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs
index 525bfc66..226e2bf6 100644
--- a/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs
+++ b/ENI-2/ENI2/ENI2/Util/DatabaseEntityWatchdog.cs
@@ -14,9 +14,9 @@ namespace ENI2.Util
{
internal class DatabaseEntityWatchdog
{
- private Dictionary _watchedEntities = new Dictionary();
- private object _entityLock = new object();
- private Timer bgTimer;
+ private readonly Dictionary _watchedEntities = new Dictionary();
+ private readonly object _entityLock = new object();
+ private readonly Timer bgTimer;
public delegate void DatabaseEntityChangedHandler (DatabaseEntity entity);
@@ -41,7 +41,7 @@ namespace ENI2.Util
MessageCore entity = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoreById(watchedEntity.Id ?? Guid.Empty);
if (entity != null)
{
- if (entity.Changed.HasValue && (entity.Changed.Value > this._watchedEntities[watchedEntity]))
+ if (entity.Changed > this._watchedEntities[watchedEntity])
{
OnDatabaseEntityChanged(entity);
changedCores.Add(entity);
@@ -49,27 +49,17 @@ namespace ENI2.Util
if(entity.IsTransit)
{
- if (!entity.TransitId.IsNullOrEmpty())
+ if (!entity.TransitId.IsNullOrEmpty() && !watchedEntity.TransitId.IsNullOrEmpty() && !entity.TransitId.Equals(watchedEntity.TransitId))
{
- if ((watchedEntity.TransitId.IsNullOrEmpty()) && !entity.TransitId.Equals(watchedEntity.TransitId))
- {
- OnVisitTransitIdUpdated(entity);
- watchedEntity.TransitId = entity.TransitId;
- }
+ OnVisitTransitIdUpdated(entity);
+ watchedEntity.TransitId = entity.TransitId;
}
}
- else
+ else if (!entity.VisitId.IsNullOrEmpty() && !watchedEntity.VisitId.IsNullOrEmpty() && !entity.VisitId.Equals(watchedEntity.VisitId))
{
- if (!entity.VisitId.IsNullOrEmpty())
- {
- if ((watchedEntity.VisitId.IsNullOrEmpty()) && !entity.VisitId.Equals(watchedEntity.VisitId))
- {
- OnVisitTransitIdUpdated(entity);
- watchedEntity.VisitId = entity.VisitId;
- }
- }
+ OnVisitTransitIdUpdated(entity);
+ watchedEntity.VisitId = entity.VisitId;
}
-
}
}
diff --git a/ENI-2/ENI2/ENI2/Util/UtcToLocalDateTimeConverter.cs b/ENI-2/ENI2/ENI2/Util/UtcToLocalDateTimeConverter.cs
index cd990de7..4b203d8f 100644
--- a/ENI-2/ENI2/ENI2/Util/UtcToLocalDateTimeConverter.cs
+++ b/ENI-2/ENI2/ENI2/Util/UtcToLocalDateTimeConverter.cs
@@ -35,11 +35,29 @@ namespace ENI2.Util
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
- DateTime? sourceVal = (DateTime?)value;
- if (sourceVal.HasValue)
- return DateTime.SpecifyKind(sourceVal.Value, DateTimeKind.Local).ToUniversalTime();
+ if(value is string dateString)
+ {
+ if(DateTime.TryParse(dateString, out DateTime theValue))
+ {
+ return DateTime.SpecifyKind(theValue, DateTimeKind.Local).ToUniversalTime();
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else if(value is DateTime?)
+ {
+ DateTime? sourceVal = (DateTime?)value;
+ if (sourceVal.HasValue)
+ return DateTime.SpecifyKind(sourceVal.Value, DateTimeKind.Local).ToUniversalTime();
+ else
+ return null;
+ }
else
+ {
return null;
+ }
}
}
}
diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx
index 8e39b451..c26e9a33 100644
Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ
diff --git a/nsw/Source/misc/SSN_LOCODES_2020.xlsx b/nsw/Source/misc/SSN_LOCODES_2020.xlsx
new file mode 100644
index 00000000..dce64117
Binary files /dev/null and b/nsw/Source/misc/SSN_LOCODES_2020.xlsx differ
diff --git a/nsw/Source/misc/db.sqlite b/nsw/Source/misc/db.sqlite
index 5dea2441..9390e8b9 100644
Binary files a/nsw/Source/misc/db.sqlite and b/nsw/Source/misc/db.sqlite differ