diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx
index 0daca6a2..78c056f7 100644
Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ
diff --git a/nsw/Source/CoreDeleteTool/App.config b/nsw/Source/CoreDeleteTool/App.config
index e03650e7..c54f737e 100644
--- a/nsw/Source/CoreDeleteTool/App.config
+++ b/nsw/Source/CoreDeleteTool/App.config
@@ -1,12 +1,12 @@
-
+
-
-
+
+
-
+
@@ -15,4 +15,4 @@
-
\ No newline at end of file
+
diff --git a/nsw/Source/CoreDeleteTool/CoreDeleteTool.csproj b/nsw/Source/CoreDeleteTool/CoreDeleteTool.csproj
index ead1461d..04c3080b 100644
--- a/nsw/Source/CoreDeleteTool/CoreDeleteTool.csproj
+++ b/nsw/Source/CoreDeleteTool/CoreDeleteTool.csproj
@@ -9,9 +9,10 @@
Properties
CoreDeleteTool
CoreDeleteTool
- v4.5.2
+ v4.5
512
true
+
AnyCPU
@@ -63,6 +64,8 @@
+
+
Main.cs
diff --git a/nsw/Source/CoreDeleteTool/CoreDeleteTool.sln b/nsw/Source/CoreDeleteTool/CoreDeleteTool.sln
index 9975d6ab..4735f83a 100644
--- a/nsw/Source/CoreDeleteTool/CoreDeleteTool.sln
+++ b/nsw/Source/CoreDeleteTool/CoreDeleteTool.sln
@@ -1,12 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25123.0
+# Visual Studio 2013
+VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoreDeleteTool", "CoreDeleteTool.csproj", "{45FBE68D-7554-479E-9E24-E3D59FD606CE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bsmd.database", "..\bsmd.database\bsmd.database.csproj", "{19945AF2-379B-46A5-B27A-303B5EC1D557}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{5D4CFD96-E411-4C63-86A0-8874326C539E}"
+ ProjectSection(SolutionItems) = preProject
+ .nuget\NuGet.Config = .nuget\NuGet.Config
+ .nuget\NuGet.exe = .nuget\NuGet.exe
+ .nuget\NuGet.targets = .nuget\NuGet.targets
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/nsw/Source/CoreDeleteTool/Main.Designer.cs b/nsw/Source/CoreDeleteTool/Main.Designer.cs
index 58196b87..6e58e014 100644
--- a/nsw/Source/CoreDeleteTool/Main.Designer.cs
+++ b/nsw/Source/CoreDeleteTool/Main.Designer.cs
@@ -28,11 +28,15 @@
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonClose = new System.Windows.Forms.Button();
this.buttonDelete = new System.Windows.Forms.Button();
+ this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.contextMenuStrip.SuspendLayout();
this.SuspendLayout();
//
// dataGridView
@@ -44,12 +48,15 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.ContextMenuStrip = this.contextMenuStrip;
this.dataGridView.Location = new System.Drawing.Point(12, 12);
this.dataGridView.MultiSelect = false;
this.dataGridView.Name = "dataGridView";
+ this.dataGridView.ReadOnly = true;
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView.Size = new System.Drawing.Size(624, 328);
this.dataGridView.TabIndex = 0;
+ this.dataGridView.DataBindingComplete += new System.Windows.Forms.DataGridViewBindingCompleteEventHandler(this.dataGridView_DataBindingComplete);
//
// buttonClose
//
@@ -73,6 +80,20 @@
this.buttonDelete.UseVisualStyleBackColor = true;
this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
//
+ // contextMenuStrip
+ //
+ this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.deleteToolStripMenuItem});
+ this.contextMenuStrip.Name = "contextMenuStrip";
+ this.contextMenuStrip.Size = new System.Drawing.Size(108, 26);
+ //
+ // deleteToolStripMenuItem
+ //
+ this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
+ this.deleteToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
+ this.deleteToolStripMenuItem.Text = "Delete";
+ this.deleteToolStripMenuItem.Click += new System.EventHandler(this.buttonDelete_Click);
+ //
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -85,6 +106,7 @@
this.Name = "Main";
this.Text = "ENI message core removal tool";
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.contextMenuStrip.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -94,6 +116,8 @@
private System.Windows.Forms.DataGridView dataGridView;
private System.Windows.Forms.Button buttonClose;
private System.Windows.Forms.Button buttonDelete;
+ private System.Windows.Forms.ContextMenuStrip contextMenuStrip;
+ private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
}
}
diff --git a/nsw/Source/CoreDeleteTool/Main.cs b/nsw/Source/CoreDeleteTool/Main.cs
index 3864b078..0f3e9b73 100644
--- a/nsw/Source/CoreDeleteTool/Main.cs
+++ b/nsw/Source/CoreDeleteTool/Main.cs
@@ -14,7 +14,7 @@ namespace CoreDeleteTool
{
public partial class Main : Form
{
- List messageCores = new List();
+ SortableBindingList messageCores = new SortableBindingList();
public Main()
{
@@ -29,10 +29,30 @@ namespace CoreDeleteTool
if (DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString))
{
- this.messageCores.AddRange(DBManager.Instance.GetMessageCoresByStatus(MessageCore.BSMDStatus.PREPARE));
- } else
+ foreach (MessageCore mc in DBManager.Instance.GetMessageCoresByStatus(MessageCore.BSMDStatus.PREPARE))
+ this.messageCores.Add(mc);
+ }
+ else
{
MessageBox.Show("Cannot connect to database!");
+
+ // create a dummy cores
+ MessageCore mc = new MessageCore();
+ mc.IMO = "1234567";
+ mc.ETA = DateTime.Now;
+ mc.PoC = "ZZUKN";
+ mc.Portname = "Hamburg";
+
+ this.messageCores.Add(mc);
+
+ mc = new MessageCore();
+ mc.IMO = "9999999";
+ mc.ETA = DateTime.Now + TimeSpan.FromHours(1);
+ mc.PoC = "DEBRE";
+ mc.Portname = "Bremen";
+
+ this.messageCores.Add(mc);
+
}
this.dataGridView.DataSource = this.messageCores;
@@ -44,18 +64,23 @@ namespace CoreDeleteTool
private void buttonDelete_Click(object sender, EventArgs e)
{
- if(this.dataGridView.SelectedRows.Count > 0)
+ if ((this.dataGridView.SelectedRows.Count > 0) && DBManager.Instance.IsConnected)
{
- MessageCore selectedCore = this.dataGridView.SelectedRows[0].DataBoundItem as MessageCore;
- if(selectedCore != null)
+ if (MessageBox.Show("Delete selected item(s)?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
{
- if(MessageBox.Show("Delete selected item?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
+ for (int i = 0; i < this.dataGridView.SelectedRows.Count; i++)
{
- DBManager.Instance.DeleteCore(selectedCore);
+ MessageCore selectedCore = this.dataGridView.SelectedRows[i].DataBoundItem as MessageCore;
+ if (selectedCore != null)
+ {
+ DBManager.Instance.DeleteCore(selectedCore);
+
+ this.messageCores.Remove(selectedCore);
+ }
}
+ // TODO:refresh data source?
}
}
-
}
private void buttonClose_Click(object sender, EventArgs e)
@@ -63,8 +88,18 @@ namespace CoreDeleteTool
this.Close();
}
- #endregion
+ private void dataGridView_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
+ {
+ foreach (DataGridViewColumn column in dataGridView.Columns)
+ column.SortMode = DataGridViewColumnSortMode.Automatic;
+ }
+ private void menuStripDelete_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
+ {
+ this.buttonDelete_Click(sender, new EventArgs());
+ }
+
+ #endregion
}
}
diff --git a/nsw/Source/CoreDeleteTool/Main.resx b/nsw/Source/CoreDeleteTool/Main.resx
index bfb063c5..b8a508a8 100644
--- a/nsw/Source/CoreDeleteTool/Main.resx
+++ b/nsw/Source/CoreDeleteTool/Main.resx
@@ -117,6 +117,9 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
diff --git a/nsw/Source/CoreDeleteTool/Properties/Resources.Designer.cs b/nsw/Source/CoreDeleteTool/Properties/Resources.Designer.cs
index 9646eba7..139fb477 100644
--- a/nsw/Source/CoreDeleteTool/Properties/Resources.Designer.cs
+++ b/nsw/Source/CoreDeleteTool/Properties/Resources.Designer.cs
@@ -8,10 +8,10 @@
//
//------------------------------------------------------------------------------
-namespace CoreDeleteTool.Properties
-{
-
-
+namespace CoreDeleteTool.Properties {
+ using System;
+
+
///
/// A strongly-typed resource class, for looking up localized strings, etc.
///
@@ -22,48 +22,40 @@ namespace CoreDeleteTool.Properties
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
+ internal class Resources {
+
private static global::System.Resources.ResourceManager resourceMan;
-
+
private static global::System.Globalization.CultureInfo resourceCulture;
-
+
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
+ internal Resources() {
}
-
+
///
/// Returns the cached ResourceManager instance used by this class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CoreDeleteTool.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
-
+
///
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
return resourceCulture;
}
- set
- {
+ set {
resourceCulture = value;
}
}
diff --git a/nsw/Source/CoreDeleteTool/Properties/Settings.Designer.cs b/nsw/Source/CoreDeleteTool/Properties/Settings.Designer.cs
index 5f17706a..5777101a 100644
--- a/nsw/Source/CoreDeleteTool/Properties/Settings.Designer.cs
+++ b/nsw/Source/CoreDeleteTool/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace CoreDeleteTool.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/nsw/Source/CoreDeleteTool/PropertyComparer.cs b/nsw/Source/CoreDeleteTool/PropertyComparer.cs
new file mode 100644
index 00000000..92540ff9
--- /dev/null
+++ b/nsw/Source/CoreDeleteTool/PropertyComparer.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Reflection;
+
+// Gratitude:http://betimvwframework.codeplex.com/
+
+namespace CoreDeleteTool
+{
+ public class PropertyComparer : IComparer
+ {
+ private readonly IComparer comparer;
+ private PropertyDescriptor propertyDescriptor;
+ private int reverse;
+
+ public PropertyComparer(PropertyDescriptor property, ListSortDirection direction)
+ {
+ this.propertyDescriptor = property;
+ Type comparerForPropertyType = typeof(Comparer<>).MakeGenericType(property.PropertyType);
+ this.comparer = (IComparer)comparerForPropertyType.InvokeMember("Default", BindingFlags.Static | BindingFlags.GetProperty | BindingFlags.Public, null, null, null);
+ this.SetListSortDirection(direction);
+ }
+
+ #region IComparer Members
+
+ public int Compare(T x, T y)
+ {
+ return this.reverse * this.comparer.Compare(this.propertyDescriptor.GetValue(x), this.propertyDescriptor.GetValue(y));
+ }
+
+ #endregion
+
+ private void SetPropertyDescriptor(PropertyDescriptor descriptor)
+ {
+ this.propertyDescriptor = descriptor;
+ }
+
+ private void SetListSortDirection(ListSortDirection direction)
+ {
+ this.reverse = direction == ListSortDirection.Ascending ? 1 : -1;
+ }
+
+ public void SetPropertyAndDirection(PropertyDescriptor descriptor, ListSortDirection direction)
+ {
+ this.SetPropertyDescriptor(descriptor);
+ this.SetListSortDirection(direction);
+ }
+ }
+}
\ No newline at end of file
diff --git a/nsw/Source/CoreDeleteTool/SortableBindingList.cs b/nsw/Source/CoreDeleteTool/SortableBindingList.cs
new file mode 100644
index 00000000..49191fad
--- /dev/null
+++ b/nsw/Source/CoreDeleteTool/SortableBindingList.cs
@@ -0,0 +1,99 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+// Gratitude:http://betimvwframework.codeplex.com/
+
+namespace CoreDeleteTool
+{
+ public class SortableBindingList : BindingList
+ {
+ private readonly Dictionary> comparers;
+ private bool isSorted;
+ private ListSortDirection listSortDirection;
+ private PropertyDescriptor propertyDescriptor;
+
+ public SortableBindingList()
+ : base(new List())
+ {
+ this.comparers = new Dictionary>();
+ }
+
+ public SortableBindingList(IEnumerable enumeration)
+ : base(new List(enumeration))
+ {
+ this.comparers = new Dictionary>();
+ }
+
+ protected override bool SupportsSortingCore
+ {
+ get { return true; }
+ }
+
+ protected override bool IsSortedCore
+ {
+ get { return this.isSorted; }
+ }
+
+ protected override PropertyDescriptor SortPropertyCore
+ {
+ get { return this.propertyDescriptor; }
+ }
+
+ protected override ListSortDirection SortDirectionCore
+ {
+ get { return this.listSortDirection; }
+ }
+
+ protected override bool SupportsSearchingCore
+ {
+ get { return true; }
+ }
+
+ protected override void ApplySortCore(PropertyDescriptor property, ListSortDirection direction)
+ {
+ List itemsList = (List)this.Items;
+
+ Type propertyType = property.PropertyType;
+ PropertyComparer comparer;
+ if (!this.comparers.TryGetValue(propertyType, out comparer))
+ {
+ comparer = new PropertyComparer(property, direction);
+ this.comparers.Add(propertyType, comparer);
+ }
+
+ comparer.SetPropertyAndDirection(property, direction);
+ itemsList.Sort(comparer);
+
+ this.propertyDescriptor = property;
+ this.listSortDirection = direction;
+ this.isSorted = true;
+
+ this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
+ }
+
+ protected override void RemoveSortCore()
+ {
+ this.isSorted = false;
+ this.propertyDescriptor = base.SortPropertyCore;
+ this.listSortDirection = base.SortDirectionCore;
+
+ this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
+ }
+
+ protected override int FindCore(PropertyDescriptor property, object key)
+ {
+ int count = this.Count;
+ for (int i = 0; i < count; ++i)
+ {
+ T element = this[i];
+ if (property.GetValue(element).Equals(key))
+ {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+ }
+}
\ No newline at end of file
diff --git a/nsw/Source/bsmd.database/BPOL.cs b/nsw/Source/bsmd.database/BPOL.cs
index 2997a6b7..40467e76 100644
--- a/nsw/Source/bsmd.database/BPOL.cs
+++ b/nsw/Source/bsmd.database/BPOL.cs
@@ -118,6 +118,14 @@ namespace bsmd.database
}
}
+ public void DeleteElements()
+ {
+ foreach(PortOfItinerary poi in this.PortOfItineraries)
+ {
+ DBManager.Instance.Delete(poi);
+ }
+ }
+
#endregion
#region IMessageParagraph implementation
diff --git a/nsw/Source/bsmd.database/DBManager.cs b/nsw/Source/bsmd.database/DBManager.cs
index 7d8437bc..c5f0a8cf 100644
--- a/nsw/Source/bsmd.database/DBManager.cs
+++ b/nsw/Source/bsmd.database/DBManager.cs
@@ -80,6 +80,11 @@ namespace bsmd.database
this._con.Close();
}
+ public bool IsConnected
+ {
+ get { return (this._con != null) && (this._con.State == ConnectionState.Open); }
+ }
+
#endregion
#region public helper funcs
@@ -364,6 +369,22 @@ namespace bsmd.database
}
return result;
}
+
+ public void DeleteCore(MessageCore messageCore)
+ {
+ if(messageCore == null) return;
+
+ foreach(Message message in this.GetMessagesForCore(messageCore, MessageLoad.ALL))
+ {
+ if (message is ISublistContainer)
+ {
+ ((ISublistContainer)message).DeleteElements();
+ }
+ this.Delete(message);
+ }
+
+ this.Delete(messageCore);
+ }
public void Save(DatabaseEntity entity)
{
diff --git a/nsw/Source/bsmd.database/HAZ.cs b/nsw/Source/bsmd.database/HAZ.cs
index e8ed0234..d05fe8c4 100644
--- a/nsw/Source/bsmd.database/HAZ.cs
+++ b/nsw/Source/bsmd.database/HAZ.cs
@@ -275,6 +275,20 @@ namespace bsmd.database
}
+ public void DeleteElements()
+ {
+ foreach (IMDGPosition imdg in this.IMDGPositions)
+ DBManager.Instance.Delete(imdg);
+ foreach (IMSBCPosition imsbc in this.IMSBCPositions)
+ DBManager.Instance.Delete(imsbc);
+ foreach (IBCPosition ibc in this.IBCPositions)
+ DBManager.Instance.Delete(ibc);
+ foreach (IGCPosition igc in this.IGCPositions)
+ DBManager.Instance.Delete(igc);
+ foreach (MARPOL_Annex_I_Position marpol in this.MARPOLPositions)
+ DBManager.Instance.Delete(marpol);
+ }
+
#endregion
#region IMessageParagraph implementation
diff --git a/nsw/Source/bsmd.database/ISublistContainer.cs b/nsw/Source/bsmd.database/ISublistContainer.cs
index afb43c04..6d213eb4 100644
--- a/nsw/Source/bsmd.database/ISublistContainer.cs
+++ b/nsw/Source/bsmd.database/ISublistContainer.cs
@@ -28,6 +28,10 @@ namespace bsmd.database
///
void SaveElements();
+ ///
+ /// Löscht die untergeordneten Objekte
+ ///
+ void DeleteElements();
}
///
diff --git a/nsw/Source/bsmd.database/MDH.cs b/nsw/Source/bsmd.database/MDH.cs
index f01b5d29..64342e28 100644
--- a/nsw/Source/bsmd.database/MDH.cs
+++ b/nsw/Source/bsmd.database/MDH.cs
@@ -320,6 +320,31 @@ namespace bsmd.database
}
}
+ public void DeleteElements()
+ {
+ foreach (PortOfCallLast30Days poc30d in this.PortOfCallLast30Days)
+ {
+ ((ISublistContainer)poc30d).DeleteElements();
+ DBManager.Instance.Delete(poc30d);
+
+ }
+
+ foreach (SanitaryMeasuresDetail smd in this.SanitaryMeasuresDetails)
+ {
+ DBManager.Instance.Delete(smd);
+ }
+
+ foreach (StowawaysJoiningLocation sjl in this.stowawaysJoiningLocations)
+ {
+ DBManager.Instance.Delete(sjl);
+ }
+
+ foreach (InfectedArea ia in this.InfectedAreas)
+ {
+ DBManager.Instance.Delete(ia);
+ }
+ }
+
public SanitaryMeasuresDetail GetSanitaryMeasuresDetailWithIdentifier(string identifier)
{
foreach (SanitaryMeasuresDetail sd in this.sanitaryMeasuresDetails)
diff --git a/nsw/Source/bsmd.database/Message.cs b/nsw/Source/bsmd.database/Message.cs
index 72e41333..a5c47958 100644
--- a/nsw/Source/bsmd.database/Message.cs
+++ b/nsw/Source/bsmd.database/Message.cs
@@ -483,6 +483,18 @@ namespace bsmd.database
}
}
+ public void DeleteElements()
+ {
+ foreach (DatabaseEntity dbEntity in this.Elements)
+ {
+ if (dbEntity is ISublistContainer)
+ {
+ ((ISublistContainer)dbEntity).DeleteElements();
+ }
+ DBManager.Instance.Delete(dbEntity);
+ }
+ }
+
#endregion
#region IMessageParagraph implementation
diff --git a/nsw/Source/bsmd.database/MessageCore.cs b/nsw/Source/bsmd.database/MessageCore.cs
index 92f5eca5..6c7e6c3b 100644
--- a/nsw/Source/bsmd.database/MessageCore.cs
+++ b/nsw/Source/bsmd.database/MessageCore.cs
@@ -12,6 +12,8 @@ namespace bsmd.database
{
private Guid? previous;
private Guid? next;
+ private DateTime? created;
+ private DateTime? changed;
private Guid? customerId;
private int? wetris_zz_56_datensatz_id;
@@ -111,6 +113,10 @@ namespace bsmd.database
public Guid? DefaultReportingPartyId { get; set; }
+ public DateTime? Changed { get { return this.changed; } }
+
+ public DateTime? Created { get { return this.created; } }
+
#endregion
#region DatabaseEntity implementation
@@ -188,7 +194,7 @@ namespace bsmd.database
"ETA, CustomerId, Previous, Next, IsTransit, Wetris_zz_56_datensatz_id, BSMDStatus, InitialHIS, " +
"HerbergFormGuid, HerbergFormTemplateGuid, HerbergReportType, HerbergEmailContactReportingVessel, " +
"HerbergEmail24HrsContact, ETAKielCanal, HerbergRevDate, ReportStatus, SietasSheetVersion, Incoming, " +
- "DefaultReportingPartyId FROM {0} ",
+ "DefaultReportingPartyId, Created, Changed FROM {0} ",
this.Tablename);
switch (filter)
@@ -283,6 +289,8 @@ namespace bsmd.database
if (!reader.IsDBNull(23)) core.SietasSheetVersion = reader.GetString(23);
if (!reader.IsDBNull(24)) core.Incoming = reader.GetBoolean(24);
if (!reader.IsDBNull(25)) core.DefaultReportingPartyId = reader.GetGuid(25);
+ if (!reader.IsDBNull(26)) core.created = reader.GetDateTime(26);
+ if (!reader.IsDBNull(27)) core.changed = reader.GetDateTime(27);
result.Add(core);
}
diff --git a/nsw/Source/bsmd.database/NOA_NOD.cs b/nsw/Source/bsmd.database/NOA_NOD.cs
index 4ba1060d..1033abec 100644
--- a/nsw/Source/bsmd.database/NOA_NOD.cs
+++ b/nsw/Source/bsmd.database/NOA_NOD.cs
@@ -163,6 +163,14 @@ namespace bsmd.database
}
}
+ public void DeleteElements()
+ {
+ foreach (CallPurpose cp in this.CallPurposes)
+ {
+ DBManager.Instance.Delete(cp);
+ }
+ }
+
#endregion
#region IMessageParagraph implementation
diff --git a/nsw/Source/bsmd.database/PortOfCallLast30Days.cs b/nsw/Source/bsmd.database/PortOfCallLast30Days.cs
index de96e4db..614fbebf 100644
--- a/nsw/Source/bsmd.database/PortOfCallLast30Days.cs
+++ b/nsw/Source/bsmd.database/PortOfCallLast30Days.cs
@@ -138,6 +138,14 @@ namespace bsmd.database
}
}
+ public void DeleteElements()
+ {
+ foreach (PortOfCallLast30DaysCrewJoinedShip cjs in this.CrewJoinedShip)
+ {
+ DBManager.Instance.Delete(cjs);
+ }
+ }
+
#endregion
#region IMessageParagraph implementation
diff --git a/nsw/Source/bsmd.database/SEC.cs b/nsw/Source/bsmd.database/SEC.cs
index 3c0266d3..9d0f9416 100644
--- a/nsw/Source/bsmd.database/SEC.cs
+++ b/nsw/Source/bsmd.database/SEC.cs
@@ -340,6 +340,16 @@ namespace bsmd.database
}
+ void ISublistContainer.DeleteElements()
+ {
+ foreach (LastTenPortFacilitiesCalled l10c in this.LastTenPortFacilitesCalled)
+ DBManager.Instance.Delete(l10c);
+
+ foreach (ShipToShipActivitiesDuringLastTenPortFacilitiesCalled s2s in this.ShipToShipActivitiesDuringLastTenPortFacilitiesCalled)
+ DBManager.Instance.Delete(s2s);
+
+ }
+
#endregion
}
diff --git a/nsw/Source/bsmd.database/WAS.cs b/nsw/Source/bsmd.database/WAS.cs
index ed6bde34..21e19e83 100644
--- a/nsw/Source/bsmd.database/WAS.cs
+++ b/nsw/Source/bsmd.database/WAS.cs
@@ -160,6 +160,19 @@ namespace bsmd.database
}
}
+ public void DeleteElements()
+ {
+ foreach (Waste waste in this.Waste)
+ {
+ DBManager.Instance.Delete(waste);
+ }
+
+ foreach (WasteDisposalServiceProvider wdsp in this.WasteDisposalServiceProvider)
+ {
+ DBManager.Instance.Delete(wdsp);
+ }
+ }
+
#endregion
#region IMessageParagraph implementation
diff --git a/nsw/Source/bsmd.database/bsmd.database.csproj b/nsw/Source/bsmd.database/bsmd.database.csproj
index d1046e7b..55a8d790 100644
--- a/nsw/Source/bsmd.database/bsmd.database.csproj
+++ b/nsw/Source/bsmd.database/bsmd.database.csproj
@@ -39,9 +39,8 @@
..\bsmdKey.snk
-
- ..\packages\log4net.2.0.5\lib\net45-full\log4net.dll
- True
+
+ ..\CoreDeleteTool\packages\log4net.2.0.5\lib\net45-full\log4net.dll