History zurückschreiben Zwischenstand
This commit is contained in:
parent
d4c898ed93
commit
974817a443
@ -42,7 +42,7 @@ namespace ENI2
|
||||
if(sender != null)
|
||||
{
|
||||
DataGrid grid = sender as DataGrid;
|
||||
if((grid != null) && (grid.SelectedItems != null) && (grid.SelectedItems.Count == 1))
|
||||
if(grid?.SelectedItems?.Count == 1)
|
||||
{
|
||||
DataGridRow dgr = grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem) as DataGridRow;
|
||||
MessageCore selectedCore = grid.SelectedItem as MessageCore;
|
||||
|
||||
@ -37,15 +37,12 @@ namespace ENI2.Controls
|
||||
var okButton = (Button)Template.FindName("buttonOK", this);
|
||||
var cancelButton = (Button)Template.FindName("buttonCancel", this);
|
||||
var addButton = (Button)Template.FindName("buttonAdd", this);
|
||||
okButton.Click += (s, e) => { if (IsModal) DialogResult = true; OKClicked?.Invoke(); this.Close(); };
|
||||
cancelButton.Click += (s, e) => { if (IsModal) DialogResult = false; CancelClicked?.Invoke(); this.Close(); };
|
||||
addButton.Click += (s, e) => { AddClicked?.Invoke(); };
|
||||
okButton.Click += (s, e) => { if (this.IsModal()) DialogResult = true; OKClicked?.Invoke(); this.Close(); };
|
||||
cancelButton.Click += (s, e) => { if (this.IsModal()) DialogResult = false; CancelClicked?.Invoke(); this.Close(); };
|
||||
addButton.Click += (s, e) => AddClicked?.Invoke();
|
||||
};
|
||||
this.IsModal = true; // default
|
||||
}
|
||||
|
||||
public bool IsModal { get; set; }
|
||||
|
||||
public bool AddVisible
|
||||
{
|
||||
get { var addButton = (Button)Template.FindName("buttonAdd", this); return addButton.Visibility == Visibility.Visible; }
|
||||
|
||||
@ -46,10 +46,9 @@ namespace ENI2.Controls
|
||||
|
||||
private void ResetItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if ((this.dataGridReportingParties.SelectedItems != null) && (this.dataGridReportingParties.SelectedItems.Count == 1) && !this.dataGridReportingParties.IsReadOnly)
|
||||
if ((this.dataGridReportingParties.SelectedItems?.Count == 1) && !this.dataGridReportingParties.IsReadOnly)
|
||||
{
|
||||
ReportingParty selectedParty = this.dataGridReportingParties.SelectedItems[0] as ReportingParty;
|
||||
if (selectedParty != null)
|
||||
if (this.dataGridReportingParties.SelectedItems[0] is ReportingParty selectedParty)
|
||||
{
|
||||
string confirmText = string.Format(Properties.Resources.textConfirmPasswordReset, selectedParty.Logon);
|
||||
MessageBoxResult result = MessageBox.Show(confirmText, Properties.Resources.textCaptionDeleteConfirm, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
@ -59,7 +58,7 @@ namespace ENI2.Controls
|
||||
selectedParty.Salt = null;
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedParty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,8 +66,7 @@ namespace ENI2.Controls
|
||||
|
||||
private void DataGridReportingParties_DeleteRequested(DatabaseEntity obj)
|
||||
{
|
||||
ReportingParty rp = obj as ReportingParty;
|
||||
if (rp != null)
|
||||
if (obj is ReportingParty rp)
|
||||
{
|
||||
// are you sure dialog is in base class
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(rp);
|
||||
@ -79,15 +77,14 @@ namespace ENI2.Controls
|
||||
|
||||
private void DataGridReportingParties_EditRequested(DatabaseEntity obj)
|
||||
{
|
||||
ReportingParty rp = obj as ReportingParty;
|
||||
if (rp != null)
|
||||
if (obj is ReportingParty rp)
|
||||
{
|
||||
EditReportingPartyDialog eld = new EditReportingPartyDialog();
|
||||
eld.ReportingParty = rp;
|
||||
eld.ReportingParty = rp;
|
||||
|
||||
if (eld.ShowDialog() ?? false)
|
||||
{
|
||||
this.dataGridReportingParties.Items.Refresh();
|
||||
this.dataGridReportingParties.Items.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,14 +32,11 @@ namespace ENI2.Controls
|
||||
var closeButton = (Button)Template.FindName("buttonClose", this);
|
||||
var refreshButton = (Button)Template.FindName("buttonRefresh", this);
|
||||
|
||||
closeButton.Click += (s, e) => { if (IsModal) DialogResult = true; CloseClicked?.Invoke(); this.Close(); };
|
||||
closeButton.Click += (s, e) => { if (this.IsModal()) DialogResult = true; CloseClicked?.Invoke(); this.Close(); };
|
||||
refreshButton.Click += (s, e) => { RefreshClicked?.Invoke(); };
|
||||
|
||||
};
|
||||
this.IsModal = true; // default
|
||||
}
|
||||
|
||||
public bool IsModal { get; set; }
|
||||
};
|
||||
}
|
||||
|
||||
public bool RefreshVisible
|
||||
{
|
||||
|
||||
@ -29,10 +29,9 @@ namespace ENI2
|
||||
private DependencyPropertyDescriptor _dpComboboxValue;
|
||||
private DependencyPropertyDescriptor _dpNumericUpdown;
|
||||
private DependencyPropertyDescriptor _dpIntUpdown;
|
||||
private Dictionary<Object, Message.NotificationClass> _controlClassDict = new Dictionary<object, Message.NotificationClass>();
|
||||
private Dictionary<Message.NotificationClass, Message> _typeMessageDict = new Dictionary<Message.NotificationClass, Message>();
|
||||
private List<Message> _controlMessages = new List<Message>();
|
||||
|
||||
private readonly Dictionary<Object, Message.NotificationClass> _controlClassDict = new Dictionary<object, Message.NotificationClass>();
|
||||
private readonly Dictionary<Message.NotificationClass, Message> _typeMessageDict = new Dictionary<Message.NotificationClass, Message>();
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
@ -109,7 +108,7 @@ namespace ENI2
|
||||
/// <summary>
|
||||
/// particular messages that are edited on this page
|
||||
/// </summary>
|
||||
public List<Message> ControlMessages { get { return this._controlMessages; } }
|
||||
public List<Message> ControlMessages { get; } = new List<Message>();
|
||||
|
||||
public bool LockedByOtherUser { get; set; }
|
||||
|
||||
|
||||
@ -203,8 +203,7 @@ namespace ENI2
|
||||
MessageCore newCore = new MessageCore();
|
||||
cdd.NewCore = newCore;
|
||||
cdd.OldCore = this.Core;
|
||||
|
||||
cdd.IsModal = false;
|
||||
|
||||
cdd.Closed += (senderDialog, closeArgs) =>
|
||||
{
|
||||
CopyDeclarationDialog closedDialog = senderDialog as CopyDeclarationDialog;
|
||||
@ -734,9 +733,8 @@ namespace ENI2
|
||||
this._errorListDialog.Closed += (o, e) => this._errorListDialog = null;
|
||||
this._errorListDialog.Loaded += (o, e) => this._errorListDialog.RefreshVisible = true;
|
||||
this._errorListDialog.ErrorSelected += _errorListDialog_ErrorSelected;
|
||||
this._errorListDialog.RefreshClicked += _errorListDialog_RefreshClicked;
|
||||
this._errorListDialog.IsModal = false;
|
||||
this._errorListDialog.Show();
|
||||
this._errorListDialog.RefreshClicked += _errorListDialog_RefreshClicked;
|
||||
this._errorListDialog.ShowDialog();
|
||||
}
|
||||
this._errorListDialog.Errors = vErrors;
|
||||
}
|
||||
@ -749,8 +747,7 @@ namespace ENI2
|
||||
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.IsModal = false;
|
||||
this._violationListDialog.RefreshClicked += _errorListDialog_RefreshClicked;
|
||||
this._violationListDialog.Show();
|
||||
}
|
||||
_violationListDialog.Violations = vViolations;
|
||||
|
||||
@ -146,6 +146,15 @@ namespace ENI2.DetailViewControls
|
||||
pdfItem.Click += this.buttonCreatePDF_Click;
|
||||
this.dataGridMessages.ContextMenu.Items.Add(pdfItem);
|
||||
|
||||
MenuItem historyItem = new MenuItem
|
||||
{
|
||||
Header = Properties.Resources.textHistoryItems,
|
||||
Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/clock_history.png")) }
|
||||
};
|
||||
historyItem.Click += HistoryItem_Click;
|
||||
this.dataGridMessages.ContextMenu.Items.Add(historyItem);
|
||||
historyItem.IsEnabled = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsAdmin; // TODO: rechtzeitig wieder entfernen!
|
||||
|
||||
#endregion
|
||||
|
||||
#region lokale Meldeklassen
|
||||
@ -442,7 +451,7 @@ namespace ENI2.DetailViewControls
|
||||
{
|
||||
if ((sender is DataGrid grid) && (grid.SelectedItems?.Count == 1))
|
||||
{
|
||||
DataGridRow dgr = grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem) as DataGridRow;
|
||||
// DataGridRow dgr = grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem) as DataGridRow;
|
||||
Message selectedMessage = grid.SelectedItem as Message;
|
||||
this.jumpToMessage(selectedMessage);
|
||||
}
|
||||
@ -466,6 +475,18 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
#region Command button event handler
|
||||
|
||||
private void HistoryItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(this.dataGridMessages.SelectedItems.Count > 0)
|
||||
{
|
||||
Message historyMessage = this.dataGridMessages.SelectedItems[0] as Message;
|
||||
MessageHistoryDialog mhd = new MessageHistoryDialog();
|
||||
mhd.Messages = this.Messages;
|
||||
mhd.MessageHistories = DBManager.Instance.GetMessageHistories(historyMessage.Id.Value);
|
||||
mhd.Show();
|
||||
}
|
||||
}
|
||||
|
||||
private void contextSendMessage(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBoxResult result = MessageBox.Show(Properties.Resources.textConfirmSend, Properties.Resources.textConfirm, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
@ -550,9 +571,7 @@ namespace ENI2.DetailViewControls
|
||||
{
|
||||
if(this.Core.InitialHIS != _message.HIS)
|
||||
{
|
||||
MessageBoxResult noMatchResult = MessageBox.Show(Properties.Resources.textHISNotMatching, Properties.Resources.textConfirm,
|
||||
MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
// todo: Hier den "Egal!" Fall berücksichtigen?
|
||||
MessageBox.Show(Properties.Resources.textHISNotMatching, Properties.Resources.textConfirm, MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -634,8 +653,7 @@ namespace ENI2.DetailViewControls
|
||||
{
|
||||
MessageCore reloadedCore = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoreById(this.Core.Id.Value);
|
||||
CoreStatusInfoDialog csid = new CoreStatusInfoDialog
|
||||
{
|
||||
IsModal = false,
|
||||
{
|
||||
Core = reloadedCore
|
||||
};
|
||||
csid.Show();
|
||||
@ -661,8 +679,7 @@ namespace ENI2.DetailViewControls
|
||||
private void buttonInfoCore_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SimplePropertyViewDialog spvd = new SimplePropertyViewDialog
|
||||
{
|
||||
IsModal = false,
|
||||
{
|
||||
DisplayObject = this.Core
|
||||
};
|
||||
spvd.Show();
|
||||
|
||||
@ -163,7 +163,8 @@ namespace ENI2.DetailViewControls
|
||||
// are you sure dialog is in base class
|
||||
_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Remove(s2s);
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(s2s);
|
||||
DatabaseEntity.ResetIdentifiers(_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled);
|
||||
List<DatabaseEntity> tmpList = new List<DatabaseEntity>(_sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled);
|
||||
DatabaseEntity.ResetIdentifiers(tmpList);
|
||||
this.SublistElementChanged(Message.NotificationClass.SEC);
|
||||
this.dataGridShip2ShipActivities.Items.Refresh();
|
||||
}
|
||||
@ -246,7 +247,8 @@ namespace ENI2.DetailViewControls
|
||||
// are you sure dialog is in base class
|
||||
_sec.LastTenPortFacilitesCalled.Remove(l10c);
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(l10c);
|
||||
DatabaseEntity.ResetIdentifiers(_sec.LastTenPortFacilitesCalled);
|
||||
List<DatabaseEntity> tmpList = new List<DatabaseEntity>(_sec.LastTenPortFacilitesCalled);
|
||||
DatabaseEntity.ResetIdentifiers(tmpList);// );
|
||||
this.SublistElementChanged(Message.NotificationClass.SEC);
|
||||
this.dataGridLast10PortFacilities.Items.Refresh();
|
||||
}
|
||||
|
||||
@ -300,6 +300,9 @@
|
||||
<Compile Include="EditControls\ErrorListDialog.xaml.cs">
|
||||
<DependentUpon>ErrorListDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="EditControls\MessageHistoryDialog.xaml.cs">
|
||||
<DependentUpon>MessageHistoryDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="EditControls\NewWithIdDialog.xaml.cs">
|
||||
<DependentUpon>NewWithIdDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -535,6 +538,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="EditControls\MessageHistoryDialog.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="EditControls\NewWithIdDialog.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@ -675,6 +682,9 @@
|
||||
<Resource Include="Resources\id_card_add.ico" />
|
||||
<Resource Include="Resources\id_card_new.ico" />
|
||||
<Resource Include="Resources\id_cards.ico" />
|
||||
<Resource Include="Resources\clock_history.png" />
|
||||
<Resource Include="Resources\clock_history.ico" />
|
||||
<Resource Include="Resources\document_down.png" />
|
||||
<Content Include="x64\SQLite.Interop.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
27
ENI-2/ENI2/ENI2/EditControls/MessageHistoryDialog.xaml
Normal file
27
ENI-2/ENI2/ENI2/EditControls/MessageHistoryDialog.xaml
Normal file
@ -0,0 +1,27 @@
|
||||
<enictrl:StatusWindowBase x:Class="ENI2.EditControls.MessageHistoryDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:ENI2.EditControls"
|
||||
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||
xmlns:p="clr-namespace:ENI2.Properties"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static p:Resources.textMessageHistory}" Height="450" Width="800" Background="AliceBlue" Icon="/ENI2;component/Resources/clock_history.ico">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<enictrl:ENIDataGrid Grid.Row="0" Grid.Column="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
SelectionMode="Single" AutoGenerateColumns="False" Margin="5,5,5,0" x:Name="dataGridMessageHistories" MouseDoubleClick="DataGridViolations_MouseDoubleClick">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textType}" Binding="{Binding EntityName}" IsReadOnly="True" Width="0.05*" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textTimestamp}" Binding="{Binding Created}" IsReadOnly="True" Width="0.1*" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textReportingParty}" Binding="{Binding ReportingPartyName}" IsReadOnly="True" Width="0.15*" />
|
||||
</DataGrid.Columns>
|
||||
</enictrl:ENIDataGrid>
|
||||
</Grid>
|
||||
</enictrl:StatusWindowBase>
|
||||
129
ENI-2/ENI2/ENI2/EditControls/MessageHistoryDialog.xaml.cs
Normal file
129
ENI-2/ENI2/ENI2/EditControls/MessageHistoryDialog.xaml.cs
Normal file
@ -0,0 +1,129 @@
|
||||
// Copyright (c) 2017 schick Informatik
|
||||
// Description: Übersicht Speicherreihenfolge zu diesem Objekt
|
||||
//
|
||||
|
||||
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.Shapes;
|
||||
using bsmd.database;
|
||||
using ENI2.Controls;
|
||||
using log4net;
|
||||
|
||||
namespace ENI2.EditControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MessageHistoryDialog.xaml
|
||||
/// </summary>
|
||||
public partial class MessageHistoryDialog : StatusWindowBase
|
||||
{
|
||||
|
||||
private static readonly ILog _log = LogManager.GetLogger(typeof(MessageHistoryDialog));
|
||||
|
||||
public MessageHistoryDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += (o, e) =>
|
||||
{
|
||||
this.dataGridMessageHistories.ItemsSource = this.MessageHistories;
|
||||
|
||||
this.dataGridMessageHistories.ContextMenu = new ContextMenu();
|
||||
|
||||
MenuItem showDetailItem = new MenuItem
|
||||
{
|
||||
Header = Properties.Resources.textShowData,
|
||||
Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/document_view.png")) }
|
||||
};
|
||||
showDetailItem.Click += ShowDetailItem_Click;
|
||||
this.dataGridMessageHistories.ContextMenu.Items.Add(showDetailItem);
|
||||
|
||||
MenuItem copyDataItem = new MenuItem
|
||||
{
|
||||
Header = Properties.Resources.textCopyData,
|
||||
Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/document_down.png")) }
|
||||
};
|
||||
copyDataItem.Click += CopyDataItem_Click;
|
||||
this.dataGridMessageHistories.ContextMenu.Items.Add(copyDataItem);
|
||||
};
|
||||
}
|
||||
|
||||
#region Properties
|
||||
|
||||
public List<MessageHistory> MessageHistories { get; set; }
|
||||
|
||||
public List<Message> Messages { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region event handler
|
||||
|
||||
private void ShowDetailItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DataGridViolations_MouseDoubleClick(sender, null);
|
||||
}
|
||||
|
||||
private void DataGridViolations_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (this.dataGridMessageHistories.SelectedItem is MessageHistory selectedHistory)
|
||||
{
|
||||
SimplePropertyViewDialog spvd = new SimplePropertyViewDialog();
|
||||
spvd.Title = "Message history";
|
||||
spvd.DisplayObject = selectedHistory.CreateObjectFromValues();
|
||||
spvd.Show();
|
||||
}
|
||||
}
|
||||
|
||||
private void CopyDataItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.dataGridMessageHistories.SelectedItem is MessageHistory selectedHistory)
|
||||
{
|
||||
if (MessageBox.Show("Overwrite data selected message class?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
|
||||
{
|
||||
Message targetMessage = null;
|
||||
foreach (Message aMessage in this.Messages)
|
||||
{
|
||||
if (aMessage.MessageNotificationClassDisplay.Equals(selectedHistory.EntityName))
|
||||
{
|
||||
targetMessage = aMessage;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (targetMessage != null)
|
||||
{
|
||||
_log.InfoFormat("Message {0} Id {1} will be restored from {2}", selectedHistory.EntityName, targetMessage.Id, selectedHistory.Created);
|
||||
DatabaseEntity selectedItem = selectedHistory.CreateObjectFromValues() as DatabaseEntity;
|
||||
// Fallunterscheidung: a) ISublistElement oder nicht? Falls ja müssen die anderen Elemente zusammengesucht werden
|
||||
if(Message.IsListClass(targetMessage.MessageNotificationClass)) // Meldeklasse ist also z.B. LADG, CREW, PAS..
|
||||
{
|
||||
foreach (DatabaseEntity oldElement in targetMessage.Elements)
|
||||
DBManager.Instance.Delete(oldElement);
|
||||
foreach (DatabaseEntity element in selectedHistory.GetGroup(this.MessageHistories))
|
||||
targetMessage.Elements.Add(element);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetMessage.Elements[0].OverwriteWith(selectedItem);
|
||||
}
|
||||
DBManager.Instance.Save(targetMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.WarnFormat("Cannot find message {0} to restore history element with id {1}", selectedHistory.EntityName, selectedHistory.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@ -38,7 +38,7 @@ namespace ENI2
|
||||
private ServerStatusControl statusControl;
|
||||
private readonly SucheControl sucheControl;
|
||||
|
||||
private readonly List<MessageCore> anmeldungen = new List<MessageCore>();
|
||||
// private readonly List<MessageCore> anmeldungen = new List<MessageCore>();
|
||||
private bool efMode = false;
|
||||
private bool dbConnected;
|
||||
private readonly ScaleTransform _transform = new ScaleTransform(1.0, 1.0);
|
||||
@ -336,8 +336,7 @@ namespace ENI2
|
||||
|
||||
MessageCore newCore = new MessageCore();
|
||||
VisitIdDialog visitIdDialog = new VisitIdDialog();
|
||||
visitIdDialog.Core = newCore;
|
||||
visitIdDialog.IsModal = false;
|
||||
visitIdDialog.Core = newCore;
|
||||
visitIdDialog.Closed += (senderDialog, closeArgs) =>
|
||||
{
|
||||
VisitIdDialog closedDialog = senderDialog as VisitIdDialog;
|
||||
@ -370,8 +369,7 @@ namespace ENI2
|
||||
/// </summary>
|
||||
private void buttonNewWithIdClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
NewWithIdDialog newWithIdDialog = new NewWithIdDialog();
|
||||
newWithIdDialog.IsModal = false;
|
||||
NewWithIdDialog newWithIdDialog = new NewWithIdDialog();
|
||||
newWithIdDialog.OKClicked += new Action(() =>
|
||||
{
|
||||
|
||||
@ -444,8 +442,8 @@ namespace ENI2
|
||||
TabItem tabitem = this.openTabs[changedCore.Id.Value];
|
||||
this.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
if (tabitem is ClosableTabItem)
|
||||
((ClosableTabItem)tabitem).IsHighlighted = true;
|
||||
if (tabitem is ClosableTabItem closableTabItem)
|
||||
(closableTabItem).IsHighlighted = true;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
84
ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
generated
84
ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
generated
@ -220,6 +220,26 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap clock_history {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("clock_history", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
public static System.Drawing.Icon clock_historyIcon {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("clock_historyIcon", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
@ -260,6 +280,16 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap document_down {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("document_down", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
@ -1457,6 +1487,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copy to current message (overwrite).
|
||||
/// </summary>
|
||||
public static string textCopyToMessageClass {
|
||||
get {
|
||||
return ResourceManager.GetString("textCopyToMessageClass", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copy TOWA to TOWD.
|
||||
/// </summary>
|
||||
@ -2213,6 +2252,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show item history.
|
||||
/// </summary>
|
||||
public static string textHistoryItems {
|
||||
get {
|
||||
return ResourceManager.GetString("textHistoryItems", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to IBC item.
|
||||
/// </summary>
|
||||
@ -2897,6 +2945,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Message history.
|
||||
/// </summary>
|
||||
public static string textMessageHistory {
|
||||
get {
|
||||
return ResourceManager.GetString("textMessageHistory", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Message reset at {0}.
|
||||
/// </summary>
|
||||
@ -4022,6 +4079,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show data.
|
||||
/// </summary>
|
||||
public static string textShowData {
|
||||
get {
|
||||
return ResourceManager.GetString("textShowData", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Sick animals or pets on board?.
|
||||
/// </summary>
|
||||
@ -4265,6 +4331,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Timestamp.
|
||||
/// </summary>
|
||||
public static string textTimestamp {
|
||||
get {
|
||||
return ResourceManager.GetString("textTimestamp", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show message core database fields (Detail).
|
||||
/// </summary>
|
||||
@ -4364,6 +4439,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Type.
|
||||
/// </summary>
|
||||
public static string textType {
|
||||
get {
|
||||
return ResourceManager.GetString("textType", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Type for Locode....
|
||||
/// </summary>
|
||||
|
||||
@ -1663,4 +1663,31 @@
|
||||
<data name="textUndoCancel" xml:space="preserve">
|
||||
<value>Reset "Cancelled" flag in database</value>
|
||||
</data>
|
||||
<data name="textHistoryItems" xml:space="preserve">
|
||||
<value>Show item history</value>
|
||||
</data>
|
||||
<data name="textMessageHistory" xml:space="preserve">
|
||||
<value>Message history</value>
|
||||
</data>
|
||||
<data name="clock_history" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\clock_history.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="clock_historyIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\clock_history.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="textTimestamp" xml:space="preserve">
|
||||
<value>Timestamp</value>
|
||||
</data>
|
||||
<data name="textType" xml:space="preserve">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
<data name="document_down" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\document_down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="textCopyToMessageClass" xml:space="preserve">
|
||||
<value>Copy to current message (overwrite)</value>
|
||||
</data>
|
||||
<data name="textShowData" xml:space="preserve">
|
||||
<value>Show data</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
ENI-2/ENI2/ENI2/Resources/clock_history.ico
Normal file
BIN
ENI-2/ENI2/ENI2/Resources/clock_history.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
BIN
ENI-2/ENI2/ENI2/Resources/clock_history.png
Normal file
BIN
ENI-2/ENI2/ENI2/Resources/clock_history.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
ENI-2/ENI2/ENI2/Resources/document_down.png
Normal file
BIN
ENI-2/ENI2/ENI2/Resources/document_down.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@ -22,8 +22,8 @@ namespace ENI2
|
||||
public partial class SucheControl : UserControl
|
||||
{
|
||||
private List<MessageCore> anmeldungen = new List<MessageCore>();
|
||||
private object searchLock = new object();
|
||||
private ILog _log = LogManager.GetLogger("SucheControl");
|
||||
private readonly object searchLock = new object();
|
||||
private readonly ILog _log = LogManager.GetLogger("SucheControl");
|
||||
private MenuItem cancelItem;
|
||||
|
||||
#region Construction
|
||||
@ -42,7 +42,7 @@ namespace ENI2
|
||||
MenuItem addItem = new MenuItem();
|
||||
addItem.Header = Properties.Resources.textCopyClip;
|
||||
addItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/documents.png")) };
|
||||
addItem.Click += new RoutedEventHandler(this.copyID);
|
||||
addItem.Click += this.copyID;
|
||||
this.dataGrid.ContextMenu.Items.Add(addItem);
|
||||
cancelItem = new MenuItem();
|
||||
cancelItem.Header = Properties.Resources.textUndoCancel;
|
||||
@ -186,7 +186,7 @@ namespace ENI2
|
||||
|
||||
// ergebnis anzeigen
|
||||
this.dataGrid.ItemsSource = this.anmeldungen;
|
||||
this.searchResultLabel.Content = ((expectedResultNum ?? 0) > 0) ? string.Format("{0} results found, {1} displayed.", (expectedResultNum ?? 0), this.anmeldungen.Count) : "no results";
|
||||
this.searchResultLabel.Content = ((expectedResultNum ?? 0) > 0) ? string.Format("{0} results found, {1} displayed.", expectedResultNum ?? 0, this.anmeldungen.Count) : "no results";
|
||||
|
||||
if((expectedResultNum ?? 0) > 100)
|
||||
{
|
||||
@ -234,7 +234,7 @@ namespace ENI2
|
||||
if (sender != null)
|
||||
{
|
||||
DataGrid grid = sender as DataGrid;
|
||||
if ((grid != null) && (grid.SelectedItems != null) && (grid.SelectedItems.Count == 1))
|
||||
if (grid?.SelectedItems?.Count == 1)
|
||||
{
|
||||
DataGridRow dgr = grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem) as DataGridRow;
|
||||
MessageCore selectedCore = grid.SelectedItem as MessageCore;
|
||||
@ -258,10 +258,9 @@ namespace ENI2
|
||||
|
||||
private void copyID(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageCore selectedCore = dataGrid.SelectedItem as MessageCore;
|
||||
if(selectedCore != null)
|
||||
if (dataGrid.SelectedItem is MessageCore selectedCore)
|
||||
{
|
||||
if(selectedCore.DisplayId != null)
|
||||
if (selectedCore.DisplayId != null)
|
||||
{
|
||||
Clipboard.SetText(selectedCore.DisplayId);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
// https://stackoverflow.com/a/7482321
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
@ -32,8 +33,6 @@ namespace ENI2.Util
|
||||
{
|
||||
new DispatcherTimer(TimeSpan.FromSeconds(0), DispatcherPriority.ApplicationIdle, dispatcherTimer_Tick, Application.Current.Dispatcher);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void dispatcherTimer_Tick(object sender, EventArgs e)
|
||||
@ -45,5 +44,11 @@ namespace ENI2.Util
|
||||
timer.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsModal(this Window window)
|
||||
{
|
||||
return (bool)typeof(Window).GetField("_showingAsDialog", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(window);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@ -150,6 +150,7 @@ namespace bsmd.ExcelReadService
|
||||
if (reportingPartyDict[rpKey].UserEMail.IsNullOrEmpty()) continue;
|
||||
if (reportingPartyDict[rpKey].UserEMail.Equals(mailSender, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
ReportingParty.CurrentReportingParty = reportingPartyDict[rpKey];
|
||||
importHeader.ReportingPartyId = rpKey;
|
||||
foundReportingParty = true;
|
||||
break;
|
||||
@ -158,6 +159,7 @@ namespace bsmd.ExcelReadService
|
||||
if (!foundReportingParty)
|
||||
{
|
||||
_log.WarnFormat("Sender {0} is an unknown reporting party", mailSender);
|
||||
ReportingParty.CurrentReportingParty = null;
|
||||
}
|
||||
|
||||
DBManager.Instance.Save(importHeader);
|
||||
|
||||
@ -103,6 +103,28 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
#region overrides
|
||||
|
||||
public override void OverwriteWith(DatabaseEntity otherEntity)
|
||||
{
|
||||
if (otherEntity is BPOL otherBPOL)
|
||||
{
|
||||
base.OverwriteWith(otherEntity);
|
||||
foreach (PortOfItinerary poi in this.PortOfItineraries)
|
||||
DBManager.Instance.Delete(poi);
|
||||
this.PortOfItineraries.Clear();
|
||||
foreach (PortOfItinerary poi in otherBPOL.PortOfItineraries)
|
||||
{
|
||||
PortOfItinerary newPOI = poi.Clone() as PortOfItinerary;
|
||||
newPOI.BPOL = this;
|
||||
DBManager.Instance.Save(newPOI);
|
||||
this.PortOfItineraries.Add(newPOI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ISublistContainer implementation
|
||||
|
||||
public ISublistElement GetSublistElementWithIdentifier(string identifier)
|
||||
|
||||
@ -650,6 +650,25 @@ namespace bsmd.database
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<MessageHistory> GetMessageHistories(Guid messageId)
|
||||
{
|
||||
try
|
||||
{
|
||||
SqlCommand cmd = new SqlCommand();
|
||||
cmd.CommandText = MessageHistory.GetLoadCommand();
|
||||
cmd.Parameters.AddWithValue("@ENTITYID", messageId);
|
||||
IDataReader reader = this.PerformCommand(cmd);
|
||||
List<MessageHistory> result = MessageHistory.LoadList(reader);
|
||||
reader.Close();
|
||||
return result;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Error loadin message history: {0}", ex.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region internal/private funcs
|
||||
|
||||
@ -183,7 +183,40 @@ namespace bsmd.database
|
||||
public virtual ValidationBlock GetValidationBlock()
|
||||
{
|
||||
return ValidationBlock.BLOCK1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Diese Methode überschreibt die Properties dieses Objekts mit den (gleichnamigen) Properties eines
|
||||
/// anderen Objekts. Vorausgesetzt wird, dass die beiden Objekte vom selben Typ sind. Properties, die mit
|
||||
/// "JSONIgnore" dekoriert sind werden dabei übersprungen
|
||||
/// </summary>
|
||||
/// <param name="otherEntity">Quell-Objekt</param>
|
||||
public virtual void OverwriteWith(DatabaseEntity otherEntity)
|
||||
{
|
||||
try
|
||||
{
|
||||
DatabaseEntity.CopyProperties(this, otherEntity);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("Error copying properties: {0}", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CopyProperties(DatabaseEntity entityTarget, DatabaseEntity entitySource)
|
||||
{
|
||||
foreach (PropertyInfo propertyInfo in entityTarget.GetType().GetProperties())
|
||||
{
|
||||
bool hasJsonIgnoreAttribute = (propertyInfo.GetCustomAttribute(typeof(JsonIgnoreAttribute)) != null);
|
||||
if (!hasJsonIgnoreAttribute)
|
||||
{
|
||||
PropertyInfo otherProperty = entitySource.GetType().GetProperty(propertyInfo.Name);
|
||||
propertyInfo.SetValue(entityTarget, otherProperty.GetValue(entitySource));
|
||||
}
|
||||
}
|
||||
|
||||
DBManager.Instance.Save(entityTarget);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -238,6 +238,89 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overrides
|
||||
|
||||
public override void OverwriteWith(DatabaseEntity otherEntity)
|
||||
{
|
||||
if (otherEntity is HAZ otherHAZ)
|
||||
{
|
||||
base.OverwriteWith(otherEntity);
|
||||
|
||||
// overwrite IMGD
|
||||
|
||||
foreach (IMDGPosition imdg in this.IMDGPositions)
|
||||
DBManager.Instance.Delete(imdg);
|
||||
this.IMDGPositions.Clear();
|
||||
|
||||
foreach (IMDGPosition imdg in otherHAZ.IMDGPositions)
|
||||
{
|
||||
IMDGPosition newIMDG = imdg.Clone() as IMDGPosition;
|
||||
newIMDG.HAZ = this;
|
||||
DBManager.Instance.Save(newIMDG);
|
||||
this.IMDGPositions.Add(newIMDG);
|
||||
}
|
||||
|
||||
// overwrite IBC
|
||||
|
||||
foreach (IBCPosition ibc in this.IBCPositions)
|
||||
DBManager.Instance.Delete(ibc);
|
||||
this.IBCPositions.Clear();
|
||||
|
||||
foreach (IBCPosition ibc in otherHAZ.IBCPositions)
|
||||
{
|
||||
IBCPosition newIBC = ibc.Clone() as IBCPosition;
|
||||
newIBC.HAZ = this;
|
||||
DBManager.Instance.Save(newIBC);
|
||||
this.IBCPositions.Add(newIBC);
|
||||
}
|
||||
|
||||
// overwrite IGC
|
||||
|
||||
foreach (IGCPosition igc in this.IGCPositions)
|
||||
DBManager.Instance.Delete(igc);
|
||||
this.IGCPositions.Clear();
|
||||
|
||||
foreach (IGCPosition igc in otherHAZ.IGCPositions)
|
||||
{
|
||||
IGCPosition newIGC = igc.Clone() as IGCPosition;
|
||||
newIGC.HAZ = this;
|
||||
DBManager.Instance.Save(newIGC);
|
||||
this.IGCPositions.Add(newIGC);
|
||||
}
|
||||
|
||||
// IMSBC
|
||||
|
||||
foreach (IMSBCPosition imsbc in this.IMSBCPositions)
|
||||
DBManager.Instance.Delete(imsbc);
|
||||
this.IMSBCPositions.Clear();
|
||||
|
||||
foreach (IMSBCPosition imsbc in otherHAZ.IMSBCPositions)
|
||||
{
|
||||
IMSBCPosition newIMSBC = imsbc.Clone() as IMSBCPosition;
|
||||
newIMSBC.HAZ = this;
|
||||
DBManager.Instance.Save(newIMSBC);
|
||||
this.IMSBCPositions.Add(newIMSBC);
|
||||
}
|
||||
|
||||
// Marpol
|
||||
|
||||
foreach (MARPOL_Annex_I_Position marpol in this.MARPOLPositions)
|
||||
DBManager.Instance.Delete(marpol);
|
||||
this.MARPOLPositions.Clear();
|
||||
|
||||
foreach (MARPOL_Annex_I_Position marpol in otherHAZ.MARPOLPositions)
|
||||
{
|
||||
MARPOL_Annex_I_Position newMarpol = marpol.Clone() as MARPOL_Annex_I_Position;
|
||||
newMarpol.HAZ = this;
|
||||
DBManager.Instance.Save(newMarpol);
|
||||
this.MARPOLPositions.Add(newMarpol);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ISublistContainer implementation
|
||||
|
||||
public ISublistElement GetSublistElementWithIdentifier(string identifier)
|
||||
|
||||
@ -19,7 +19,7 @@ namespace bsmd.database
|
||||
|
||||
#region static definition
|
||||
|
||||
private static Lazy<Dictionary<int, string>> laCodes =
|
||||
private static readonly Lazy<Dictionary<int, string>> laCodes =
|
||||
new Lazy<Dictionary<int, string>>(() => new Dictionary<int, string>
|
||||
{
|
||||
{ 10, "unverpacktes Flüssiggut" },
|
||||
@ -43,8 +43,6 @@ namespace bsmd.database
|
||||
{ 67, "Reisezugwagen und Triebwagen" }
|
||||
});
|
||||
|
||||
private static Dictionary<int, string> _cargoHandlingDict = new Dictionary<int, string>();
|
||||
|
||||
#endregion
|
||||
|
||||
public LADG()
|
||||
@ -66,8 +64,8 @@ namespace bsmd.database
|
||||
get {
|
||||
if(this.CargoHandlingType.HasValue)
|
||||
{
|
||||
if (_cargoHandlingDict.ContainsKey(this.CargoHandlingType.Value))
|
||||
return _cargoHandlingDict[this.CargoHandlingType.Value];
|
||||
if (CargoHandlingDict.ContainsKey(this.CargoHandlingType.Value))
|
||||
return CargoHandlingDict[this.CargoHandlingType.Value];
|
||||
return string.Empty;
|
||||
}
|
||||
return string.Empty;
|
||||
@ -117,12 +115,9 @@ namespace bsmd.database
|
||||
public static Dictionary<string, string> CargoCodesNST { get; set; }
|
||||
|
||||
public static List<KeyValuePair<string, string>> CargoCodesNST3 { get; set; }
|
||||
|
||||
|
||||
public static Dictionary<int, string> CargoHandlingDict
|
||||
{
|
||||
get { return _cargoHandlingDict; }
|
||||
}
|
||||
|
||||
public static Dictionary<int, string> CargoHandlingDict { get; } = new Dictionary<int, string>();
|
||||
|
||||
#endregion
|
||||
|
||||
@ -162,7 +157,7 @@ namespace bsmd.database
|
||||
}
|
||||
else
|
||||
{
|
||||
scmd.Parameters.AddWithValue(@"ID", this.Id);
|
||||
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||
scmd.CommandText = string.Format("UPDATE {0} SET CargoHandlingType = @P2, CargoCodeNST = @P3, CargoNumberOfItems = @P4, " +
|
||||
"CargoGrossQuantity_TNE = @P5, PortOfLoading = @P6, PortOfDischarge = @P7, CargoLACode = @P9, CargoCodeNST_3 = @P10, " +
|
||||
"Identifier = @P8 WHERE Id = @ID", this.Tablename);
|
||||
|
||||
@ -17,15 +17,6 @@ namespace bsmd.database
|
||||
{
|
||||
public class MDH : DatabaseEntity, ISublistContainer
|
||||
{
|
||||
|
||||
private ObservableCollection<DatabaseEntity> portOfCallLast30Days = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
private ObservableCollection<DatabaseEntity> sanitaryMeasuresDetails = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
private ObservableCollection<DatabaseEntity> stowawaysJoiningLocations = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
private ObservableCollection<DatabaseEntity> infectedAreas = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
public MDH()
|
||||
{
|
||||
this.tablename = "[dbo].[MDH]";
|
||||
@ -34,13 +25,13 @@ namespace bsmd.database
|
||||
|
||||
#region Properties
|
||||
|
||||
public ObservableCollection<DatabaseEntity> PortOfCallLast30Days { get { return this.portOfCallLast30Days; } }
|
||||
public ObservableCollection<DatabaseEntity> PortOfCallLast30Days { get; private set; } = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
public ObservableCollection<DatabaseEntity> SanitaryMeasuresDetails { get { return this.sanitaryMeasuresDetails; } }
|
||||
public ObservableCollection<DatabaseEntity> SanitaryMeasuresDetails { get; private set; } = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
public ObservableCollection<DatabaseEntity> StowawaysJoiningLocations { get { return this.stowawaysJoiningLocations; } }
|
||||
public ObservableCollection<DatabaseEntity> StowawaysJoiningLocations { get; private set; } = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
public ObservableCollection<DatabaseEntity> InfectedAreas { get { return this.infectedAreas; } }
|
||||
public ObservableCollection<DatabaseEntity> InfectedAreas { get; private set; } = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
[ShowReport]
|
||||
[Validation1(ValidationCode.NOT_NULL)]
|
||||
@ -400,6 +391,71 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
#region overrides
|
||||
|
||||
public override void OverwriteWith(DatabaseEntity otherEntity)
|
||||
{
|
||||
if (otherEntity is MDH otherMDH)
|
||||
{
|
||||
base.OverwriteWith(otherEntity);
|
||||
|
||||
// PortOfCallLast30Days
|
||||
|
||||
foreach (PortOfCallLast30Days poc in this.PortOfCallLast30Days)
|
||||
DBManager.Instance.Delete(poc);
|
||||
this.PortOfCallLast30Days.Clear();
|
||||
foreach (PortOfCallLast30Days poc in otherMDH.PortOfCallLast30Days)
|
||||
{
|
||||
PortOfCallLast30Days newPOC = poc.Clone() as PortOfCallLast30Days;
|
||||
newPOC.MDH = this;
|
||||
DBManager.Instance.Save(newPOC);
|
||||
this.PortOfCallLast30Days.Add(newPOC);
|
||||
}
|
||||
|
||||
// SanitaryMeasuresDetails
|
||||
|
||||
foreach (SanitaryMeasuresDetail san in this.SanitaryMeasuresDetails)
|
||||
DBManager.Instance.Delete(san);
|
||||
this.SanitaryMeasuresDetails.Clear();
|
||||
foreach (SanitaryMeasuresDetail san in otherMDH.SanitaryMeasuresDetails)
|
||||
{
|
||||
SanitaryMeasuresDetail newSAN = san.Clone() as SanitaryMeasuresDetail;
|
||||
newSAN.MDH = this;
|
||||
DBManager.Instance.Save(newSAN);
|
||||
this.SanitaryMeasuresDetails.Add(newSAN);
|
||||
}
|
||||
|
||||
// StowawaysJoiningLocations
|
||||
|
||||
foreach (StowawaysJoiningLocation sjl in this.StowawaysJoiningLocations)
|
||||
DBManager.Instance.Delete(sjl);
|
||||
this.StowawaysJoiningLocations.Clear();
|
||||
foreach (StowawaysJoiningLocation sjl in otherMDH.StowawaysJoiningLocations)
|
||||
{
|
||||
StowawaysJoiningLocation newSJL = sjl.Clone() as StowawaysJoiningLocation;
|
||||
newSJL.MDH = this;
|
||||
DBManager.Instance.Save(newSJL);
|
||||
this.StowawaysJoiningLocations.Add(newSJL);
|
||||
}
|
||||
|
||||
// InfectedAreas
|
||||
|
||||
foreach (InfectedArea ia in this.InfectedAreas)
|
||||
DBManager.Instance.Delete(ia);
|
||||
this.InfectedAreas.Clear();
|
||||
foreach (InfectedArea ia in otherMDH.InfectedAreas)
|
||||
{
|
||||
InfectedArea newIA = ia.Clone() as InfectedArea;
|
||||
newIA.MDH = this;
|
||||
DBManager.Instance.Save(newIA);
|
||||
this.InfectedAreas.Add(newIA);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ISublistContainer implementation
|
||||
|
||||
public ISublistElement GetSublistElementWithIdentifier(string identifier)
|
||||
@ -429,7 +485,7 @@ namespace bsmd.database
|
||||
DBManager.Instance.Save(smd);
|
||||
}
|
||||
|
||||
foreach(StowawaysJoiningLocation sjl in this.stowawaysJoiningLocations)
|
||||
foreach(StowawaysJoiningLocation sjl in this.StowawaysJoiningLocations)
|
||||
{
|
||||
DBManager.Instance.Save(sjl);
|
||||
}
|
||||
@ -453,9 +509,9 @@ namespace bsmd.database
|
||||
{
|
||||
DBManager.Instance.Delete(smd);
|
||||
}
|
||||
this.sanitaryMeasuresDetails.Clear();
|
||||
this.SanitaryMeasuresDetails.Clear();
|
||||
|
||||
foreach (StowawaysJoiningLocation sjl in this.stowawaysJoiningLocations)
|
||||
foreach (StowawaysJoiningLocation sjl in this.StowawaysJoiningLocations)
|
||||
{
|
||||
DBManager.Instance.Delete(sjl);
|
||||
}
|
||||
@ -470,21 +526,21 @@ namespace bsmd.database
|
||||
|
||||
public SanitaryMeasuresDetail GetSanitaryMeasuresDetailWithIdentifier(string identifier)
|
||||
{
|
||||
foreach (SanitaryMeasuresDetail sd in this.sanitaryMeasuresDetails)
|
||||
foreach (SanitaryMeasuresDetail sd in this.SanitaryMeasuresDetails)
|
||||
if (sd.Identifier.Equals(identifier)) return sd;
|
||||
return null;
|
||||
}
|
||||
|
||||
public StowawaysJoiningLocation GetStowawaysJoiningLocationWithIdentifier(string identifier)
|
||||
{
|
||||
foreach (StowawaysJoiningLocation sj in this.stowawaysJoiningLocations)
|
||||
foreach (StowawaysJoiningLocation sj in this.StowawaysJoiningLocations)
|
||||
if (sj.Identifier.Equals(identifier)) return sj;
|
||||
return null;
|
||||
}
|
||||
|
||||
public InfectedArea GetInfectedAreaWithIdentifier(string identifier)
|
||||
{
|
||||
foreach (InfectedArea ia in this.infectedAreas)
|
||||
foreach (InfectedArea ia in this.InfectedAreas)
|
||||
if (ia.Identifier.Equals(identifier)) return ia;
|
||||
return null;
|
||||
}
|
||||
@ -553,12 +609,12 @@ namespace bsmd.database
|
||||
if ((this.DateOfIssue.HasValue) && (this.DateOfIssue.Value < DateTime.Today.AddMonths(-6)))
|
||||
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of issue might be too old", null, this.Title, null, this.Tablename));
|
||||
|
||||
if (this.portOfCallLast30Days.Count == 0)
|
||||
if (this.PortOfCallLast30Days.Count == 0)
|
||||
{
|
||||
errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "Port of Call last 30 day list is EMPTY", null, this.Title, null, this.Tablename));
|
||||
}
|
||||
|
||||
foreach (PortOfCallLast30Days poc30d in this.portOfCallLast30Days)
|
||||
foreach (PortOfCallLast30Days poc30d in this.PortOfCallLast30Days)
|
||||
{
|
||||
RuleEngine.ValidateProperties(poc30d, errors, violations);
|
||||
poc30d.Validate(errors, violations);
|
||||
@ -574,10 +630,10 @@ namespace bsmd.database
|
||||
{
|
||||
MDH mdh = this.MemberwiseClone() as MDH;
|
||||
mdh.id = null;
|
||||
mdh.infectedAreas = new ObservableCollection<DatabaseEntity>();
|
||||
mdh.portOfCallLast30Days = new ObservableCollection<DatabaseEntity>();
|
||||
mdh.sanitaryMeasuresDetails = new ObservableCollection<DatabaseEntity>();
|
||||
mdh.stowawaysJoiningLocations = new ObservableCollection<DatabaseEntity>();
|
||||
mdh.InfectedAreas = new ObservableCollection<DatabaseEntity>();
|
||||
mdh.PortOfCallLast30Days = new ObservableCollection<DatabaseEntity>();
|
||||
mdh.SanitaryMeasuresDetails = new ObservableCollection<DatabaseEntity>();
|
||||
mdh.StowawaysJoiningLocations = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
foreach (InfectedArea ia in this.InfectedAreas)
|
||||
{
|
||||
@ -593,7 +649,7 @@ namespace bsmd.database
|
||||
mdh.PortOfCallLast30Days.Add(clonedPOC);
|
||||
}
|
||||
|
||||
foreach (SanitaryMeasuresDetail smd in this.sanitaryMeasuresDetails)
|
||||
foreach (SanitaryMeasuresDetail smd in this.SanitaryMeasuresDetails)
|
||||
{
|
||||
SanitaryMeasuresDetail clonedSMD = smd.Clone() as SanitaryMeasuresDetail;
|
||||
clonedSMD.MDH = mdh;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2015-2017 schick Informatik
|
||||
// Description:
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@ -35,6 +36,88 @@ namespace bsmd.database
|
||||
|
||||
public DateTime Created { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// ENI Grid helper property
|
||||
/// </summary>
|
||||
public string ReportingPartyName
|
||||
{
|
||||
get
|
||||
{
|
||||
Dictionary<Guid, ReportingParty> repPartyDict = DBManager.Instance.GetReportingPartyDict();
|
||||
if (ReportingPartyId.HasValue && repPartyDict.ContainsKey(ReportingPartyId.Value))
|
||||
return repPartyDict[ReportingPartyId.Value].Logon;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public methods
|
||||
|
||||
internal static string GetLoadCommand()
|
||||
{
|
||||
return "SELECT Id, ReportingPartyId, EntityId, EntityType, EntityName, EntityValues, Timestamp FROM MessageHistory WHERE EntityId=@ENTITYID ORDER BY Timestamp";
|
||||
}
|
||||
|
||||
public object CreateObjectFromValues()
|
||||
{
|
||||
if(!this.EntityType.IsNullOrEmpty())
|
||||
{
|
||||
Type objectType = Type.GetType(this.EntityType);
|
||||
if(objectType != null)
|
||||
return JsonConvert.DeserializeObject(this.EntityValues, objectType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Liefert alle History-Elemente zu dem Parameter Bezugselement, wenn es ISublistElement Objekte sind
|
||||
/// Die Elemente werden über den Index gefunden.. also alles was von 1..n geht in dem Abschnitt, in dem der Benutzer
|
||||
/// einen Eintrag ausgewählt hat.
|
||||
/// </summary>
|
||||
/// <param name="allHistories"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseEntity> GetGroup(List<MessageHistory> allHistories)
|
||||
{
|
||||
|
||||
LinkedList<DatabaseEntity> tmpResult = new LinkedList<DatabaseEntity>();
|
||||
DatabaseEntity refEntity = this.CreateObjectFromValues() as DatabaseEntity;
|
||||
|
||||
if (refEntity is ISublistElement sublistElement)
|
||||
{
|
||||
List<MessageHistory> tmpList = new List<MessageHistory>(allHistories);
|
||||
// Alle History-Elemente einer anderen Meldeklasse ausfiltern
|
||||
tmpList.RemoveAll(aMessageHistory => !aMessageHistory.EntityId.Equals(this.EntityId));
|
||||
|
||||
int selIndex = tmpList.IndexOf(this);
|
||||
tmpResult.AddLast(refEntity);
|
||||
int myIdentifier = Int32.Parse((sublistElement).Identifier);
|
||||
|
||||
// Elemente vor dem ausgewählten Element der Linked List hinzufügen
|
||||
int indexIdentifier = myIdentifier;
|
||||
|
||||
for (int tmpIndex = selIndex - 1; (indexIdentifier != 1) && (tmpIndex >= 0); tmpIndex--)
|
||||
{
|
||||
DatabaseEntity prevEntity = tmpList[tmpIndex].CreateObjectFromValues() as DatabaseEntity;
|
||||
indexIdentifier = Int32.Parse(((ISublistElement)prevEntity).Identifier);
|
||||
tmpResult.AddFirst(prevEntity);
|
||||
}
|
||||
|
||||
// Elemente nach dem ausgewählten Element hinzufügen (wenn sie zur gleichen Gruppe gehören)
|
||||
indexIdentifier = myIdentifier;
|
||||
for(int tmpIndex = selIndex + 1; (indexIdentifier != 1) && (tmpIndex < tmpList.Count); tmpIndex++)
|
||||
{
|
||||
DatabaseEntity nextEntity = tmpList[tmpIndex].CreateObjectFromValues() as DatabaseEntity;
|
||||
indexIdentifier = Int32.Parse(((ISublistElement)nextEntity).Identifier);
|
||||
tmpResult.AddLast(nextEntity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new List<DatabaseEntity>(tmpResult);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDatabaseEntity implementation
|
||||
@ -62,9 +145,9 @@ namespace bsmd.database
|
||||
SqlCommand scmd = cmd as SqlCommand;
|
||||
scmd.CommandText = string.Format("DELETE FROM {0} WHERE Id = @ID", Tablename);
|
||||
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||
}
|
||||
}
|
||||
|
||||
public List<MessageHistory> LoadList(IDataReader reader)
|
||||
internal static List<MessageHistory> LoadList(IDataReader reader)
|
||||
{
|
||||
List<MessageHistory> result = new List<MessageHistory>();
|
||||
|
||||
|
||||
@ -153,6 +153,28 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
#region overrides
|
||||
|
||||
public override void OverwriteWith(DatabaseEntity otherEntity)
|
||||
{
|
||||
if (otherEntity is NOA_NOD otherNOA_NOD)
|
||||
{
|
||||
base.OverwriteWith(otherEntity);
|
||||
foreach (CallPurpose cp in this.CallPurposes)
|
||||
DBManager.Instance.Delete(cp);
|
||||
this.CallPurposes.Clear();
|
||||
foreach (CallPurpose cp in otherNOA_NOD.CallPurposes)
|
||||
{
|
||||
CallPurpose newCP = cp.Clone() as CallPurpose;
|
||||
newCP.NOA_NOD = this;
|
||||
DBManager.Instance.Save(newCP);
|
||||
this.CallPurposes.Add(newCP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ISublistContainer implementation
|
||||
|
||||
public ISublistElement GetSublistElementWithIdentifier(string identifier)
|
||||
|
||||
@ -17,11 +17,6 @@ namespace bsmd.database
|
||||
{
|
||||
public class SEC : DatabaseEntity, ISublistContainer
|
||||
{
|
||||
|
||||
private ObservableCollection<DatabaseEntity> ltpfc = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
private ObservableCollection<DatabaseEntity> lsts = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
public SEC()
|
||||
{
|
||||
this.tablename = "[dbo].[SEC]";
|
||||
@ -155,9 +150,9 @@ namespace bsmd.database
|
||||
public DateTime? KielCanalPassagePlannedOutgoing { get; set; }
|
||||
|
||||
[Validation2(ValidationCode.LIST_EMPTY)]
|
||||
public ObservableCollection<DatabaseEntity> LastTenPortFacilitesCalled { get { return this.ltpfc; } }
|
||||
public ObservableCollection<LastTenPortFacilitiesCalled> LastTenPortFacilitesCalled { get; private set; } = new ObservableCollection<LastTenPortFacilitiesCalled>();
|
||||
|
||||
public ObservableCollection<DatabaseEntity> ShipToShipActivitiesDuringLastTenPortFacilitiesCalled { get { return this.lsts; } }
|
||||
public ObservableCollection<ShipToShipActivitiesDuringLastTenPortFacilitiesCalled> ShipToShipActivitiesDuringLastTenPortFacilitiesCalled { get; private set; } = new ObservableCollection<ShipToShipActivitiesDuringLastTenPortFacilitiesCalled>();
|
||||
|
||||
#endregion
|
||||
|
||||
@ -282,11 +277,46 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
#region overrides
|
||||
|
||||
public override void OverwriteWith(DatabaseEntity otherEntity)
|
||||
{
|
||||
if (otherEntity is SEC otherSEC)
|
||||
{
|
||||
base.OverwriteWith(otherEntity);
|
||||
|
||||
foreach (LastTenPortFacilitiesCalled lc in this.LastTenPortFacilitesCalled)
|
||||
DBManager.Instance.Delete(lc);
|
||||
this.LastTenPortFacilitesCalled.Clear();
|
||||
foreach (LastTenPortFacilitiesCalled lc in otherSEC.LastTenPortFacilitesCalled)
|
||||
{
|
||||
LastTenPortFacilitiesCalled newLC = lc.Clone() as LastTenPortFacilitiesCalled;
|
||||
newLC.SEC = this;
|
||||
DBManager.Instance.Save(newLC);
|
||||
this.LastTenPortFacilitesCalled.Add(newLC);
|
||||
}
|
||||
|
||||
foreach (ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s in this.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)
|
||||
DBManager.Instance.Delete(s2s);
|
||||
this.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Clear();
|
||||
foreach (ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s in otherSEC.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)
|
||||
{
|
||||
ShipToShipActivitiesDuringLastTenPortFacilitiesCalled newS2S = s2s.Clone() as ShipToShipActivitiesDuringLastTenPortFacilitiesCalled;
|
||||
newS2S.SEC = this;
|
||||
DBManager.Instance.Save(newS2S);
|
||||
this.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.Add(newS2S);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region sublist lookup implementation
|
||||
|
||||
public LastTenPortFacilitiesCalled GetPortFacilityWithIdentifier(string identifier)
|
||||
{
|
||||
foreach(ISublistElement lp in this.ltpfc) {
|
||||
foreach(ISublistElement lp in this.LastTenPortFacilitesCalled) {
|
||||
if (lp.Identifier.Equals(identifier))
|
||||
return lp as LastTenPortFacilitiesCalled;
|
||||
}
|
||||
@ -295,7 +325,7 @@ namespace bsmd.database
|
||||
|
||||
public ShipToShipActivitiesDuringLastTenPortFacilitiesCalled GetShipToShipWithIdentifier(string identifier)
|
||||
{
|
||||
foreach (ISublistElement lp in this.lsts)
|
||||
foreach (ISublistElement lp in this.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)
|
||||
{
|
||||
if (lp.Identifier.Equals(identifier))
|
||||
return lp as ShipToShipActivitiesDuringLastTenPortFacilitiesCalled;
|
||||
@ -437,8 +467,8 @@ namespace bsmd.database
|
||||
SEC sec = this.MemberwiseClone() as SEC;
|
||||
sec.id = null;
|
||||
|
||||
sec.lsts = new ObservableCollection<DatabaseEntity>();
|
||||
sec.ltpfc = new ObservableCollection<DatabaseEntity>();
|
||||
sec.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled = new ObservableCollection<ShipToShipActivitiesDuringLastTenPortFacilitiesCalled>();
|
||||
sec.LastTenPortFacilitesCalled = new ObservableCollection<LastTenPortFacilitiesCalled>();
|
||||
|
||||
foreach (LastTenPortFacilitiesCalled ltp in this.LastTenPortFacilitesCalled)
|
||||
{
|
||||
|
||||
@ -17,11 +17,6 @@ namespace bsmd.database
|
||||
{
|
||||
public class WAS : DatabaseEntity, ISublistContainer
|
||||
{
|
||||
|
||||
private ObservableCollection<DatabaseEntity> wdsp = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
private ObservableCollection<DatabaseEntity> waste = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
public WAS()
|
||||
{
|
||||
this.tablename = "[dbo].[WAS]";
|
||||
@ -70,9 +65,9 @@ namespace bsmd.database
|
||||
[ENI2Validation]
|
||||
public bool? ConfirmationOfSufficiency { get; set; }
|
||||
|
||||
public ObservableCollection<DatabaseEntity> Waste { get { return this.waste; } }
|
||||
public ObservableCollection<DatabaseEntity> Waste { get; private set; } = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
public ObservableCollection<DatabaseEntity> WasteDisposalServiceProvider { get { return this.wdsp; } }
|
||||
public ObservableCollection<DatabaseEntity> WasteDisposalServiceProvider { get; private set; } = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
/// <summary>
|
||||
/// Hilfsproperty, um eine kommaseparierte Liste von WasteDisposalServiceProvider (analog ANSW) im ENI-2 anzuzeigen,
|
||||
@ -227,6 +222,41 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
#region overrides
|
||||
|
||||
public override void OverwriteWith(DatabaseEntity otherEntity)
|
||||
{
|
||||
if (otherEntity is WAS otherWAS)
|
||||
{
|
||||
base.OverwriteWith(otherEntity);
|
||||
|
||||
foreach (Waste w in this.Waste)
|
||||
DBManager.Instance.Delete(w);
|
||||
this.Waste.Clear();
|
||||
foreach (Waste w in otherWAS.Waste)
|
||||
{
|
||||
Waste newW = w.Clone() as Waste;
|
||||
newW.WAS = this;
|
||||
DBManager.Instance.Save(newW);
|
||||
this.Waste.Add(newW);
|
||||
}
|
||||
|
||||
foreach (WasteDisposalServiceProvider ws in this.WasteDisposalServiceProvider)
|
||||
DBManager.Instance.Delete(ws);
|
||||
this.WasteDisposalServiceProvider.Clear();
|
||||
foreach (WasteDisposalServiceProvider ws in otherWAS.WasteDisposalServiceProvider)
|
||||
{
|
||||
WasteDisposalServiceProvider newWS = ws.Clone() as WasteDisposalServiceProvider;
|
||||
newWS.WAS = this;
|
||||
DBManager.Instance.Save(newWS);
|
||||
this.WasteDisposalServiceProvider.Add(newWS);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ISublistContainer implementation
|
||||
|
||||
public ISublistElement GetSublistElementWithIdentifier(string identifier)
|
||||
@ -460,8 +490,8 @@ namespace bsmd.database
|
||||
{
|
||||
WAS was = this.MemberwiseClone() as WAS;
|
||||
was.id = null;
|
||||
was.waste = new ObservableCollection<DatabaseEntity>();
|
||||
was.wdsp = new ObservableCollection<DatabaseEntity>();
|
||||
was.Waste = new ObservableCollection<DatabaseEntity>();
|
||||
was.WasteDisposalServiceProvider = new ObservableCollection<DatabaseEntity>();
|
||||
|
||||
foreach (Waste waste in this.Waste)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user