45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using EmployeeManagmentContracts.BusinessLogicContracts;
|
|
using EmployeeManagmentContracts.ViewModels;
|
|
using System.Windows;
|
|
|
|
namespace EmployeeManagmentView.PhysicalPerson
|
|
{
|
|
public partial class AddPhysicalPersonWindow : Window
|
|
{
|
|
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
|
private static AddPhysicalPersonWindow _instance;
|
|
|
|
public AddPhysicalPersonWindow(IPhisicalPersonLogic phisicalPersonLogic)
|
|
{
|
|
_phisicalPersonLogic = phisicalPersonLogic;
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void SaveButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
var model = new PhisicalPersonViewModel
|
|
{
|
|
Name = NameTextBox.Text,
|
|
Surname = SurnameTextBox.Text,
|
|
Patronymic = PatronomicTextBox.Text,
|
|
Birthday = BirthdayPicker.SelectedDate.Value.ToUniversalTime(),
|
|
Gender = GenderComboBox.Text,
|
|
Address = AddressTextBox.Text,
|
|
Telephone = TelephoneTextBox.Text
|
|
};
|
|
|
|
_phisicalPersonLogic.Insert(model);
|
|
|
|
MessageBox.Show("Данные успешно сохранены!");
|
|
this.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show($"Ошибка: {ex.Message}");
|
|
}
|
|
}
|
|
}
|
|
}
|