63 lines
2.1 KiB
C#
63 lines
2.1 KiB
C#
// Copyright (c) 2017- schick Informatik
|
|
// Description: Wasre received bearbeiten..
|
|
//
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Windows;
|
|
|
|
using bsmd.database;
|
|
using ENI2.Controls;
|
|
|
|
namespace ENI2.EditControls
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for EditWasteReceivedDialog.xaml
|
|
/// </summary>
|
|
public partial class EditWasteReceivedDialog : EditWindowBase
|
|
{
|
|
public EditWasteReceivedDialog()
|
|
{
|
|
InitializeComponent();
|
|
Loaded += EditWasteReceivedDialog_Loaded;
|
|
AddClicked += () => { this.comboBoxWasteCode.Focus(); };
|
|
}
|
|
|
|
public WasteReceived WasteReceived { get; set; }
|
|
|
|
public void CopyValuesToEntity()
|
|
{
|
|
// copy back
|
|
if (this.comboBoxWasteCode.SelectedValue != null)
|
|
this.WasteReceived.WasteCode = (string) this.comboBoxWasteCode.SelectedValue;
|
|
else
|
|
this.WasteReceived.WasteCode = null;
|
|
this.WasteReceived.WasteDescription = this.textBoxDescription.Text.Trim();
|
|
this.WasteReceived.AmountWasteReceived_MTQ = this.doubleUpDownAmountReceived.Value;
|
|
}
|
|
|
|
private void EditWasteReceivedDialog_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
|
|
Dictionary<string, string> codeDict = new Dictionary<string, string>();
|
|
for (int i = 0; i < WAS.WasteCodes.Length; i++)
|
|
{
|
|
codeDict[WAS.WasteCodes[i]] = string.Format("{0} - {1}", WAS.WasteCodes[i], WAS.WasteCodeDescriptions[i]);
|
|
}
|
|
this.comboBoxWasteCode.ItemsSource = codeDict;
|
|
this.comboBoxWasteCode.SelectedValue = this.WasteReceived.WasteCode;
|
|
this.textBoxDescription.Text = this.WasteReceived.WasteDescription;
|
|
this.doubleUpDownAmountReceived.Value = this.WasteReceived.AmountWasteReceived_MTQ;
|
|
|
|
OKClicked += EditWasteReceiptDialog_OKClicked;
|
|
this.AddVisible = true;
|
|
}
|
|
|
|
private void EditWasteReceiptDialog_OKClicked()
|
|
{
|
|
this.CopyValuesToEntity();
|
|
}
|
|
|
|
}
|
|
}
|