git_bsmd/ENI2/EditControls/EditIGCDialog.xaml.cs

68 lines
2.3 KiB
C#

// Copyright (c) 2017 schick Informatik
// Description: IGC item Bearbeitungsdialog
//
using System.Windows;
using bsmd.database;
using ENI2.Controls;
using ENI2.Util;
namespace ENI2.EditControls
{
/// <summary>
/// Interaction logic for EditIGCDialog.xaml
/// </summary>
public partial class EditIGCDialog : EditWindowBase
{
public EditIGCDialog()
{
InitializeComponent();
Loaded += EditIGCDialog_Loaded;
AddClicked += () => { this.textBoxIdentifier.Focus(); };
}
public IGCPosition IGC { get; set; }
public string Identifier { get { return this.textBoxIdentifier.Text; } set { this.textBoxIdentifier.Text = value; } }
private void EditIGCDialog_Loaded(object sender, RoutedEventArgs e)
{
this.textBoxIdentifier.Text = this.IGC.Identifier;
this.textBoxIMOClass.Text = this.IGC.IMOClass;
this.textBoxProductName.Text = this.IGC.ProductName;
this.textBoxRemarks.Text = this.IGC.Remarks;
this.textBoxStowagePosition.Text = this.IGC.StowagePosition;
this.textBoxUNNumber.Text = this.IGC.UNNumber;
this.doubleUpDownQuantity.Value = this.IGC.Quantity_KGM;
this.locodePortOfDischarge.LocodeValue = this.IGC.PortOfDischarge;
this.locodePortOfLoading.LocodeValue = this.IGC.PortOfLoading;
this.OKClicked += EditIGCDialog_OKClicked;
this.AddVisible = true;
}
public void CopyValuesToEntity()
{
this.IGC.Identifier = this.textBoxIdentifier.Text.Trim();
this.IGC.IMOClass = this.textBoxIMOClass.Text.Trim();
this.IGC.ProductName = this.textBoxProductName.Text.Trim();
this.IGC.Remarks = this.textBoxRemarks.Text.Trim();
this.IGC.StowagePosition = this.textBoxStowagePosition.Text.Trim();
this.IGC.UNNumber = this.textBoxUNNumber.Text.Trim();
this.IGC.Quantity_KGM = this.doubleUpDownQuantity.Value;
this.IGC.PortOfLoading = this.locodePortOfLoading.LocodeValue;
this.IGC.PortOfDischarge = this.locodePortOfDischarge.LocodeValue;
}
private void EditIGCDialog_OKClicked()
{
this.CopyValuesToEntity();
}
}
}