71 lines
3.0 KiB
C#
71 lines
3.0 KiB
C#
// Copyright (c) 2017 schick Informatik
|
|
// Description: Waste Bearbeitungsdialog
|
|
//
|
|
|
|
using System.Windows;
|
|
using System.Collections.Generic;
|
|
|
|
using bsmd.database;
|
|
using ENI2.Controls;
|
|
using ENI2.Util;
|
|
|
|
namespace ENI2.EditControls
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for EditWasteDialog.xaml
|
|
/// </summary>
|
|
public partial class EditWasteDialog : EditWindowBase
|
|
{
|
|
public EditWasteDialog()
|
|
{
|
|
InitializeComponent();
|
|
Loaded += EditWasteDialog_Loaded;
|
|
AddClicked += () => { this.comboBoxWasteCode.Focus(); };
|
|
}
|
|
|
|
public Waste Waste { get; set; }
|
|
|
|
private void EditWasteDialog_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
Dictionary<int, string> codeDict = new Dictionary<int, string>();
|
|
for (int i = 0; i < WAS.RequiredCodes.Length; i++)
|
|
{
|
|
codeDict[WAS.RequiredCodes[i]] = string.Format("{0} - {1}", WAS.RequiredCodes[i], WAS.RequiredTypes[i]);
|
|
}
|
|
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 += EditWasteDialog_OKClicked;
|
|
this.AddVisible = true;
|
|
}
|
|
public void CopyValuesToEntity()
|
|
{
|
|
// copy back
|
|
if (this.comboBoxWasteCode.SelectedValue != null)
|
|
this.Waste.WasteType = (int)this.comboBoxWasteCode.SelectedValue;
|
|
else
|
|
this.Waste.WasteType = null;
|
|
this.Waste.WasteDescription = this.textBoxDescription.Text?.Trim();
|
|
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 EditWasteDialog_OKClicked()
|
|
{
|
|
this.CopyValuesToEntity();
|
|
}
|
|
}
|
|
|
|
}
|