Implementierung CoreDeleteTool im Zug nach Hamburg
This commit is contained in:
parent
47a3397dee
commit
8a760dae4d
Binary file not shown.
@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="CoreDeleteTool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="CoreDeleteTool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
|
||||
</startup>
|
||||
<userSettings>
|
||||
<CoreDeleteTool.Properties.Settings>
|
||||
|
||||
@ -9,9 +9,10 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CoreDeleteTool</RootNamespace>
|
||||
<AssemblyName>CoreDeleteTool</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@ -63,6 +64,8 @@
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="PropertyComparer.cs" />
|
||||
<Compile Include="SortableBindingList.cs" />
|
||||
<EmbeddedResource Include="Main.resx">
|
||||
<DependentUpon>Main.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@ -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
|
||||
|
||||
24
nsw/Source/CoreDeleteTool/Main.Designer.cs
generated
24
nsw/Source/CoreDeleteTool/Main.Designer.cs
generated
@ -28,11 +28,15 @@
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ namespace CoreDeleteTool
|
||||
{
|
||||
public partial class Main : Form
|
||||
{
|
||||
List<MessageCore> messageCores = new List<MessageCore>();
|
||||
SortableBindingList<MessageCore> messageCores = new SortableBindingList<MessageCore>();
|
||||
|
||||
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++)
|
||||
{
|
||||
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
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="contextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace CoreDeleteTool.Properties
|
||||
{
|
||||
namespace CoreDeleteTool.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -22,28 +22,23 @@ 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() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[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;
|
||||
}
|
||||
@ -56,14 +51,11 @@ namespace CoreDeleteTool.Properties
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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())));
|
||||
|
||||
50
nsw/Source/CoreDeleteTool/PropertyComparer.cs
Normal file
50
nsw/Source/CoreDeleteTool/PropertyComparer.cs
Normal file
@ -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<T> : IComparer<T>
|
||||
{
|
||||
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<T> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
99
nsw/Source/CoreDeleteTool/SortableBindingList.cs
Normal file
99
nsw/Source/CoreDeleteTool/SortableBindingList.cs
Normal file
@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
// Gratitude:http://betimvwframework.codeplex.com/
|
||||
|
||||
namespace CoreDeleteTool
|
||||
{
|
||||
public class SortableBindingList<T> : BindingList<T>
|
||||
{
|
||||
private readonly Dictionary<Type, PropertyComparer<T>> comparers;
|
||||
private bool isSorted;
|
||||
private ListSortDirection listSortDirection;
|
||||
private PropertyDescriptor propertyDescriptor;
|
||||
|
||||
public SortableBindingList()
|
||||
: base(new List<T>())
|
||||
{
|
||||
this.comparers = new Dictionary<Type, PropertyComparer<T>>();
|
||||
}
|
||||
|
||||
public SortableBindingList(IEnumerable<T> enumeration)
|
||||
: base(new List<T>(enumeration))
|
||||
{
|
||||
this.comparers = new Dictionary<Type, PropertyComparer<T>>();
|
||||
}
|
||||
|
||||
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<T> itemsList = (List<T>)this.Items;
|
||||
|
||||
Type propertyType = property.PropertyType;
|
||||
PropertyComparer<T> comparer;
|
||||
if (!this.comparers.TryGetValue(propertyType, out comparer))
|
||||
{
|
||||
comparer = new PropertyComparer<T>(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,6 +118,14 @@ namespace bsmd.database
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteElements()
|
||||
{
|
||||
foreach(PortOfItinerary poi in this.PortOfItineraries)
|
||||
{
|
||||
DBManager.Instance.Delete(poi);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IMessageParagraph implementation
|
||||
|
||||
@ -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
|
||||
@ -365,6 +370,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)
|
||||
{
|
||||
List<string> truncatedFields = new List<string>();
|
||||
|
||||
@ -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
|
||||
|
||||
@ -28,6 +28,10 @@ namespace bsmd.database
|
||||
/// </summary>
|
||||
void SaveElements();
|
||||
|
||||
/// <summary>
|
||||
/// Löscht die untergeordneten Objekte
|
||||
/// </summary>
|
||||
void DeleteElements();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -163,6 +163,14 @@ namespace bsmd.database
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteElements()
|
||||
{
|
||||
foreach (CallPurpose cp in this.CallPurposes)
|
||||
{
|
||||
DBManager.Instance.Delete(cp);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IMessageParagraph implementation
|
||||
|
||||
@ -138,6 +138,14 @@ namespace bsmd.database
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteElements()
|
||||
{
|
||||
foreach (PortOfCallLast30DaysCrewJoinedShip cjs in this.CrewJoinedShip)
|
||||
{
|
||||
DBManager.Instance.Delete(cjs);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IMessageParagraph implementation
|
||||
|
||||
@ -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
|
||||
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -39,9 +39,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.5\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\CoreDeleteTool\packages\log4net.2.0.5\lib\net45-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user