Добавление страничек. Работает добавление сотрудников
This commit is contained in:
parent
e2c838da47
commit
8b68e2c7ec
102
EmployeeManagmentView/Employee/AddEmployeeWindow.xaml
Normal file
102
EmployeeManagmentView/Employee/AddEmployeeWindow.xaml
Normal file
@ -0,0 +1,102 @@
|
||||
<Window x:Class="EmployeeManagmentView.Employee.AddEmployeeWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Добавление сотрудника"
|
||||
Height="600" Width="600"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Background="#0D2D4F">
|
||||
|
||||
<Grid>
|
||||
<!-- Заголовок окна -->
|
||||
<TextBlock Text="Добавление сотрудника"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Top"
|
||||
FontSize="18" FontWeight="Bold"
|
||||
Foreground="#FFFFFF"
|
||||
Margin="0,20,0,0" />
|
||||
|
||||
<!-- Сетка для ввода данных в два столбца -->
|
||||
<Grid Margin="0,60">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Поле для имени работы -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||
<Label Content="Название должности" Foreground="White" HorizontalAlignment="Center"/>
|
||||
<TextBox x:Name="JobNameTextBox"
|
||||
Width="250" Height="40"
|
||||
Style="{StaticResource RoundedTextBoxStyle}"
|
||||
Margin="0,5"
|
||||
ToolTip="Введите название должности" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Поле для даты начала работы -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||
<Label Content="Дата начала работы" Foreground="White" HorizontalAlignment="Center"/>
|
||||
<DatePicker x:Name="StartDatePicker"
|
||||
Width="250" Height="40"
|
||||
Margin="0,5"
|
||||
ToolTip="Выберите дату начала работы" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Поле для даты окончания работы -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||
<Label Content="Дата окончания работы" Foreground="White" HorizontalAlignment="Center"/>
|
||||
<DatePicker x:Name="EndDatePicker"
|
||||
Width="250" Height="40"
|
||||
Margin="0,5"
|
||||
ToolTip="Выберите дату окончания работы (если есть)" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Поле для ставки -->
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||
<Label Content="Ставка" Foreground="White" HorizontalAlignment="Center"/>
|
||||
<TextBox x:Name="BidTextBox"
|
||||
Width="250" Height="40"
|
||||
Style="{StaticResource RoundedTextBoxStyle}"
|
||||
Margin="0,5"
|
||||
ToolTip="Введите почасовую ставку" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Поле для физического лица -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||
<Label Content="Физическое лицо" Foreground="White" HorizontalAlignment="Center"/>
|
||||
<ComboBox x:Name="PhysicalPersonComboBox"
|
||||
Width="250" Height="40"
|
||||
Margin="0,5"
|
||||
ToolTip="Выберите физическое лицо"
|
||||
Background="White" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Поле для совместительства -->
|
||||
<StackPanel Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||
<Label Content="Совместительство" Foreground="White" HorizontalAlignment="Center"/>
|
||||
<TextBox x:Name="PartTimeJobTextBox"
|
||||
Width="250" Height="40"
|
||||
Style="{StaticResource RoundedTextBoxStyle}"
|
||||
Margin="0,5"
|
||||
ToolTip="Введите почасовую ставку" HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<!-- Кнопка для добавления сотрудника -->
|
||||
<Button Grid.Row="3" Grid.ColumnSpan="2" Content="Добавить сотрудника"
|
||||
Width="250" Height="40"
|
||||
Margin="0,10"
|
||||
Style="{StaticResource RoundedButtonStyle}"
|
||||
Click="SaveButton_Click"
|
||||
Background="#004890" Foreground="#FFFFFF" HorizontalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
74
EmployeeManagmentView/Employee/AddEmployeeWindow.xaml.cs
Normal file
74
EmployeeManagmentView/Employee/AddEmployeeWindow.xaml.cs
Normal file
@ -0,0 +1,74 @@
|
||||
using EmployeeManagmentBusinessLogic.BusinessLogic;
|
||||
using EmployeeManagmentContracts.BusinessLogicContracts;
|
||||
using EmployeeManagmentContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace EmployeeManagmentView.Employee
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для AddEmployeeWindow.xaml
|
||||
/// </summary>
|
||||
public partial class AddEmployeeWindow : Window
|
||||
{
|
||||
|
||||
private readonly IEmployeeLogic _employeeLogic;
|
||||
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
||||
|
||||
public AddEmployeeWindow(IEmployeeLogic employeeLogic, IPhisicalPersonLogic phisicalPersonLogic)
|
||||
{
|
||||
_employeeLogic = employeeLogic;
|
||||
_phisicalPersonLogic = phisicalPersonLogic;
|
||||
InitializeComponent();
|
||||
LoadPhysicalPersons();
|
||||
}
|
||||
|
||||
private void LoadPhysicalPersons()
|
||||
{
|
||||
if (PhysicalPersonComboBox == null)
|
||||
{
|
||||
throw new InvalidOperationException("PhysicalPersonComboBox не инициализирован.");
|
||||
}
|
||||
|
||||
var persons = _phisicalPersonLogic.GetFullList();
|
||||
PhysicalPersonComboBox.ItemsSource = persons;
|
||||
PhysicalPersonComboBox.DisplayMemberPath = "Name";
|
||||
PhysicalPersonComboBox.SelectedValuePath = "Id";
|
||||
}
|
||||
|
||||
private void SaveButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = new EmployeeViewModel
|
||||
{
|
||||
NameJob = JobNameTextBox.Text,
|
||||
StartJob = StartDatePicker.SelectedDate.Value.ToUniversalTime(),
|
||||
EndJob = EndDatePicker.SelectedDate.Value.ToUniversalTime(),
|
||||
Bid = float.Parse(BidTextBox.Text),
|
||||
PartTimeJob = PartTimeJobTextBox.Text,
|
||||
PhysicalPersonsId = (int?)PhysicalPersonComboBox.SelectedValue
|
||||
};
|
||||
|
||||
_employeeLogic.Insert(model);
|
||||
MessageBox.Show("Данные сотрудника успешно сохранены!");
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Ошибка: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
12
EmployeeManagmentView/Employee/DeleteEmployeeWindow.xaml
Normal file
12
EmployeeManagmentView/Employee/DeleteEmployeeWindow.xaml
Normal file
@ -0,0 +1,12 @@
|
||||
<Window x:Class="EmployeeManagmentView.Employee.DeleteEmployeeWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:EmployeeManagmentView.Employee"
|
||||
mc:Ignorable="d"
|
||||
Title="DeleteEmployeeWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
32
EmployeeManagmentView/Employee/DeleteEmployeeWindow.xaml.cs
Normal file
32
EmployeeManagmentView/Employee/DeleteEmployeeWindow.xaml.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using EmployeeManagmentContracts.BusinessLogicContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace EmployeeManagmentView.Employee
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для DeleteEmployeeWindow.xaml
|
||||
/// </summary>
|
||||
public partial class DeleteEmployeeWindow : Window
|
||||
{
|
||||
|
||||
private readonly IEmployeeLogic _employeeLogic;
|
||||
|
||||
public DeleteEmployeeWindow(IEmployeeLogic employeeLogic)
|
||||
{
|
||||
_employeeLogic = employeeLogic;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
12
EmployeeManagmentView/Employee/EditEmployeeWindow.xaml
Normal file
12
EmployeeManagmentView/Employee/EditEmployeeWindow.xaml
Normal file
@ -0,0 +1,12 @@
|
||||
<Window x:Class="EmployeeManagmentView.Employee.EditEmployeeWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:EmployeeManagmentView.Employee"
|
||||
mc:Ignorable="d"
|
||||
Title="EditEmployeeWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
32
EmployeeManagmentView/Employee/EditEmployeeWindow.xaml.cs
Normal file
32
EmployeeManagmentView/Employee/EditEmployeeWindow.xaml.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using EmployeeManagmentContracts.BusinessLogicContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace EmployeeManagmentView.Employee
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для EditEmployeeWindow.xaml
|
||||
/// </summary>
|
||||
public partial class EditEmployeeWindow : Window
|
||||
{
|
||||
|
||||
private readonly IEmployeeLogic _employeeLogic;
|
||||
|
||||
public EditEmployeeWindow(IEmployeeLogic employeeLogic)
|
||||
{
|
||||
_employeeLogic = employeeLogic;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
51
EmployeeManagmentView/Employee/EmployeeManagementWindow.xaml
Normal file
51
EmployeeManagmentView/Employee/EmployeeManagementWindow.xaml
Normal file
@ -0,0 +1,51 @@
|
||||
<Window x:Class="EmployeeManagmentView.Employee.EmployeeManagementWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Управление физическими лицами"
|
||||
Height="400" Width="400"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Background="#0D2D4F">
|
||||
<Grid>
|
||||
<!-- Заголовок окна -->
|
||||
<TextBlock Text="Управление сотрудниками"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Top"
|
||||
FontSize="18" FontWeight="Bold"
|
||||
Foreground="#FFFFFF"
|
||||
Margin="0,20,0,0" />
|
||||
|
||||
<!-- Стек кнопок -->
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<!-- Кнопка "Удаление сотрудника" -->
|
||||
<Button Content="Удаление сотрудника"
|
||||
Width="250" Height="40"
|
||||
Margin="0,0,0,10"
|
||||
Background="#004890" Foreground="#FFFFFF"
|
||||
Style="{StaticResource RoundedButtonStyle}"
|
||||
Click ="OpenDeleteEmployeeWindow"/>
|
||||
|
||||
<!-- Кнопка "Добавление сотрудника" -->
|
||||
<Button Content="Добавление сотрудника"
|
||||
Width="250" Height="40"
|
||||
Margin="0,0,0,10"
|
||||
Style="{StaticResource RoundedButtonStyle}"
|
||||
Background="#004890" Foreground="#FFFFFF"
|
||||
Click="OpenAddEmployeeWindow"/>
|
||||
|
||||
<!-- Кнопка "Редактирование сотрудника" -->
|
||||
<Button Content="Редактирование сотрудника"
|
||||
Width="250" Height="40"
|
||||
Margin="0,0,0,10"
|
||||
Style="{StaticResource RoundedButtonStyle}"
|
||||
Background="#004890" Foreground="#FFFFFF"
|
||||
Click="OpenEditEmployeeWindow"/>
|
||||
|
||||
<!-- Кнопка "Просмотр сотрудника" -->
|
||||
<Button Content="Просмотр сотрудников"
|
||||
Width="250" Height="40"
|
||||
Style="{StaticResource RoundedButtonStyle}"
|
||||
Background="#004890" Foreground="#FFFFFF"
|
||||
Click="OpenViewEmployeesWindow"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
@ -0,0 +1,96 @@
|
||||
using EmployeeManagmentBusinessLogic.BusinessLogic;
|
||||
using EmployeeManagmentContracts.BusinessLogicContracts;
|
||||
using EmployeeManagmentView.PhysicalPerson;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace EmployeeManagmentView.Employee
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для EmployeeManagementWindow.xaml
|
||||
/// </summary>
|
||||
public partial class EmployeeManagementWindow : Window
|
||||
{
|
||||
|
||||
private readonly IEmployeeLogic _employeeLogic;
|
||||
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
||||
|
||||
public EmployeeManagementWindow(IEmployeeLogic employeeLogic, IPhisicalPersonLogic phisicalPersonLogic)
|
||||
{
|
||||
_employeeLogic = employeeLogic;
|
||||
_phisicalPersonLogic = phisicalPersonLogic;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OpenAddEmployeeWindow(object sender, RoutedEventArgs e)
|
||||
{
|
||||
foreach (Window window in Application.Current.Windows)
|
||||
{
|
||||
if (window is AddEmployeeWindow existingWindow)
|
||||
{
|
||||
existingWindow.Activate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var addWindow = new AddEmployeeWindow(_employeeLogic, _phisicalPersonLogic);
|
||||
addWindow.Show();
|
||||
}
|
||||
|
||||
private void OpenDeleteEmployeeWindow(object sender, RoutedEventArgs e)
|
||||
{
|
||||
foreach (Window window in Application.Current.Windows)
|
||||
{
|
||||
if (window is DeleteEmployeeWindow existingWindow)
|
||||
{
|
||||
existingWindow.Activate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var deleteWindow = new DeleteEmployeeWindow(_employeeLogic);
|
||||
deleteWindow.Show();
|
||||
}
|
||||
|
||||
private void OpenEditEmployeeWindow(object sender, RoutedEventArgs e)
|
||||
{
|
||||
foreach (Window window in Application.Current.Windows)
|
||||
{
|
||||
if (window is EditEmployeeWindow existingWindow)
|
||||
{
|
||||
existingWindow.Activate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var editWindow = new EditEmployeeWindow(_employeeLogic);
|
||||
editWindow.Show();
|
||||
}
|
||||
|
||||
private void OpenViewEmployeesWindow(object sender, RoutedEventArgs e)
|
||||
{
|
||||
foreach (Window window in Application.Current.Windows)
|
||||
{
|
||||
if (window is ViewEmployeeWindow existingWindow)
|
||||
{
|
||||
existingWindow.Activate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var viewWindow = new ViewEmployeeWindow(_employeeLogic);
|
||||
viewWindow.Show();
|
||||
}
|
||||
}
|
||||
}
|
12
EmployeeManagmentView/Employee/ViewEmployeeWindow.xaml
Normal file
12
EmployeeManagmentView/Employee/ViewEmployeeWindow.xaml
Normal file
@ -0,0 +1,12 @@
|
||||
<Window x:Class="EmployeeManagmentView.Employee.ViewEmployeeWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:EmployeeManagmentView.Employee"
|
||||
mc:Ignorable="d"
|
||||
Title="ViewEmployeeWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
32
EmployeeManagmentView/Employee/ViewEmployeeWindow.xaml.cs
Normal file
32
EmployeeManagmentView/Employee/ViewEmployeeWindow.xaml.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using EmployeeManagmentContracts.BusinessLogicContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace EmployeeManagmentView.Employee
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для ViewEmployeeWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ViewEmployeeWindow : Window
|
||||
{
|
||||
|
||||
private readonly IEmployeeLogic _employeeLogic;
|
||||
|
||||
public ViewEmployeeWindow(IEmployeeLogic employeeLogic)
|
||||
{
|
||||
_employeeLogic = employeeLogic;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@
|
||||
<!-- Кнопка 1 -->
|
||||
<Button Content="Работа с сотрудниками" Width="200" Height="50" Margin="0,10"
|
||||
Background="#004890" Foreground="#FFFFFF" FontSize="16"
|
||||
Style="{StaticResource RoundedButtonStyle}"/>
|
||||
Style="{StaticResource RoundedButtonStyle}" Click="OpenEmployeeManagementWindow"/>
|
||||
<!-- Кнопка 2 -->
|
||||
<Button Content="Работа с физ. лицами" Width="200" Height="50" Margin="0,10"
|
||||
Background="#004890" Foreground="#FFFFFF" FontSize="16"
|
||||
|
@ -1,6 +1,7 @@
|
||||
using EmployeeManagmentBusinessLogic.BusinessLogic;
|
||||
using EmployeeManagmentContracts.BusinessLogicContracts;
|
||||
using EmployeeManagmentContracts.ViewModels;
|
||||
using EmployeeManagmentView.Employee;
|
||||
using EmployeeManagmentView.PhysicalPerson;
|
||||
using System.Windows;
|
||||
|
||||
@ -39,5 +40,24 @@ namespace EmployeeManagmentView
|
||||
physicalPersonWindow.Show();
|
||||
}
|
||||
|
||||
private void OpenEmployeeManagementWindow(object sender, RoutedEventArgs e)
|
||||
{
|
||||
foreach (Window window in Application.Current.Windows)
|
||||
{
|
||||
if (window is EmployeeManagementWindow)
|
||||
{
|
||||
// Если окно уже открыто, активируем его и ставим на передний план
|
||||
window.Activate();
|
||||
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
window.Topmost = true; // Ставим окно на передний план
|
||||
window.Topmost = false; // Сразу снимаем флаг, чтобы окно не оставалось всегда наверху
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var employeeWindow = new EmployeeManagementWindow(_employeeLogic, _phisicalPersonLogic);
|
||||
employeeWindow.Show();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ namespace EmployeeManagmentView.PhysicalPerson
|
||||
public partial class AddPhysicalPersonWindow : Window
|
||||
{
|
||||
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
||||
private static AddPhysicalPersonWindow _instance;
|
||||
|
||||
public AddPhysicalPersonWindow(IPhisicalPersonLogic phisicalPersonLogic)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user