Arbeit an ENI2, WAS_RCPT Dialog, Laden, Speichern korrigiert, WIP
This commit is contained in:
parent
badae00486
commit
3fb2c519fc
@ -145,7 +145,7 @@
|
|||||||
<GroupBox Name="was_rcptGroupBox" Header="{x:Static p:Resources.textWasteReceipt}">
|
<GroupBox Name="was_rcptGroupBox" Header="{x:Static p:Resources.textWasteReceipt}">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="80" />
|
<RowDefinition Height="120" />
|
||||||
<RowDefinition Height="330*" />
|
<RowDefinition Height="330*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<enictrl:ENIDataGrid x:Name="dataGridWasteReceipt" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
<enictrl:ENIDataGrid x:Name="dataGridWasteReceipt" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||||
@ -155,7 +155,7 @@
|
|||||||
<DataGridTextColumn Header="{x:Static p:Resources.textIdentificationNumber}" Binding="{Binding IdentificationNumber}" IsReadOnly="True" Width="Auto" />
|
<DataGridTextColumn Header="{x:Static p:Resources.textIdentificationNumber}" Binding="{Binding IdentificationNumber}" IsReadOnly="True" Width="Auto" />
|
||||||
<DataGridTextColumn Header="{x:Static p:Resources.textPortReceptionFacilityName}" Binding="{Binding PortReceptionFacilityName}" IsReadOnly="True" Width="Auto" />
|
<DataGridTextColumn Header="{x:Static p:Resources.textPortReceptionFacilityName}" Binding="{Binding PortReceptionFacilityName}" IsReadOnly="True" Width="Auto" />
|
||||||
<DataGridTextColumn Header="{x:Static p:Resources.textPortReceptionFacilityProviderName}" Binding="{Binding PortReceptionFacilityProviderName}" IsReadOnly="True" Width="Auto" />
|
<DataGridTextColumn Header="{x:Static p:Resources.textPortReceptionFacilityProviderName}" Binding="{Binding PortReceptionFacilityProviderName}" IsReadOnly="True" Width="Auto" />
|
||||||
<DataGridTextColumn Header="{x:Static p:Resources.textTreatmentFacilityProviderName}" Binding="{Binding TreatmentFacilityProviderDisplay}" IsReadOnly="True" Width="Auto" />
|
<DataGridTextColumn Header="{x:Static p:Resources.textTreatmentFacilityProviderName}" Binding="{Binding TreatmentFacilityProviderText}" IsReadOnly="True" Width="Auto" />
|
||||||
<DataGridTextColumn Header="{x:Static p:Resources.textWasteDeliveryDateFrom}" Binding="{Binding WasteDeliveryDateFrom}" IsReadOnly="True" Width="Auto" />
|
<DataGridTextColumn Header="{x:Static p:Resources.textWasteDeliveryDateFrom}" Binding="{Binding WasteDeliveryDateFrom}" IsReadOnly="True" Width="Auto" />
|
||||||
<DataGridTextColumn Header="{x:Static p:Resources.textWasteDeliveryDateTo}" Binding="{Binding WasteDeliveryDateTo}" IsReadOnly="True" Width="Auto" />
|
<DataGridTextColumn Header="{x:Static p:Resources.textWasteDeliveryDateTo}" Binding="{Binding WasteDeliveryDateTo}" IsReadOnly="True" Width="Auto" />
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
|
|||||||
@ -162,7 +162,7 @@ namespace ENI2.DetailViewControls
|
|||||||
epd.CopyValuesToEntity();
|
epd.CopyValuesToEntity();
|
||||||
if (!this._wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
|
if (!this._wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
|
||||||
this._wasRcptMessage.Elements.Add(epd.WAS_RCPT);
|
this._wasRcptMessage.Elements.Add(epd.WAS_RCPT);
|
||||||
this.dataGridWaste.Items.Refresh();
|
this.dataGridWasteReceipt.Items.Refresh();
|
||||||
epd.WAS_RCPT = new WAS_RCPT();
|
epd.WAS_RCPT = new WAS_RCPT();
|
||||||
epd.WAS_RCPT.MessageHeader = _wasRcptMessage;
|
epd.WAS_RCPT.MessageHeader = _wasRcptMessage;
|
||||||
epd.WAS_RCPT.Identifier = WAS_RCPT.GetNewIdentifier(_wasRcptMessage.Elements);
|
epd.WAS_RCPT.Identifier = WAS_RCPT.GetNewIdentifier(_wasRcptMessage.Elements);
|
||||||
@ -173,24 +173,53 @@ namespace ENI2.DetailViewControls
|
|||||||
{
|
{
|
||||||
if (!this._wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
|
if (!this._wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
|
||||||
_wasRcptMessage.Elements.Add(epd.WAS_RCPT);
|
_wasRcptMessage.Elements.Add(epd.WAS_RCPT);
|
||||||
this.dataGridWaste.Items.Refresh();
|
this.dataGridWasteReceipt.Items.Refresh();
|
||||||
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
|
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataGridWasteReceipt_DeleteRequested(DatabaseEntity obj)
|
private void DataGridWasteReceipt_DeleteRequested(DatabaseEntity obj)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (obj is WAS_RCPT wasRCPT)
|
||||||
|
{
|
||||||
|
// are you sure dialog is in base class
|
||||||
|
_wasRcptMessage.Elements.Remove(wasRCPT);
|
||||||
|
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(wasRCPT);
|
||||||
|
DatabaseEntity.ResetIdentifiers(new List<DatabaseEntity>(_wasRcptMessage.Elements));
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
|
||||||
|
this.dataGridWasteReceipt.Items.Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataGridWasteReceipt_EditRequested(DatabaseEntity obj)
|
private void DataGridWasteReceipt_EditRequested(DatabaseEntity obj)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
EditWasteReceiptDialog epd = new EditWasteReceiptDialog();
|
||||||
|
epd.WAS_RCPT = obj as WAS_RCPT;
|
||||||
|
|
||||||
|
epd.AddClicked += () =>
|
||||||
|
{
|
||||||
|
epd.CopyValuesToEntity();
|
||||||
|
if (!_wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
|
||||||
|
_wasRcptMessage.Elements.Add(epd.WAS_RCPT);
|
||||||
|
this.dataGridWasteReceipt.Items.Refresh();
|
||||||
|
epd.WAS_RCPT = new WAS_RCPT();
|
||||||
|
epd.WAS_RCPT.Identifier = WAS_RCPT.GetNewIdentifier(_wasRcptMessage.Elements);
|
||||||
|
epd.WAS_RCPT.MessageHeader = _wasRcptMessage;
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (epd.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
if (!_wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
|
||||||
|
_wasRcptMessage.Elements.Add(epd.WAS_RCPT);
|
||||||
|
this.dataGridWasteReceipt.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataGridWasteReceipt_AddingNewItem(object sender, AddingNewItemEventArgs e)
|
private void DataGridWasteReceipt_AddingNewItem(object sender, AddingNewItemEventArgs e)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
this.DataGridWasteReceipt_CreateRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -22,19 +22,22 @@
|
|||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="1*" />
|
<ColumnDefinition Width="1*" />
|
||||||
<ColumnDefinition Width="2*" />
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="20" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Label Name="labelIdentificationNumber" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textIdentificationNumber}" />
|
<Label Name="labelIdentificationNumber" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textIdentificationNumber}" />
|
||||||
<Label Name="labelPortReceptionFacilityName" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textPortReceptionFacilityName}" />
|
<Label Name="labelPortReceptionFacilityName" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textPortReceptionFacilityName}" />
|
||||||
<Label Name="labelPortReceptionFacilityProviderName" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textPortReceptionFacilityProviderName}" />
|
<Label Name="labelPortReceptionFacilityProviderName" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textPortReceptionFacilityProviderName}" />
|
||||||
<Label Name="labelTreatmentFacilityProvider" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textTreatmentFacilityProviderName}" />
|
<Label Name="labelTreatmentFacilityProvider" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textTreatmentFacilityProviderDisplay}" />
|
||||||
<Label Name="labelWasteDeliveryDateFrom" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textWasteDeliveryDateFrom}" />
|
<Label Name="labelWasteDeliveryDateFrom" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textWasteDeliveryDateFrom}" />
|
||||||
<Label Name="labelWasteDeliveryDateTo" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textWasteDeliveryDateTo}" />
|
<Label Name="labelWasteDeliveryDateTo" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textWasteDeliveryDateTo}" />
|
||||||
|
|
||||||
<TextBox Name="textIdentificationNumber" Grid.Row="0" Grid.Column="1" Width="auto" MaxLength="20" TextWrapping="Wrap" />
|
<TextBox Name="textIdentificationNumber" Grid.Row="0" Grid.Column="1" Width="auto" MaxLength="20" TextWrapping="Wrap" />
|
||||||
<TextBox Name="textBoxPortReceptionFacilityName" Grid.Row="1" Grid.Column="1" Width="auto" MaxLength="70" TextWrapping="Wrap" />
|
<TextBox Name="textBoxPortReceptionFacilityName" Grid.Row="1" Grid.Column="1" Width="auto" MaxLength="70" TextWrapping="Wrap" />
|
||||||
|
<TextBox Name="textBoxPortReceptionFacilityProviderName" Grid.Row="2" Grid.Column="1" Width="auto" MaxLength="70" TextWrapping="Wrap" />
|
||||||
|
<TextBox Name="textBoxTreatmentFacilityProvider" Grid.Row="3" Grid.Column="1" Height="56" VerticalAlignment="Top" />
|
||||||
|
<xctk:DateTimePicker Grid.Row="4" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateFrom" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
|
||||||
|
<xctk:DateTimePicker Grid.Row="5" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateTo" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</enictrl:EditWindowBase>
|
</enictrl:EditWindowBase>
|
||||||
|
|||||||
@ -26,22 +26,12 @@ namespace ENI2.EditControls
|
|||||||
|
|
||||||
private void EditWasteReceiptDialog_Loaded(object sender, RoutedEventArgs e)
|
private void EditWasteReceiptDialog_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
/*
|
this.textIdentificationNumber.Text = this.WAS_RCPT.IdentificationNumber;
|
||||||
Dictionary<int, string> codeDict = new Dictionary<int, string>();
|
this.textBoxPortReceptionFacilityName.Text = this.WAS_RCPT.PortReceptionFacilityName;
|
||||||
for (int i = 0; i < WAS.RequiredCodes.Length; i++)
|
this.textBoxPortReceptionFacilityProviderName.Text = this.WAS_RCPT.PortReceptionFacilityProviderName;
|
||||||
{
|
this.textBoxTreatmentFacilityProvider.Text = this.WAS_RCPT.TreatmentFacilityProviderText;
|
||||||
codeDict[WAS.RequiredCodes[i]] = string.Format("{0} - {1}", WAS.RequiredCodes[i], WAS.RequiredTypes[i]);
|
this.dateTimePickerWasteDeliveryDateFrom.Value = this.WAS_RCPT.WasteDeliveryDateFrom?.ToLocalTime();
|
||||||
}
|
this.dateTimePickerWasteDeliveryDateTo.Value = this.WAS_RCPT.WasteDeliveryDateTo?.ToLocalTime();
|
||||||
this.comboBoxWasteCode.ItemsSource = codeDict;
|
|
||||||
this.comboBoxWasteCode.SelectedValue = this.Waste.WasteType;
|
|
||||||
this.textBoxDescription.Text = this.Waste.WasteDescription;
|
|
||||||
this.doubleUpDownAmountWasteDischargedLastPort.Value = this.Waste.WasteDisposedAtLastPort_MTQ;
|
|
||||||
this.doubleUpDownAmountDisposed.Value = this.Waste.WasteDisposalAmount_MTQ;
|
|
||||||
this.doubleUpDownAmountGeneratedTilNextPort.Value = this.Waste.WasteAmountGeneratedTillNextPort_MTQ;
|
|
||||||
this.doubleUpDownAmountRetained.Value = this.Waste.WasteAmountRetained_MTQ;
|
|
||||||
this.doubleUpDownMaxCapacity.Value = this.Waste.WasteCapacity_MTQ;
|
|
||||||
this.locodePortOfDeliveryRemainingWaste.LocodeValue = this.Waste.WasteDisposalPort;
|
|
||||||
*/
|
|
||||||
|
|
||||||
OKClicked += EditWasteReceiptDialog_OKClicked;
|
OKClicked += EditWasteReceiptDialog_OKClicked;
|
||||||
this.AddVisible = true;
|
this.AddVisible = true;
|
||||||
@ -49,19 +39,12 @@ namespace ENI2.EditControls
|
|||||||
public void CopyValuesToEntity()
|
public void CopyValuesToEntity()
|
||||||
{
|
{
|
||||||
// copy back
|
// copy back
|
||||||
/*
|
this.WAS_RCPT.IdentificationNumber = this.textIdentificationNumber.Text?.Trim();
|
||||||
if (this.comboBoxWasteCode.SelectedValue != null)
|
this.WAS_RCPT.PortReceptionFacilityName = this.textBoxPortReceptionFacilityName.Text?.Trim();
|
||||||
this.Waste.WasteType = (int)this.comboBoxWasteCode.SelectedValue;
|
this.WAS_RCPT.PortReceptionFacilityProviderName = this.textBoxPortReceptionFacilityProviderName.Text?.Trim();
|
||||||
else
|
this.WAS_RCPT.TreatmentFacilityProviderText = this.textBoxTreatmentFacilityProvider.Text?.Trim();
|
||||||
this.Waste.WasteType = null;
|
this.WAS_RCPT.WasteDeliveryDateFrom = this.dateTimePickerWasteDeliveryDateFrom.Value?.ToUniversalTime();
|
||||||
this.Waste.WasteDescription = this.textBoxDescription.Text?.Trim();
|
this.WAS_RCPT.WasteDeliveryDateTo = this.dateTimePickerWasteDeliveryDateTo.Value?.ToUniversalTime();
|
||||||
this.Waste.WasteDisposedAtLastPort_MTQ = this.doubleUpDownAmountWasteDischargedLastPort.Value;
|
|
||||||
this.Waste.WasteDisposalAmount_MTQ = this.doubleUpDownAmountDisposed.Value;
|
|
||||||
this.Waste.WasteAmountGeneratedTillNextPort_MTQ = this.doubleUpDownAmountGeneratedTilNextPort.Value;
|
|
||||||
this.Waste.WasteAmountRetained_MTQ = this.doubleUpDownAmountRetained.Value;
|
|
||||||
this.Waste.WasteCapacity_MTQ = this.doubleUpDownMaxCapacity.Value;
|
|
||||||
this.Waste.WasteDisposalPort = this.locodePortOfDeliveryRemainingWaste.LocodeValue;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EditWasteReceiptDialog_OKClicked()
|
private void EditWasteReceiptDialog_OKClicked()
|
||||||
|
|||||||
9
ENI2/Properties/Resources.Designer.cs
generated
9
ENI2/Properties/Resources.Designer.cs
generated
@ -4666,6 +4666,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Treatment facility provider (comma separated).
|
||||||
|
/// </summary>
|
||||||
|
public static string textTreatmentFacilityProviderDisplay {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textTreatmentFacilityProviderDisplay", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Treatment facility provider name.
|
/// Looks up a localized string similar to Treatment facility provider name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -1783,4 +1783,7 @@
|
|||||||
<data name="textWasteReceipt" xml:space="preserve">
|
<data name="textWasteReceipt" xml:space="preserve">
|
||||||
<value>Waste receipt</value>
|
<value>Waste receipt</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textTreatmentFacilityProviderDisplay" xml:space="preserve">
|
||||||
|
<value>Treatment facility provider (comma separated)</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@ -878,7 +878,8 @@ namespace bsmd.database
|
|||||||
{ typeof(TOWA), typeof(TOWA).Name },
|
{ typeof(TOWA), typeof(TOWA).Name },
|
||||||
{ typeof(TOWD), typeof(TOWD).Name },
|
{ typeof(TOWD), typeof(TOWD).Name },
|
||||||
{ typeof(WAS), typeof(WAS).Name },
|
{ typeof(WAS), typeof(WAS).Name },
|
||||||
{ typeof(BPOL), typeof(BPOL).Name }
|
{ typeof(BPOL), typeof(BPOL).Name },
|
||||||
|
{ typeof(WAS_RCPT), typeof(WAS_RCPT).Name }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -923,6 +924,7 @@ namespace bsmd.database
|
|||||||
case Message.NotificationClass.STO: result = new STO(); break;
|
case Message.NotificationClass.STO: result = new STO(); break;
|
||||||
case Message.NotificationClass.CREWD: result = new CREWD(); break;
|
case Message.NotificationClass.CREWD: result = new CREWD(); break;
|
||||||
case Message.NotificationClass.PASD: result = new PASD(); break;
|
case Message.NotificationClass.PASD: result = new PASD(); break;
|
||||||
|
case Message.NotificationClass.WAS_RCPT: result = new WAS_RCPT(); break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break; // VISIT, TRANSIT
|
break; // VISIT, TRANSIT
|
||||||
@ -1167,6 +1169,36 @@ namespace bsmd.database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region WAS_RCPT
|
||||||
|
|
||||||
|
if (databaseEntity.GetType().IsAssignableFrom(typeof(WAS_RCPT)))
|
||||||
|
{
|
||||||
|
WAS_RCPT was_rcpt = databaseEntity as WAS_RCPT;
|
||||||
|
|
||||||
|
TreatmentFacilityProvider tfp = new TreatmentFacilityProvider();
|
||||||
|
tfp.PrepareLoadCommand(cmd, Message.LoadFilter.WASRCPT_ID, was_rcpt.Id);
|
||||||
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
|
List<DatabaseEntity> tfps = tfp.LoadList(reader);
|
||||||
|
foreach (TreatmentFacilityProvider aTfp in tfps)
|
||||||
|
{
|
||||||
|
was_rcpt.TreatmentFacilityProvider.Add(aTfp);
|
||||||
|
aTfp.WAS_RCPT = was_rcpt;
|
||||||
|
this.LoadDependingLists(aTfp);
|
||||||
|
}
|
||||||
|
|
||||||
|
WasteReceived wasteReceived = new WasteReceived();
|
||||||
|
wasteReceived.PrepareLoadCommand(cmd, Message.LoadFilter.WASRCPT_ID, was_rcpt.Id);
|
||||||
|
SqlDataReader reader2 = this.PerformCommand(cmd);
|
||||||
|
List<DatabaseEntity> wrs = wasteReceived.LoadList(reader2);
|
||||||
|
foreach (WasteReceived awrs in wrs)
|
||||||
|
{
|
||||||
|
was_rcpt.WasteReceived.Add(awrs);
|
||||||
|
awrs.WAS_RCPT = was_rcpt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region NOA_NOD
|
#region NOA_NOD
|
||||||
|
|
||||||
if (databaseEntity.GetType().IsAssignableFrom(typeof(NOA_NOD)))
|
if (databaseEntity.GetType().IsAssignableFrom(typeof(NOA_NOD)))
|
||||||
|
|||||||
@ -50,7 +50,7 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
this.CreateId();
|
this.CreateId();
|
||||||
scmd.Parameters.AddWithValue("@ID", this.Id);
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||||
scmd.CommandText = string.Format("INSERT INTO {0} (Id, WASId, TreatmentFacilityProviderName, Identifier) " +
|
scmd.CommandText = string.Format("INSERT INTO {0} (Id, WAS_RCPTId, TreatmentFacilityProviderName, Identifier) " +
|
||||||
"VALUES ( @ID, @P1, @P2, @P3 )", this.Tablename);
|
"VALUES ( @ID, @P1, @P2, @P3 )", this.Tablename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -13,8 +13,8 @@ using System.Data;
|
|||||||
namespace bsmd.database
|
namespace bsmd.database
|
||||||
{
|
{
|
||||||
|
|
||||||
[TypeConverter(typeof(MessageClassConverter<WAS>))]
|
[TypeConverter(typeof(MessageClassConverter<WAS_RCPT>))]
|
||||||
[JsonConverter(typeof(NoTypeConverterJsonConverter<WAS>))]
|
[JsonConverter(typeof(NoTypeConverterJsonConverter<WAS_RCPT>))]
|
||||||
public class WAS_RCPT : DatabaseEntity, ISublistContainer, ISublistElement
|
public class WAS_RCPT : DatabaseEntity, ISublistContainer, ISublistElement
|
||||||
{
|
{
|
||||||
public WAS_RCPT()
|
public WAS_RCPT()
|
||||||
@ -44,6 +44,73 @@ namespace bsmd.database
|
|||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public ObservableCollection<TreatmentFacilityProvider> TreatmentFacilityProvider { get; private set; } = new ObservableCollection<TreatmentFacilityProvider>();
|
public ObservableCollection<TreatmentFacilityProvider> TreatmentFacilityProvider { get; private set; } = new ObservableCollection<TreatmentFacilityProvider>();
|
||||||
|
|
||||||
|
[ENI2Validation]
|
||||||
|
public string TreatmentFacilityProviderText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < this.TreatmentFacilityProvider.Count; i++)
|
||||||
|
{
|
||||||
|
if (i > 0)
|
||||||
|
sb.Append(", ");
|
||||||
|
sb.Append(((TreatmentFacilityProvider)this.TreatmentFacilityProvider[i]).TreatmentFacilityProviderName);
|
||||||
|
}
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
foreach (TreatmentFacilityProvider wdsp in this.TreatmentFacilityProvider)
|
||||||
|
DBManager.Instance.Delete(wdsp);
|
||||||
|
this.TreatmentFacilityProvider.Clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string[] tProviders = value.Split(',');
|
||||||
|
List<TreatmentFacilityProvider> foundList = new List<TreatmentFacilityProvider>();
|
||||||
|
|
||||||
|
for (int i = 0; i < tProviders.Length; i++)
|
||||||
|
{
|
||||||
|
string tProvider = tProviders[i].Trim();
|
||||||
|
if (tProvider.Length > 0)
|
||||||
|
{
|
||||||
|
TreatmentFacilityProvider matchingProvider = null;
|
||||||
|
foreach (TreatmentFacilityProvider wdsp in this.TreatmentFacilityProvider)
|
||||||
|
{
|
||||||
|
if (wdsp.TreatmentFacilityProviderName.Equals(tProvider, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
matchingProvider = wdsp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (matchingProvider != null)
|
||||||
|
{
|
||||||
|
foundList.Add(matchingProvider);
|
||||||
|
this.TreatmentFacilityProvider.Remove(matchingProvider);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TreatmentFacilityProvider newProvider = new TreatmentFacilityProvider();
|
||||||
|
newProvider.WAS_RCPT = this;
|
||||||
|
newProvider.TreatmentFacilityProviderName = tProvider;
|
||||||
|
foundList.Add(newProvider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove remaining provider (no longer valid)
|
||||||
|
foreach (TreatmentFacilityProvider remainingProvider in this.TreatmentFacilityProvider)
|
||||||
|
DBManager.Instance.Delete(remainingProvider);
|
||||||
|
this.TreatmentFacilityProvider.Clear();
|
||||||
|
// add existing and new provider
|
||||||
|
foreach (TreatmentFacilityProvider sjl in foundList)
|
||||||
|
this.TreatmentFacilityProvider.Add(sjl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ISublistContainer implementation
|
#region ISublistContainer implementation
|
||||||
|
|||||||
@ -16,6 +16,11 @@ namespace bsmd.database
|
|||||||
public class WasteReceived : DatabaseEntity, ISublistElement
|
public class WasteReceived : DatabaseEntity, ISublistElement
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public WasteReceived()
|
||||||
|
{
|
||||||
|
this.tablename = "[dbo].[WasteReceived]";
|
||||||
|
}
|
||||||
|
|
||||||
#region ISublistElement implementation
|
#region ISublistElement implementation
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
|||||||
@ -55,8 +55,7 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
if (message.Elements.Count > 0)
|
if (message.Elements.Count > 0)
|
||||||
{
|
{
|
||||||
HAZ haz = message.Elements[0] as HAZ;
|
if (message.Elements[0] is HAZ haz)
|
||||||
if (haz != null)
|
|
||||||
{
|
{
|
||||||
if (!haz.HasPositions) // 15.11.17: "Im Grunde müsste nicht das Feld NoDPG der Auslöser für Suspend sein, sondern wenn keine Position in einer der Tabellen enthalten ist."
|
if (!haz.HasPositions) // 15.11.17: "Im Grunde müsste nicht das Feld NoDPG der Auslöser für Suspend sein, sondern wenn keine Position in einer der Tabellen enthalten ist."
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user