92 lines
2.6 KiB
C#
92 lines
2.6 KiB
C#
// Copyright (c) 2017 schick Informatik
|
|
// Description: Edit SERV and SERV_template entities
|
|
//
|
|
|
|
using System.Windows;
|
|
|
|
using bsmd.database;
|
|
using ENI2.Controls;
|
|
|
|
namespace ENI2.EditControls
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for EditSERVDialog.xaml
|
|
/// </summary>
|
|
public partial class EditSERVDialog : EditWindowBase
|
|
{
|
|
|
|
#region Construction
|
|
|
|
public EditSERVDialog()
|
|
{
|
|
InitializeComponent();
|
|
Loaded += EditSERVDialog_Loaded;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
public SERV SERV { get; set; }
|
|
|
|
public SERV_Template SERV_Template { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region event handler
|
|
|
|
private void EditSERVDialog_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
this.OKClicked += EditSERVDialog_OKClicked;
|
|
|
|
// copy into fields
|
|
if (this.SERV != null)
|
|
{
|
|
this.textBoxServiceName.Text = this.SERV.ServiceName;
|
|
this.textBoxServiceBeneficiary.Text = this.SERV.ServiceBeneficiary;
|
|
this.textBoxServiceInvoiceRecipient.Text = this.SERV.ServiceInvoiceRecipient;
|
|
this.AddVisible = true;
|
|
}
|
|
|
|
if (this.SERV_Template != null)
|
|
{
|
|
this.textBoxServiceName.Text = this.SERV_Template.ServiceName;
|
|
this.textBoxServiceBeneficiary.Text = this.SERV_Template.ServiceBeneficiary;
|
|
this.textBoxServiceInvoiceRecipient.Text = this.SERV_Template.ServiceInvoiceRecipient;
|
|
}
|
|
}
|
|
private void EditSERVDialog_OKClicked()
|
|
{
|
|
this.CopyValuesToEntity();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region public methods
|
|
|
|
public void CopyValuesToEntity()
|
|
{
|
|
|
|
if (this.SERV != null)
|
|
{
|
|
// copy back
|
|
this.SERV.ServiceName = this.textBoxServiceName.Text.Trim();
|
|
this.SERV.ServiceBeneficiary = this.textBoxServiceBeneficiary.Text.Trim();
|
|
this.SERV.ServiceInvoiceRecipient = this.textBoxServiceInvoiceRecipient.Text.Trim();
|
|
}
|
|
|
|
if (this.SERV_Template != null)
|
|
{
|
|
// copy back
|
|
this.SERV_Template.ServiceName = this.textBoxServiceName.Text.Trim();
|
|
this.SERV_Template.ServiceBeneficiary = this.textBoxServiceBeneficiary.Text.Trim();
|
|
this.SERV_Template.ServiceInvoiceRecipient = this.textBoxServiceInvoiceRecipient.Text.Trim();
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|