kleinere Korrekturen 6.0.9
This commit is contained in:
parent
b5443ef23e
commit
cabb81de1f
@ -45,7 +45,7 @@
|
||||
<DataGridTextColumn Header="Ship name" Binding="{Binding Shipname}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="ETA" Binding="{Binding ETA_NOA_NOD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="ETD" Binding="{Binding ETD_NOA_NOD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="ATA" Binding="{Binding ATA, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="False" />
|
||||
<DataGridTextColumn x:Name="gridColumnATA" Header="ATA" Binding="{Binding ATA, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="False" />
|
||||
<DataGridTextColumn Header="ATD" Binding="{Binding ATD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Hafen" Binding="{Binding PortnameDisplay}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Id" Binding="{Binding DisplayId}" IsReadOnly="True" />
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,9 +14,9 @@ namespace ENI2.Util
|
||||
{
|
||||
internal class DatabaseEntityWatchdog
|
||||
{
|
||||
private Dictionary<MessageCore, DateTime> _watchedEntities = new Dictionary<MessageCore, DateTime>();
|
||||
private object _entityLock = new object();
|
||||
private Timer bgTimer;
|
||||
private readonly Dictionary<MessageCore, DateTime> _watchedEntities = new Dictionary<MessageCore, DateTime>();
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
BIN
nsw/Source/misc/SSN_LOCODES_2020.xlsx
Normal file
BIN
nsw/Source/misc/SSN_LOCODES_2020.xlsx
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user