diff --git a/ENI2/DetailViewControls/PortCallDetailControl.xaml b/ENI2/DetailViewControls/PortCallDetailControl.xaml
index 75e598c0..ec501312 100644
--- a/ENI2/DetailViewControls/PortCallDetailControl.xaml
+++ b/ENI2/DetailViewControls/PortCallDetailControl.xaml
@@ -92,8 +92,9 @@
-
-
+
+
+
@@ -104,10 +105,11 @@
-
+
-
+
+
diff --git a/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs b/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs
index a0f18f0a..e59ea133 100644
--- a/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs
+++ b/ENI2/DetailViewControls/PortCallDetailControl.xaml.cs
@@ -25,6 +25,7 @@ namespace ENI2.DetailViewControls
private NOA_NOD _noa_nod;
private AGNT _agnt;
+ private WAS _was;
private static List _agntTemplates = null;
private AGNT_Template _currentTemplate;
private AGNT_Template _undoTemplate;
@@ -95,6 +96,16 @@ namespace ENI2.DetailViewControls
_agnt = new AGNT();
this.ControlMessages.Add(aMessage);
}
+
+ if(aMessage.MessageNotificationClass == Message.NotificationClass.WAS)
+ {
+ if (aMessage.Elements.Count > 0)
+ _was = aMessage.Elements[0] as WAS;
+ else
+ _was = new WAS();
+ this.ControlMessages.Add(aMessage);
+ }
+
}
this.dateTimePicker_ETAToKielCanal.IsEnabled = this.Core.IsTransit;
@@ -123,6 +134,8 @@ namespace ENI2.DetailViewControls
this.dateTimePicker_ETDFromLastPort.DataContext = _noa_nod;
this.dateTimePicker_ETDFromPortOfCall.DataContext = _noa_nod;
+ this.textBox_WasteDisposalServiceProvider.DataContext = _was;
+
this.checkBox_IsAnchored.IsEnabled = this.Core.IsDK;
if(_agntTemplates == null)
@@ -337,6 +350,9 @@ namespace ENI2.DetailViewControls
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentStreetAndNumber.Text = this._undoTemplate.AgentStreetAndNumber;
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName;
+ this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.SublistElementChanged(Message.NotificationClass.WAS);
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
}
@@ -356,7 +372,7 @@ namespace ENI2.DetailViewControls
this.textBox_AgentEMail.Text = this._currentTemplate.AgentEMail;
this.textBox_AgentEMail.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentFax.Text = this._currentTemplate.AgentFax;
- this.textBox_AgentEMail.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.textBox_AgentFax.GetBindingExpression (TextBox.TextProperty).UpdateSource();
this.textBox_AgentFirstName.Text = this._currentTemplate.AgentFirstName;
this.textBox_AgentFirstName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentLastName.Text = this._currentTemplate.AgentLastName;
@@ -367,6 +383,9 @@ namespace ENI2.DetailViewControls
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber;
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName;
+ this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.SublistElementChanged(Message.NotificationClass.WAS);
this.buttonUndoTemplate.IsEnabled = true;
this.buttonSetTemplate.IsEnabled = false;
@@ -392,6 +411,7 @@ namespace ENI2.DetailViewControls
at.AgentPhone = this.textBox_AgentPhone.Text;
at.AgentPostalCode = this.textBox_AgentPostalCode.Text;
at.AgentStreetAndNumber = textBox_AgentStreetAndNumber.Text;
+ at.WasteDisposalServiceProviderName = textBox_WasteDisposalServiceProvider.Text;
return at;
}
diff --git a/ENI2/DetailViewControls/WasteDetailControl.xaml b/ENI2/DetailViewControls/WasteDetailControl.xaml
index 53bfa5f4..dcfe0b54 100644
--- a/ENI2/DetailViewControls/WasteDetailControl.xaml
+++ b/ENI2/DetailViewControls/WasteDetailControl.xaml
@@ -35,7 +35,6 @@
-
@@ -56,38 +55,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs
index 696c94c8..a30426d9 100644
--- a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs
+++ b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs
@@ -13,8 +13,6 @@ using ExcelDataReader;
using System.IO;
using System;
using Microsoft.Win32;
-using System.Diagnostics;
-using System.Threading.Tasks;
namespace ENI2.DetailViewControls
{
@@ -24,14 +22,14 @@ namespace ENI2.DetailViewControls
public partial class WasteDetailControl : DetailBaseControl
{
+ #region Fields
+
private Message _wasMessage;
private WAS _was;
private Message _wasRcptMessage;
private WAS_RCPT _selectedWAS_RCPT;
- private static List _wsdpTemplates = null;
- private WasteDisposalServiceProvider_Template _currentTemplate;
- private string _undoTemplate;
+ #endregion
public WasteDetailControl()
{
@@ -46,7 +44,7 @@ namespace ENI2.DetailViewControls
this.RegisterLocodeChange(this.locodeCtrlNextWastePort, Message.NotificationClass.WAS);
this.RegisterCheckboxChange(this.checkBoxAccurateCorrectDetails, Message.NotificationClass.WAS);
this.RegisterCheckboxChange(this.checkBoxValidExemption, Message.NotificationClass.WAS);
- this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS);
+ this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS);
this.RegisterTextboxChange(this.textBoxWasteDisposalServiceProviders, Message.NotificationClass.WAS);
this.dataGridWasteReceived.CellEditEnding += (obj, ev) => { this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); };
}
@@ -77,7 +75,7 @@ namespace ENI2.DetailViewControls
WasteCapacity_MTQ = 0,
WasteDescription = "",
WasteDisposalAmount_MTQ = 0,
- WasteDisposalPort = "ZZUKN"
+ WasteDisposalPort = "ZZUKN"
};
this._was.Waste.Add(newWaste);
}
@@ -123,7 +121,7 @@ namespace ENI2.DetailViewControls
was.MessageCore = this.Core;
was.MessageHeader = this._wasMessage;
_wasMessage.Elements.Add(was);
- }
+ }
else
{
// remove "old" Waste Entries from display (not deleted in the DB!)
@@ -131,14 +129,14 @@ namespace ENI2.DetailViewControls
{
if (was.Waste[i].WasteType > 999)
was.Waste.RemoveAt(i);
- }
+ }
}
this.wasGroupBox.DataContext = was;
this._was = was;
this.dataGridWaste.Initialize();
- this.dataGridWaste.ItemsSource = was.Waste;
+ this.dataGridWaste.ItemsSource = was.Waste;
this.dataGridWaste.AddingNewItem += DataGridWaste_AddingNewItem;
this.dataGridWaste.EditRequested += DataGridWaste_EditRequested;
this.dataGridWaste.DeleteRequested += DataGridWaste_DeleteRequested;
@@ -177,14 +175,6 @@ namespace ENI2.DetailViewControls
#endregion
- #region init WSDP provider
-
- await InitTemplates();
-
- this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
-
- #endregion
-
}
public override int SelectedTabIndex
@@ -223,11 +213,11 @@ namespace ENI2.DetailViewControls
this.dataGridWasteReceipt.Items.Refresh();
this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
- this.dataGridWasteReceived.ItemsSource = null;
+ this.dataGridWasteReceived.ItemsSource = null;
dataGridWasteReceipt_SelectionChanged(this, null);
}
- await InitTemplates(); // templates might have changed in the dialog
+
}
private void DataGridWasteReceipt_DeleteRequested(DatabaseEntity obj)
@@ -269,11 +259,11 @@ namespace ENI2.DetailViewControls
if (!_wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
_wasRcptMessage.Elements.Add(epd.WAS_RCPT);
}
- this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
+ this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
this.dataGridWasteReceipt.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
dataGridWasteReceipt_SelectionChanged(this, null);
- await InitTemplates(); // templates might have changed in the dialog
+
}
private void DataGridWasteReceipt_AddingNewItem(object sender, AddingNewItemEventArgs e)
@@ -425,7 +415,7 @@ namespace ENI2.DetailViewControls
{
// are you sure dialog is in base class
_was.Waste.Remove(waste);
- DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(waste);
+ DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(waste);
DatabaseEntity.ResetIdentifiers(new List(_was.Waste));
this.SublistElementChanged(Message.NotificationClass.WAS);
this.dataGridWaste.Items.Refresh();
@@ -483,7 +473,7 @@ namespace ENI2.DetailViewControls
HighlightService.HighlightControl(this.wasGroupBox, HighlightService.HighlightStyle.VIOLATION, this._wasMessage);
}
- #endregion
+ #endregion
#region Excel file import
@@ -500,7 +490,7 @@ namespace ENI2.DetailViewControls
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
@@ -527,7 +517,7 @@ namespace ENI2.DetailViewControls
if (reader.FieldCount < 9)
{
throw new InvalidDataException("Sheet must have 9 Columns of data");
- }
+ }
if (!reader.IsDBNull(1)) o = reader.GetValue(1); else o = null;
if ((o != null) && Int32.TryParse(o.ToString(), out int wasteType))
@@ -591,102 +581,7 @@ namespace ENI2.DetailViewControls
}
- #endregion
-
- #region Waste disposal Service Provider templates event handler
-
- private async Task InitTemplates()
- {
- _wsdpTemplates = await DBManagerAsync.GetWastDisposalServiceProviderTemplatesAsync();
- _wsdpTemplates.Sort();
- this.comboBox_WSDPTemplate.ItemsSource = null;
- this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
- Trace.WriteLine($"{_wsdpTemplates.Count} WSDP templates loaded");
- }
-
- private void comboBox_WSDPTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- Trace.WriteLine("WSDP combo selection changed");
- if(this.comboBox_WSDPTemplate.SelectedItem is WasteDisposalServiceProvider_Template wdsp_t)
- {
- this.textBoxTemplateTitle.Text = wdsp_t.Remark;
- this.buttonDeleteTemplate.IsEnabled = true;
- this._currentTemplate = wdsp_t;
- this._undoTemplate = this.textBoxWasteDisposalServiceProviders.Text.Trim();
- this.buttonUndoTemplate.IsEnabled = this._undoTemplate.Length > 0;
- this.textBoxWasteDisposalServiceProviders.Text = wdsp_t.WasteDisposalServiceProviderName;
- }
- }
-
- private async void buttonSaveTemplate_Click(object sender, RoutedEventArgs e)
- {
- string currentWSDPProviderName = this.textBoxWasteDisposalServiceProviders.Text.Trim();
- string currentRemark = this.textBoxTemplateTitle.Text.Trim();
-
- if ((currentWSDPProviderName.Length == 0) || (currentRemark.Length == 0)) return;
-
- WasteDisposalServiceProvider_Template existingTemplate = null;
- foreach(WasteDisposalServiceProvider_Template wdsp_template in _wsdpTemplates)
- {
- // bei gefundenem Match wird ggf. der Remark überschrieben
- if (wdsp_template.Remark.Equals(currentRemark))
- {
- existingTemplate = wdsp_template;
- break;
- }
- }
-
- if(existingTemplate != null)
- {
- if (MessageBox.Show("A template with this name already exists, overwrite?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
- return;
-
- existingTemplate.WasteDisposalServiceProviderName = currentWSDPProviderName;
- await DBManagerAsync.SaveAsync(existingTemplate);
- return;
- }
-
- WasteDisposalServiceProvider_Template newTemplate = new WasteDisposalServiceProvider_Template();
- newTemplate.WasteDisposalServiceProviderName = currentWSDPProviderName;
- newTemplate.Remark = currentRemark;
- await DBManagerAsync.SaveAsync(newTemplate);
-
- comboBox_WSDPTemplate.ItemsSource = null;
- _wsdpTemplates.Add(newTemplate);
- _wsdpTemplates.Sort();
- comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
- MessageBox.Show("Template saved", "OK", MessageBoxButton.OK, MessageBoxImage.Information);
- }
-
- private void buttonDeleteTemplate_Click(object sender, RoutedEventArgs e)
- {
- if(_currentTemplate != null)
- {
- if (MessageBox.Show("Delete this template?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
- {
- this.comboBox_WSDPTemplate.SelectedItem = null;
- this.comboBox_WSDPTemplate.ItemsSource = null;
- DBManager.Instance.Delete(_currentTemplate);
- _wsdpTemplates.Remove(_currentTemplate);
- this.textBoxTemplateTitle.Text = null;
- this.buttonDeleteTemplate.IsEnabled = false;
- this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
- }
- }
- }
-
- private void buttonUndoTemplate_Click(object sender, RoutedEventArgs e)
- {
- if(this._undoTemplate != null)
- {
- this.textBoxWasteDisposalServiceProviders.Text = this._undoTemplate;
- this.buttonUndoTemplate.IsEnabled = false;
- this._undoTemplate = null;
- this.comboBox_WSDPTemplate.SelectedItem = null;
- }
- }
-
- #endregion
+ #endregion
#region Copy WAS to WAS_RCPT handler
@@ -694,7 +589,7 @@ namespace ENI2.DetailViewControls
{
if (_selectedWAS_RCPT == null) return;
- if(MessageBox.Show(Properties.Resources.textCopyToWASConfirmation, Properties.Resources.textConfirmation,
+ if(MessageBox.Show(Properties.Resources.textCopyToWASConfirmation, Properties.Resources.textConfirmation,
MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
{
foreach(Waste waste in _was.Waste)
diff --git a/ENI2/EditControls/EditWasteReceiptDialog.xaml.cs b/ENI2/EditControls/EditWasteReceiptDialog.xaml.cs
index aac2580f..ab678232 100644
--- a/ENI2/EditControls/EditWasteReceiptDialog.xaml.cs
+++ b/ENI2/EditControls/EditWasteReceiptDialog.xaml.cs
@@ -45,7 +45,7 @@ namespace ENI2.EditControls
OKClicked += EditWasteReceiptDialog_OKClicked;
this.AddVisible = true;
- _wsdpTemplates = await DBManagerAsync.GetWastDisposalServiceProviderTemplatesAsync();
+ _wsdpTemplates = await DBManagerAsync.GetWasteDisposalServiceProviderTemplatesAsync();
_wsdpTemplates.Sort();
Trace.WriteLine($"{_wsdpTemplates.Count} WSDP templates loaded");
diff --git a/ENI2/Properties/Resources.Designer.cs b/ENI2/Properties/Resources.Designer.cs
index 86c7a834..72b7ddcf 100644
--- a/ENI2/Properties/Resources.Designer.cs
+++ b/ENI2/Properties/Resources.Designer.cs
@@ -6340,6 +6340,15 @@ namespace ENI2.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to Waste disposal service provider.
+ ///
+ public static string textWasteDisposalServiceProvider {
+ get {
+ return ResourceManager.GetString("textWasteDisposalServiceProvider", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Waste disposal service providers.
///
diff --git a/ENI2/Properties/Resources.resx b/ENI2/Properties/Resources.resx
index 89059ac3..c641b5da 100644
--- a/ENI2/Properties/Resources.resx
+++ b/ENI2/Properties/Resources.resx
@@ -2245,4 +2245,7 @@
..\Resources\pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ Waste disposal service provider
+
\ No newline at end of file
diff --git a/ENI2/SheetDisplayControls/PortControl.xaml b/ENI2/SheetDisplayControls/PortControl.xaml
index 44a96aea..5c675422 100644
--- a/ENI2/SheetDisplayControls/PortControl.xaml
+++ b/ENI2/SheetDisplayControls/PortControl.xaml
@@ -88,7 +88,7 @@
-
+
@@ -106,6 +106,7 @@
+
@@ -125,6 +126,7 @@
+
@@ -176,11 +178,12 @@
+
-
-
-
-
+
+
+
+
@@ -212,7 +215,7 @@
-
+
@@ -312,7 +315,7 @@
-
+
@@ -338,7 +341,7 @@
-
+
@@ -347,39 +350,13 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/ENI2/SheetDisplayControls/PortControl.xaml.cs b/ENI2/SheetDisplayControls/PortControl.xaml.cs
index 99d6cabc..4c0680c3 100644
--- a/ENI2/SheetDisplayControls/PortControl.xaml.cs
+++ b/ENI2/SheetDisplayControls/PortControl.xaml.cs
@@ -128,6 +128,7 @@ namespace ENI2.SheetDisplayControls
this.textBox_AgentPhone.DataContext = this._agnt;
this.textBox_AgentPostalCode.DataContext = this._agnt;
this.textBox_AgentStreetAndNumber.DataContext = this._agnt;
+ this.textBox_WasteDisposalServiceProvider.DataContext = this._was;
if (_agntTemplates == null)
{
_agntTemplates = await DBManagerAsync.GetAGNTTemplatesAsync(); // inital full load
@@ -349,7 +350,7 @@ namespace ENI2.SheetDisplayControls
this.textBox_AgentEMail.Text = this._currentTemplate.AgentEMail;
this.textBox_AgentEMail.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentFax.Text = this._currentTemplate.AgentFax;
- this.textBox_AgentEMail.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.textBox_AgentFax.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentFirstName.Text = this._currentTemplate.AgentFirstName;
this.textBox_AgentFirstName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentLastName.Text = this._currentTemplate.AgentLastName;
@@ -360,6 +361,9 @@ namespace ENI2.SheetDisplayControls
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentStreetAndNumber.Text = this._currentTemplate.AgentStreetAndNumber;
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.textBox_WasteDisposalServiceProvider.Text = this._currentTemplate.WasteDisposalServiceProviderName;
+ this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.SublistElementChanged(Message.NotificationClass.WAS);
this.buttonUndoTemplate.IsEnabled = true;
this.buttonSetTemplate.IsEnabled = false;
@@ -447,6 +451,9 @@ namespace ENI2.SheetDisplayControls
this.textBox_AgentPostalCode.GetBindingExpression(TextBox.TextProperty).UpdateSource();
this.textBox_AgentStreetAndNumber.Text = this._undoTemplate.AgentStreetAndNumber;
this.textBox_AgentStreetAndNumber.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.textBox_WasteDisposalServiceProvider.Text = this._undoTemplate.WasteDisposalServiceProviderName;
+ this.textBox_WasteDisposalServiceProvider.GetBindingExpression(TextBox.TextProperty).UpdateSource();
+ this.SublistElementChanged(Message.NotificationClass.WAS);
this.buttonUndoTemplate.IsEnabled = false; // can't undo after undo
}
@@ -468,6 +475,7 @@ namespace ENI2.SheetDisplayControls
at.AgentPhone = this.textBox_AgentPhone.Text;
at.AgentPostalCode = this.textBox_AgentPostalCode.Text;
at.AgentStreetAndNumber = textBox_AgentStreetAndNumber.Text;
+ at.WasteDisposalServiceProviderName = textBox_WasteDisposalServiceProvider.Text;
return at;
}
@@ -723,7 +731,7 @@ namespace ENI2.SheetDisplayControls
private async Task InitTemplates()
{
- _wsdpTemplates = await DBManagerAsync.GetWastDisposalServiceProviderTemplatesAsync();
+ _wsdpTemplates = await DBManagerAsync.GetWasteDisposalServiceProviderTemplatesAsync();
_wsdpTemplates.Sort();
this.comboBox_WSDPTemplate.ItemsSource = null;
this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
diff --git a/bsmd.database/AGNT_Template.cs b/bsmd.database/AGNT_Template.cs
index ca89501c..0c2c4f62 100644
--- a/bsmd.database/AGNT_Template.cs
+++ b/bsmd.database/AGNT_Template.cs
@@ -5,8 +5,6 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
-using System.Runtime.Serialization;
-
namespace bsmd.database
{
@@ -56,6 +54,9 @@ namespace bsmd.database
[MaxLength(99)]
public string AgentEMail { get; set; }
+ [MaxLength(99)]
+ public string WasteDisposalServiceProviderName { get; set; }
+
#endregion
#region DatabaseEntity implementation
@@ -86,6 +87,8 @@ namespace bsmd.database
else scmd.Parameters.AddWithValue("@P10", DBNull.Value);
if (this.AgentEMail != null) scmd.Parameters.AddWithValue("@P11", this.AgentEMail);
else scmd.Parameters.AddWithValue("@P11", DBNull.Value);
+ if (this.WasteDisposalServiceProviderName != null) scmd.Parameters.AddWithValue("@P12", this.WasteDisposalServiceProviderName);
+ else scmd.Parameters.AddWithValue("@P12", DBNull.Value);
if (this.IsNew)
{
@@ -93,13 +96,13 @@ namespace bsmd.database
scmd.Parameters.AddWithValue("@ID", this.Id);
cmd.CommandText = string.Format("INSERT INTO {0} (Id, Title, AgentCompanyName, AgentStreetAndNumber, " +
"AgentPostalCode, AgentCity, AgentCountry, AgentLastName, AgentFirstName, AgentPhone, AgentFax, " +
- "AgentEMail) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11)", this.Tablename);
+ "AgentEMail, WasteDisposalServiceProviderName) VALUES (@ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12)", this.Tablename);
}
else
{
cmd.CommandText = string.Format("UPDATE {0} SET Title = @P1, AgentCompanyName = @P2, AgentStreetAndNumber = @P3, AgentPostalCode = @P4, AgentCity = @P5, " +
"AgentCountry = @P6, AgentLastName = @P7, AgentFirstName = @P8, AgentPhone = @P9, AgentFax = @P10, " +
- "AgentEMail = @P11 WHERE Id = @ID", this.Tablename);
+ "AgentEMail = @P11, WasteDisposalServiceProviderName = @P12 WHERE Id = @ID", this.Tablename);
scmd.Parameters.AddWithValue("@ID", this.Id);
}
}
@@ -107,7 +110,7 @@ namespace bsmd.database
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, Title, AgentCompanyName, AgentStreetAndNumber, AgentPostalCode, AgentCity, AgentCountry, " +
- "AgentLastName, AgentFirstName, AgentPhone, AgentFax, AgentEMail FROM {0} ", this.Tablename);
+ "AgentLastName, AgentFirstName, AgentPhone, AgentFax, AgentEMail, WasteDisposalServiceProviderName FROM {0} ", this.Tablename);
switch (filter)
{
@@ -138,6 +141,7 @@ namespace bsmd.database
if (!reader.IsDBNull(9)) agnt_t.AgentPhone = reader.GetString(9);
if (!reader.IsDBNull(10)) agnt_t.AgentFax = reader.GetString(10);
if (!reader.IsDBNull(11)) agnt_t.AgentEMail = reader.GetString(11);
+ if (!reader.IsDBNull(12)) agnt_t.WasteDisposalServiceProviderName = reader.GetString(12);
result.Add(agnt_t);
}
@@ -172,6 +176,7 @@ namespace bsmd.database
if (!reader.IsDBNull(9)) agnt_t.AgentPhone = reader.GetString(9);
if (!reader.IsDBNull(10)) agnt_t.AgentFax = reader.GetString(10);
if (!reader.IsDBNull(11)) agnt_t.AgentEMail = reader.GetString(11);
+ if (!reader.IsDBNull(12)) agnt_t.WasteDisposalServiceProviderName = reader.GetString(12);
}
return agnt_t;
}
diff --git a/bsmd.database/DBManagerAsync.cs b/bsmd.database/DBManagerAsync.cs
index acd8d9ae..ff1a0c0c 100644
--- a/bsmd.database/DBManagerAsync.cs
+++ b/bsmd.database/DBManagerAsync.cs
@@ -122,7 +122,7 @@ namespace bsmd.database
}
- public static async Task> GetWastDisposalServiceProviderTemplatesAsync()
+ public static async Task> GetWasteDisposalServiceProviderTemplatesAsync()
{
SqlCommand cmd = new SqlCommand();
WasteDisposalServiceProvider_Template wdsp_t = new WasteDisposalServiceProvider_Template();