diff --git a/ENI-2/ENI2/ENI2/App.config b/ENI-2/ENI2/ENI2/App.config
index e173ff53..3e273a78 100644
--- a/ENI-2/ENI2/ENI2/App.config
+++ b/ENI-2/ENI2/ENI2/App.config
@@ -26,12 +26,12 @@
1000
- http://192.168.2.24/LockingService/LockingService.svc
-
+
+ http://heupferd/bsmd.LockingService/LockingService.svc
- Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false
-
+
+ Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=E:\DATA\DB\NSW.MDF;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False
diff --git a/nsw/S-211/2021_06_03_STM Conference.docx b/nsw/S-211/2021_06_03_STM Conference.docx
new file mode 100644
index 00000000..49ad9cb1
Binary files /dev/null and b/nsw/S-211/2021_06_03_STM Conference.docx differ
diff --git a/nsw/Source/CoreDeleteTool/App.config b/nsw/Source/CoreDeleteTool/App.config
index fe1adcbd..cac142d6 100644
--- a/nsw/Source/CoreDeleteTool/App.config
+++ b/nsw/Source/CoreDeleteTool/App.config
@@ -11,7 +11,8 @@
- Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False
+ Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false
+
diff --git a/nsw/Source/CoreDeleteTool/Main.Designer.cs b/nsw/Source/CoreDeleteTool/Main.Designer.cs
index 6e58e014..213aed4c 100644
--- a/nsw/Source/CoreDeleteTool/Main.Designer.cs
+++ b/nsw/Source/CoreDeleteTool/Main.Designer.cs
@@ -31,12 +31,24 @@
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();
+ this.buttonClose = new System.Windows.Forms.Button();
+ this.buttonDelete = new System.Windows.Forms.Button();
+ this.buttonLoadAll = new System.Windows.Forms.Button();
+ this.buttonLoadOld = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
+ this.label2 = new System.Windows.Forms.Label();
+ this.labelLoadResult = new System.Windows.Forms.Label();
+ this.statusStrip1 = new System.Windows.Forms.StatusStrip();
+ this.toolStripProgressBar = new System.Windows.Forms.ToolStripProgressBar();
+ this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
+ this.buttonDeleteAll = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.contextMenuStrip.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
+ this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// dataGridView
@@ -49,37 +61,14 @@
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.Location = new System.Drawing.Point(12, 73);
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.Size = new System.Drawing.Size(624, 244);
this.dataGridView.TabIndex = 0;
this.dataGridView.DataBindingComplete += new System.Windows.Forms.DataGridViewBindingCompleteEventHandler(this.dataGridView_DataBindingComplete);
//
- // buttonClose
- //
- this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonClose.Location = new System.Drawing.Point(561, 346);
- this.buttonClose.Name = "buttonClose";
- this.buttonClose.Size = new System.Drawing.Size(75, 23);
- this.buttonClose.TabIndex = 1;
- this.buttonClose.Text = "Close";
- this.buttonClose.UseVisualStyleBackColor = true;
- this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click);
- //
- // buttonDelete
- //
- this.buttonDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.buttonDelete.Location = new System.Drawing.Point(12, 346);
- this.buttonDelete.Name = "buttonDelete";
- this.buttonDelete.Size = new System.Drawing.Size(75, 23);
- this.buttonDelete.TabIndex = 2;
- this.buttonDelete.Text = "Delete";
- this.buttonDelete.UseVisualStyleBackColor = true;
- this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
- //
// contextMenuStrip
//
this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -94,11 +83,131 @@
this.deleteToolStripMenuItem.Text = "Delete";
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.buttonDelete_Click);
//
+ // buttonClose
+ //
+ this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonClose.Location = new System.Drawing.Point(561, 323);
+ this.buttonClose.Name = "buttonClose";
+ this.buttonClose.Size = new System.Drawing.Size(75, 23);
+ this.buttonClose.TabIndex = 1;
+ this.buttonClose.Text = "Close";
+ this.buttonClose.UseVisualStyleBackColor = true;
+ this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click);
+ //
+ // buttonDelete
+ //
+ this.buttonDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.buttonDelete.Location = new System.Drawing.Point(12, 323);
+ this.buttonDelete.Name = "buttonDelete";
+ this.buttonDelete.Size = new System.Drawing.Size(75, 23);
+ this.buttonDelete.TabIndex = 2;
+ this.buttonDelete.Text = "Delete";
+ this.buttonDelete.UseVisualStyleBackColor = true;
+ this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
+ //
+ // buttonLoadAll
+ //
+ this.buttonLoadAll.Location = new System.Drawing.Point(12, 44);
+ this.buttonLoadAll.Name = "buttonLoadAll";
+ this.buttonLoadAll.Size = new System.Drawing.Size(75, 23);
+ this.buttonLoadAll.TabIndex = 3;
+ this.buttonLoadAll.Text = "Load all";
+ this.buttonLoadAll.UseVisualStyleBackColor = true;
+ this.buttonLoadAll.Click += new System.EventHandler(this.buttonLoadAll_Click);
+ //
+ // buttonLoadOld
+ //
+ this.buttonLoadOld.Location = new System.Drawing.Point(202, 7);
+ this.buttonLoadOld.Name = "buttonLoadOld";
+ this.buttonLoadOld.Size = new System.Drawing.Size(75, 23);
+ this.buttonLoadOld.TabIndex = 4;
+ this.buttonLoadOld.Text = "Load";
+ this.buttonLoadOld.UseVisualStyleBackColor = true;
+ this.buttonLoadOld.Click += new System.EventHandler(this.buttonLoadOld_Click);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(12, 12);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(81, 13);
+ this.label1.TabIndex = 5;
+ this.label1.Text = "Load older than";
+ //
+ // numericUpDown1
+ //
+ this.numericUpDown1.Location = new System.Drawing.Point(99, 10);
+ this.numericUpDown1.Name = "numericUpDown1";
+ this.numericUpDown1.Size = new System.Drawing.Size(50, 20);
+ this.numericUpDown1.TabIndex = 6;
+ this.numericUpDown1.Value = new decimal(new int[] {
+ 18,
+ 0,
+ 0,
+ 0});
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(155, 12);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(41, 13);
+ this.label2.TabIndex = 7;
+ this.label2.Text = "months";
+ //
+ // labelLoadResult
+ //
+ this.labelLoadResult.AutoSize = true;
+ this.labelLoadResult.Location = new System.Drawing.Point(283, 12);
+ this.labelLoadResult.Name = "labelLoadResult";
+ this.labelLoadResult.Size = new System.Drawing.Size(0, 13);
+ this.labelLoadResult.TabIndex = 8;
+ //
+ // statusStrip1
+ //
+ this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.toolStripProgressBar,
+ this.toolStripStatusLabel});
+ this.statusStrip1.Location = new System.Drawing.Point(0, 356);
+ this.statusStrip1.Name = "statusStrip1";
+ this.statusStrip1.Size = new System.Drawing.Size(648, 22);
+ this.statusStrip1.TabIndex = 9;
+ this.statusStrip1.Text = "statusStrip1";
+ //
+ // toolStripProgressBar
+ //
+ this.toolStripProgressBar.Name = "toolStripProgressBar";
+ this.toolStripProgressBar.Size = new System.Drawing.Size(100, 16);
+ //
+ // toolStripStatusLabel
+ //
+ this.toolStripStatusLabel.Name = "toolStripStatusLabel";
+ this.toolStripStatusLabel.Size = new System.Drawing.Size(0, 17);
+ //
+ // buttonDeleteAll
+ //
+ this.buttonDeleteAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.buttonDeleteAll.Location = new System.Drawing.Point(99, 323);
+ this.buttonDeleteAll.Name = "buttonDeleteAll";
+ this.buttonDeleteAll.Size = new System.Drawing.Size(75, 23);
+ this.buttonDeleteAll.TabIndex = 10;
+ this.buttonDeleteAll.Text = "Delete all";
+ this.buttonDeleteAll.UseVisualStyleBackColor = true;
+ this.buttonDeleteAll.Click += new System.EventHandler(this.buttonDeleteAll_Click);
+ //
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(648, 377);
+ this.ClientSize = new System.Drawing.Size(648, 378);
+ this.Controls.Add(this.buttonDeleteAll);
+ this.Controls.Add(this.statusStrip1);
+ this.Controls.Add(this.labelLoadResult);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.numericUpDown1);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.buttonLoadOld);
+ this.Controls.Add(this.buttonLoadAll);
this.Controls.Add(this.buttonDelete);
this.Controls.Add(this.buttonClose);
this.Controls.Add(this.dataGridView);
@@ -107,7 +216,11 @@
this.Text = "ENI message core removal tool";
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.contextMenuStrip.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
+ this.statusStrip1.ResumeLayout(false);
+ this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -118,6 +231,16 @@
private System.Windows.Forms.Button buttonDelete;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip;
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
+ private System.Windows.Forms.Button buttonLoadAll;
+ private System.Windows.Forms.Button buttonLoadOld;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.NumericUpDown numericUpDown1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label labelLoadResult;
+ private System.Windows.Forms.StatusStrip statusStrip1;
+ private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar;
+ private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel;
+ private System.Windows.Forms.Button buttonDeleteAll;
}
}
diff --git a/nsw/Source/CoreDeleteTool/Main.cs b/nsw/Source/CoreDeleteTool/Main.cs
index 0f3e9b73..5bfcc848 100644
--- a/nsw/Source/CoreDeleteTool/Main.cs
+++ b/nsw/Source/CoreDeleteTool/Main.cs
@@ -1,11 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+
using System.Windows.Forms;
using bsmd.database;
@@ -29,33 +23,14 @@ namespace CoreDeleteTool
if (DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString))
{
- 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);
-
+ MessageBox.Show("Cannot connect to database!");
}
- this.dataGridView.DataSource = this.messageCores;
+
}
#endregion
@@ -68,17 +43,19 @@ namespace CoreDeleteTool
{
if (MessageBox.Show("Delete selected item(s)?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
{
+ this.toolStripProgressBar.Maximum = this.dataGridView.SelectedRows.Count;
+ this.toolStripStatusLabel.Text = string.Format("Removing {0} items..", this.dataGridView.SelectedRows.Count);
+
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);
+ this.toolStripProgressBar.Value = i;
}
- }
- // TODO:refresh data source?
+ }
}
}
}
@@ -97,6 +74,46 @@ namespace CoreDeleteTool
private void menuStripDelete_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
this.buttonDelete_Click(sender, new EventArgs());
+ }
+
+ private void buttonLoadOld_Click(object sender, EventArgs e)
+ {
+ this.messageCores.Clear();
+ foreach (MessageCore mc in DBManager.Instance.GetMessageCoresOlderThan((int)this.numericUpDown1.Value))
+ this.messageCores.Add(mc);
+ this.dataGridView.DataSource = this.messageCores;
+ this.toolStripStatusLabel.Text = string.Format("{0} cores found", this.messageCores.Count);
+ }
+
+ private void buttonLoadAll_Click(object sender, EventArgs e)
+ {
+ foreach (MessageCore mc in DBManager.Instance.GetMessageCoresByStatus(MessageCore.BSMDStatus.PREPARE))
+ this.messageCores.Add(mc);
+ this.dataGridView.DataSource = this.messageCores;
+ this.toolStripStatusLabel.Text = string.Format("{0} cores found", this.messageCores.Count);
+ }
+
+ private void buttonDeleteAll_Click(object sender, EventArgs e)
+ {
+ if (DBManager.Instance.IsConnected)
+ {
+ if (MessageBox.Show("Delete all items?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
+ {
+ Application.UseWaitCursor = true;
+ this.toolStripProgressBar.Maximum = this.messageCores.Count;
+ this.toolStripStatusLabel.Text = string.Format("Removing {0} items..", this.messageCores.Count);
+
+ for (int i = 0; i < this.messageCores.Count; i++)
+ {
+ MessageCore selectedCore = this.messageCores[i];
+ DBManager.Instance.DeleteCore(selectedCore);
+ this.messageCores.Remove(selectedCore);
+ this.toolStripProgressBar.Value = i;
+ Application.DoEvents();
+ }
+ Application.UseWaitCursor = false;
+ }
+ }
}
#endregion
diff --git a/nsw/Source/CoreDeleteTool/Main.resx b/nsw/Source/CoreDeleteTool/Main.resx
index b8a508a8..00fb699f 100644
--- a/nsw/Source/CoreDeleteTool/Main.resx
+++ b/nsw/Source/CoreDeleteTool/Main.resx
@@ -120,6 +120,9 @@
17, 17
+
+ 166, 17
+
diff --git a/nsw/Source/SendNSWMessageService/App.config b/nsw/Source/SendNSWMessageService/App.config
index b34426a9..3b6ac0f4 100644
--- a/nsw/Source/SendNSWMessageService/App.config
+++ b/nsw/Source/SendNSWMessageService/App.config
@@ -28,12 +28,12 @@
-
- Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False
-
0
+
+ Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=E:\DATA\DB\NSW.MDF;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False
+
\ No newline at end of file
diff --git a/nsw/Source/SendNSWMessageService/Properties/Settings.Designer.cs b/nsw/Source/SendNSWMessageService/Properties/Settings.Designer.cs
index 6e71f153..72ce9f8a 100644
--- a/nsw/Source/SendNSWMessageService/Properties/Settings.Designer.cs
+++ b/nsw/Source/SendNSWMessageService/Properties/Settings.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.34209
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -12,7 +12,7 @@ namespace SendNSWMessageService.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -23,19 +23,6 @@ namespace SendNSWMessageService.Properties {
}
}
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Data Source=(localdb)\\Projects;Initial Catalog=nsw;Integrated Security=True;Conne" +
- "ct Timeout=30;Encrypt=False;TrustServerCertificate=False")]
- public string ConnectionString {
- get {
- return ((string)(this["ConnectionString"]));
- }
- set {
- this["ConnectionString"] = value;
- }
- }
-
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
@@ -47,5 +34,19 @@ namespace SendNSWMessageService.Properties {
this["SleepSeconds"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=E:\\DATA\\DB\\NSW.MDF;Integrated " +
+ "Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;Appl" +
+ "icationIntent=ReadWrite;MultiSubnetFailover=False")]
+ public string ConnectionString {
+ get {
+ return ((string)(this["ConnectionString"]));
+ }
+ set {
+ this["ConnectionString"] = value;
+ }
+ }
}
}
diff --git a/nsw/Source/SendNSWMessageService/Properties/Settings.settings b/nsw/Source/SendNSWMessageService/Properties/Settings.settings
index 6429ec72..5ec10162 100644
--- a/nsw/Source/SendNSWMessageService/Properties/Settings.settings
+++ b/nsw/Source/SendNSWMessageService/Properties/Settings.settings
@@ -2,11 +2,11 @@
-
- Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False
-
0
+
+ Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=E:\DATA\DB\NSW.MDF;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False
+
\ No newline at end of file
diff --git a/nsw/Source/bsmd.database/DBManager.cs b/nsw/Source/bsmd.database/DBManager.cs
index 51f0dc3f..48167b0d 100644
--- a/nsw/Source/bsmd.database/DBManager.cs
+++ b/nsw/Source/bsmd.database/DBManager.cs
@@ -234,6 +234,22 @@ namespace bsmd.database
return result;
}
+ public List GetMessageCoresOlderThan(int months)
+ {
+ List result = new List();
+ MessageCore aMessageCore = new MessageCore();
+ SqlCommand cmd = new SqlCommand();
+ aMessageCore.PrepareLoadCommand(cmd, Message.LoadFilter.BY_AGE, months);
+
+ SqlDataReader reader = this.PerformCommand(cmd);
+ if (reader != null)
+ {
+ foreach (MessageCore core in aMessageCore.LoadList(reader))
+ result.Add(core);
+ }
+ return result;
+ }
+
public int? GetNumCoresWithFilters(Dictionary filters)
{
MessageCore aMessageCore = new MessageCore();
diff --git a/nsw/Source/bsmd.database/Message.cs b/nsw/Source/bsmd.database/Message.cs
index a9074c75..595b2d24 100644
--- a/nsw/Source/bsmd.database/Message.cs
+++ b/nsw/Source/bsmd.database/Message.cs
@@ -138,7 +138,8 @@ namespace bsmd.database
NOT_DELETED,
DELETED,
IMPORTHEADER_ID,
- BY_CORE_AND_CLASS
+ BY_CORE_AND_CLASS,
+ BY_AGE
}
///
diff --git a/nsw/Source/bsmd.database/MessageCore.cs b/nsw/Source/bsmd.database/MessageCore.cs
index 013f2d6c..31dfe0d3 100644
--- a/nsw/Source/bsmd.database/MessageCore.cs
+++ b/nsw/Source/bsmd.database/MessageCore.cs
@@ -57,7 +57,8 @@ namespace bsmd.database
FAILURE,
REPORTREQUESTED,
ARCHIVED,
- HIS_FAILURE_DBH
+ HIS_FAILURE_DBH,
+ INVALID
}
///
@@ -571,6 +572,11 @@ namespace bsmd.database
sb.Append("WHERE QueryNSWStatus = 1");
break;
}
+ case Message.LoadFilter.BY_AGE:
+ {
+ sb.AppendFormat("WHERE Created < DATEADD(month, -{0}, GETDATE())", criteria[0]);
+ break;
+ }
case Message.LoadFilter.SEARCH_CORE_FILTERS:
{
// object ist jetzt ein dict aus filtertyp und filterparameter