Подправил чуть-чуть дезигн. Наврное, надо уже другое релизовывать.
This commit is contained in:
parent
74f1fda7c7
commit
af01b18e80
14
EmployeeManagmentDataModels/Enums/GenderType.cs
Normal file
14
EmployeeManagmentDataModels/Enums/GenderType.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EmployeeManagmentDataModels.Enums
|
||||||
|
{
|
||||||
|
public enum GenderType
|
||||||
|
{
|
||||||
|
Мужчина,
|
||||||
|
Женщина
|
||||||
|
}
|
||||||
|
}
|
@ -24,7 +24,6 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
<!-- Анимация цвета при наведении -->
|
|
||||||
<Trigger Property="IsMouseOver" Value="True">
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
<Trigger.EnterActions>
|
<Trigger.EnterActions>
|
||||||
<BeginStoryboard>
|
<BeginStoryboard>
|
||||||
@ -46,7 +45,6 @@
|
|||||||
</Trigger.ExitActions>
|
</Trigger.ExitActions>
|
||||||
</Trigger>
|
</Trigger>
|
||||||
|
|
||||||
<!-- Плавная анимация сжатия и тени при нажатии -->
|
|
||||||
<Trigger Property="IsPressed" Value="True">
|
<Trigger Property="IsPressed" Value="True">
|
||||||
<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
|
<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
|
||||||
<Setter Property="RenderTransform" TargetName="ButtonBorder">
|
<Setter Property="RenderTransform" TargetName="ButtonBorder">
|
||||||
@ -64,10 +62,10 @@
|
|||||||
<Storyboard>
|
<Storyboard>
|
||||||
<DoubleAnimation Storyboard.TargetName="scaleTransform"
|
<DoubleAnimation Storyboard.TargetName="scaleTransform"
|
||||||
Storyboard.TargetProperty="ScaleX"
|
Storyboard.TargetProperty="ScaleX"
|
||||||
To="1.0" Duration="0:0:0.1" />
|
To="0.95" Duration="0:0:0.2" />
|
||||||
<DoubleAnimation Storyboard.TargetName="scaleTransform"
|
<DoubleAnimation Storyboard.TargetName="scaleTransform"
|
||||||
Storyboard.TargetProperty="ScaleY"
|
Storyboard.TargetProperty="ScaleY"
|
||||||
To="1.0" Duration="0:0:0.1" />
|
To="0.95" Duration="0:0:0.2" />
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</Trigger.EnterActions>
|
</Trigger.EnterActions>
|
||||||
@ -76,10 +74,10 @@
|
|||||||
<Storyboard>
|
<Storyboard>
|
||||||
<DoubleAnimation Storyboard.TargetName="scaleTransform"
|
<DoubleAnimation Storyboard.TargetName="scaleTransform"
|
||||||
Storyboard.TargetProperty="ScaleX"
|
Storyboard.TargetProperty="ScaleX"
|
||||||
To="0.95" Duration="0:0:0.2" />
|
To="1.0" Duration="0:0:0.2" />
|
||||||
<DoubleAnimation Storyboard.TargetName="scaleTransform"
|
<DoubleAnimation Storyboard.TargetName="scaleTransform"
|
||||||
Storyboard.TargetProperty="ScaleY"
|
Storyboard.TargetProperty="ScaleY"
|
||||||
To="0.95" Duration="0:0:0.2" />
|
To="1.0" Duration="0:0:0.2" />
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</Trigger.ExitActions>
|
</Trigger.ExitActions>
|
||||||
@ -90,8 +88,7 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<!-- Стиль для закругленного TextBox с подсветкой -->
|
||||||
<!-- Стиль для закругленного TextBox -->
|
|
||||||
<Style x:Key="RoundedTextBoxStyle" TargetType="TextBox">
|
<Style x:Key="RoundedTextBoxStyle" TargetType="TextBox">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
@ -105,27 +102,14 @@
|
|||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
|
||||||
|
|
||||||
<!-- Стиль для закругленного ComboBox -->
|
<Style.Triggers>
|
||||||
<Style x:Key="RoundedComboBoxStyle" TargetType="ComboBox">
|
<!-- Подсветка рамки при фокусе -->
|
||||||
<Setter Property="Template">
|
<Trigger Property="IsFocused" Value="True">
|
||||||
<Setter.Value>
|
<Setter Property="BorderBrush" Value="#004890"/>
|
||||||
<ControlTemplate TargetType="ComboBox">
|
<Setter Property="BorderThickness" Value="2"/>
|
||||||
<Border Background="White"
|
</Trigger>
|
||||||
CornerRadius="15"
|
</Style.Triggers>
|
||||||
BorderBrush="Gray"
|
|
||||||
BorderThickness="1">
|
|
||||||
<Grid>
|
|
||||||
<ToggleButton Grid.Column="2" Focusable="False"
|
|
||||||
ClickMode="Press" />
|
|
||||||
<ContentPresenter />
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
Title="Отдел кадров УлГТУ" Height="450" Width="800" Background="#0D2D4F"
|
Title="Отдел кадров УлГТУ" Height="450" Width="800" Background="#0D2D4F"
|
||||||
MinWidth="400" MinHeight="300"
|
MinWidth="400" MinHeight="300"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
MaxWidth="{Binding Source={x:Static SystemParameters.PrimaryScreenWidth}}"
|
MaxWidth="{Binding Source={x:Static SystemParameters.PrimaryScreenWidth}}"
|
||||||
MaxHeight="{Binding Source={x:Static SystemParameters.PrimaryScreenHeight}}">
|
MaxHeight="{Binding Source={x:Static SystemParameters.PrimaryScreenHeight}}">
|
||||||
|
|
||||||
|
@ -22,6 +22,18 @@ namespace EmployeeManagmentView
|
|||||||
|
|
||||||
private void OpenPhysicalPersonManagementWindow(object sender, RoutedEventArgs e)
|
private void OpenPhysicalPersonManagementWindow(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
foreach (Window window in Application.Current.Windows)
|
||||||
|
{
|
||||||
|
if (window is PhysicalPersonManagementWindow)
|
||||||
|
{
|
||||||
|
// Если окно уже открыто, активируем его и ставим на передний план
|
||||||
|
window.Activate();
|
||||||
|
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
window.Topmost = true; // Ставим окно на передний план
|
||||||
|
window.Topmost = false; // Сразу снимаем флаг, чтобы окно не оставалось всегда наверху
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var physicalPersonWindow = new PhysicalPersonManagementWindow(_phisicalPersonLogic);
|
var physicalPersonWindow = new PhysicalPersonManagementWindow(_phisicalPersonLogic);
|
||||||
physicalPersonWindow.Show();
|
physicalPersonWindow.Show();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
Title="Добавление физического лица"
|
Title="Добавление физического лица"
|
||||||
Height="600" Width="400"
|
Height="600" Width="600"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Background="#0D2D4F">
|
Background="#0D2D4F">
|
||||||
@ -15,62 +15,103 @@
|
|||||||
Foreground="#FFFFFF"
|
Foreground="#FFFFFF"
|
||||||
Margin="0,20,0,0" />
|
Margin="0,20,0,0" />
|
||||||
|
|
||||||
<!-- Стек элементов для ввода данных -->
|
<!-- Сетка для ввода данных в два столбца -->
|
||||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
<Grid Margin="0,60">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<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="NameTextBox"
|
<TextBox x:Name="NameTextBox"
|
||||||
Width="250" Height="40"
|
Width="250" Height="40"
|
||||||
Style="{StaticResource RoundedTextBoxStyle}"
|
Style="{StaticResource RoundedTextBoxStyle}"
|
||||||
Margin="0,10"
|
Margin="0,5"
|
||||||
ToolTip="Введите имя" />
|
ToolTip="Введите имя" HorizontalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Поле для фамилии -->
|
<!-- Поле для фамилии -->
|
||||||
|
<StackPanel Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||||
|
<Label Content="Фамилия" Foreground="White" HorizontalAlignment="Center"/>
|
||||||
<TextBox x:Name="SurnameTextBox"
|
<TextBox x:Name="SurnameTextBox"
|
||||||
Width="250" Height="40"
|
Width="250" Height="40"
|
||||||
Style="{StaticResource RoundedTextBoxStyle}"
|
Style="{StaticResource RoundedTextBoxStyle}"
|
||||||
Margin="0,10"
|
Margin="0,5"
|
||||||
ToolTip="Введите фамилию" />
|
ToolTip="Введите фамилию" HorizontalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Поле для отчества -->
|
<!-- Поле для отчества -->
|
||||||
|
<StackPanel Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||||
|
<Label Content="Отчество" Foreground="White" HorizontalAlignment="Center"/>
|
||||||
<TextBox x:Name="PatronomicTextBox"
|
<TextBox x:Name="PatronomicTextBox"
|
||||||
Width="250" Height="40"
|
Width="250" Height="40"
|
||||||
Style="{StaticResource RoundedTextBoxStyle}"
|
Style="{StaticResource RoundedTextBoxStyle}"
|
||||||
Margin="0,10"
|
Margin="0,5"
|
||||||
ToolTip="Введите отчество" />
|
ToolTip="Введите отчество" HorizontalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Поле для выбора даты рождения -->
|
<!-- Поле для выбора даты рождения -->
|
||||||
|
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||||
|
<Label Content="Дата рождения" Foreground="White" HorizontalAlignment="Center"/>
|
||||||
<DatePicker x:Name="BirthdayPicker"
|
<DatePicker x:Name="BirthdayPicker"
|
||||||
Width="250" Height="40"
|
Width="250" Height="40"
|
||||||
Margin="0,10"
|
Margin="0,5"
|
||||||
ToolTip="Выберите дату рождения" />
|
ToolTip="Выберите дату рождения" HorizontalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Поле для выбора пола -->
|
<!-- Поле для выбора пола -->
|
||||||
<TextBox x:Name="GenderTextBox"
|
<StackPanel Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||||
|
<Label Content="Пол" Foreground="White" HorizontalAlignment="Center"/>
|
||||||
|
<ComboBox x:Name="GenderComboBox"
|
||||||
Width="250" Height="40"
|
Width="250" Height="40"
|
||||||
Style="{StaticResource RoundedTextBoxStyle}"
|
Margin="0,5"
|
||||||
Margin="0,10"
|
ToolTip="Выберите пол"
|
||||||
ToolTip="Введите пол" />
|
Background="White" HorizontalAlignment="Center">
|
||||||
|
<ComboBoxItem Content="Мужчина"/>
|
||||||
|
<ComboBoxItem Content="Женщина"/>
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Поле для адреса -->
|
<!-- Поле для адреса -->
|
||||||
|
<StackPanel Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||||
|
<Label Content="Адрес" Foreground="White" HorizontalAlignment="Center"/>
|
||||||
<TextBox x:Name="AddressTextBox"
|
<TextBox x:Name="AddressTextBox"
|
||||||
Width="250" Height="40"
|
Width="250" Height="40"
|
||||||
Style="{StaticResource RoundedTextBoxStyle}"
|
Style="{StaticResource RoundedTextBoxStyle}"
|
||||||
Margin="0,10"
|
Margin="0,5"
|
||||||
ToolTip="Введите адрес" />
|
ToolTip="Введите адрес" HorizontalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Поле для телефона -->
|
<!-- Поле для телефона -->
|
||||||
|
<StackPanel Grid.Row="3" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10">
|
||||||
|
<Label Content="Телефон" Foreground="White" HorizontalAlignment="Center"/>
|
||||||
<TextBox x:Name="TelephoneTextBox"
|
<TextBox x:Name="TelephoneTextBox"
|
||||||
Width="250" Height="40"
|
Width="250" Height="40"
|
||||||
Style="{StaticResource RoundedTextBoxStyle}"
|
Style="{StaticResource RoundedTextBoxStyle}"
|
||||||
Margin="0,10"
|
Margin="0,5"
|
||||||
ToolTip="Введите номер телефона" />
|
ToolTip="Введите номер телефона" HorizontalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Кнопка для добавления физического лица -->
|
<!-- Кнопка для добавления физического лица -->
|
||||||
<Button Content="Добавить физическое лицо"
|
<Button Grid.Row="4" Grid.ColumnSpan="2" Content="Добавить физическое лицо"
|
||||||
Width="250" Height="40"
|
Width="250" Height="40"
|
||||||
Margin="0,10"
|
Margin="0,10"
|
||||||
Style="{StaticResource RoundedButtonStyle}"
|
Style="{StaticResource RoundedButtonStyle}"
|
||||||
Click="SaveButton_Click"/>
|
Click="SaveButton_Click"
|
||||||
</StackPanel>
|
Background="#004890" Foreground="#FFFFFF" HorizontalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -1,28 +1,13 @@
|
|||||||
using EmployeeManagmentBusinessLogic.BusinessLogic;
|
using EmployeeManagmentContracts.BusinessLogicContracts;
|
||||||
using EmployeeManagmentContracts.BusinessLogicContracts;
|
|
||||||
using EmployeeManagmentContracts.ViewModels;
|
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;
|
||||||
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.PhysicalPerson
|
namespace EmployeeManagmentView.PhysicalPerson
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Логика взаимодействия для AddPhysicalPersonWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class AddPhysicalPersonWindow : Window
|
public partial class AddPhysicalPersonWindow : Window
|
||||||
{
|
{
|
||||||
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
||||||
|
private static AddPhysicalPersonWindow _instance;
|
||||||
|
|
||||||
public AddPhysicalPersonWindow(IPhisicalPersonLogic phisicalPersonLogic)
|
public AddPhysicalPersonWindow(IPhisicalPersonLogic phisicalPersonLogic)
|
||||||
{
|
{
|
||||||
@ -34,30 +19,24 @@ namespace EmployeeManagmentView.PhysicalPerson
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Создаем модель и заполняем её значениями из элементов интерфейса
|
|
||||||
var model = new PhisicalPersonViewModel
|
var model = new PhisicalPersonViewModel
|
||||||
{
|
{
|
||||||
Name = NameTextBox.Text,
|
Name = NameTextBox.Text,
|
||||||
Surname = SurnameTextBox.Text,
|
Surname = SurnameTextBox.Text,
|
||||||
Patronymic = PatronomicTextBox.Text,
|
Patronymic = PatronomicTextBox.Text,
|
||||||
Birthday = BirthdayPicker.SelectedDate.Value.ToUniversalTime(), // Проверка на null не нужна, так как поле обязательное
|
Birthday = BirthdayPicker.SelectedDate.Value.ToUniversalTime(),
|
||||||
Gender = GenderTextBox.Text,
|
Gender = GenderComboBox.Text,
|
||||||
Address = AddressTextBox.Text,
|
Address = AddressTextBox.Text,
|
||||||
Telephone = TelephoneTextBox.Text
|
Telephone = TelephoneTextBox.Text
|
||||||
};
|
};
|
||||||
|
|
||||||
// Вызываем метод Insert из бизнес-логики для добавления данных в базу
|
|
||||||
_phisicalPersonLogic.Insert(model);
|
_phisicalPersonLogic.Insert(model);
|
||||||
|
|
||||||
// Показываем сообщение об успешном добавлении
|
|
||||||
MessageBox.Show("Данные успешно сохранены!");
|
MessageBox.Show("Данные успешно сохранены!");
|
||||||
|
|
||||||
// Закрываем окно
|
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// В случае ошибки показываем сообщение об ошибке
|
|
||||||
MessageBox.Show($"Ошибка: {ex.Message}");
|
MessageBox.Show($"Ошибка: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
Title="Управление физическими лицами"
|
Title="Управление физическими лицами"
|
||||||
Height="300" Width="400"
|
Height="400" Width="400"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Background="#0D2D4F">
|
Background="#0D2D4F">
|
||||||
@ -20,6 +20,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|||||||
<Button Content="Удаление физического лица"
|
<Button Content="Удаление физического лица"
|
||||||
Width="250" Height="40"
|
Width="250" Height="40"
|
||||||
Margin="0,0,0,10"
|
Margin="0,0,0,10"
|
||||||
|
Background="#004890" Foreground="#FFFFFF"
|
||||||
Style="{StaticResource RoundedButtonStyle}" />
|
Style="{StaticResource RoundedButtonStyle}" />
|
||||||
|
|
||||||
<!-- Кнопка "Добавление физического лица" -->
|
<!-- Кнопка "Добавление физического лица" -->
|
||||||
@ -27,18 +28,21 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|||||||
Width="250" Height="40"
|
Width="250" Height="40"
|
||||||
Margin="0,0,0,10"
|
Margin="0,0,0,10"
|
||||||
Style="{StaticResource RoundedButtonStyle}"
|
Style="{StaticResource RoundedButtonStyle}"
|
||||||
|
Background="#004890" Foreground="#FFFFFF"
|
||||||
Click="OpenAddPhysicalPersonWindow"/>
|
Click="OpenAddPhysicalPersonWindow"/>
|
||||||
|
|
||||||
<!-- Кнопка "Редактирование физического лица" -->
|
<!-- Кнопка "Редактирование физического лица" -->
|
||||||
<Button Content="Редактирование физического лица"
|
<Button Content="Редактирование физического лица"
|
||||||
Width="250" Height="40"
|
Width="250" Height="40"
|
||||||
Margin="0,0,0,10"
|
Margin="0,0,0,10"
|
||||||
Style="{StaticResource RoundedButtonStyle}" />
|
Style="{StaticResource RoundedButtonStyle}"
|
||||||
|
Background="#004890" Foreground="#FFFFFF"/>
|
||||||
|
|
||||||
<!-- Кнопка "Просмотр физических лиц" -->
|
<!-- Кнопка "Просмотр физических лиц" -->
|
||||||
<Button Content="Просмотр физических лиц"
|
<Button Content="Просмотр физических лиц"
|
||||||
Width="250" Height="40"
|
Width="250" Height="40"
|
||||||
Style="{StaticResource RoundedButtonStyle}" />
|
Style="{StaticResource RoundedButtonStyle}"
|
||||||
|
Background="#004890" Foreground="#FFFFFF"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -1,28 +1,12 @@
|
|||||||
using EmployeeManagmentContracts.BusinessLogicContracts;
|
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;
|
||||||
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.PhysicalPerson
|
namespace EmployeeManagmentView.PhysicalPerson
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Логика взаимодействия для PhysicalPersonManagementWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class PhysicalPersonManagementWindow : Window
|
public partial class PhysicalPersonManagementWindow : Window
|
||||||
{
|
{
|
||||||
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
|
||||||
|
|
||||||
// Constructor with Dependency Injection
|
|
||||||
public PhysicalPersonManagementWindow(IPhisicalPersonLogic phisicalPersonLogic)
|
public PhysicalPersonManagementWindow(IPhisicalPersonLogic phisicalPersonLogic)
|
||||||
{
|
{
|
||||||
_phisicalPersonLogic = phisicalPersonLogic;
|
_phisicalPersonLogic = phisicalPersonLogic;
|
||||||
@ -31,8 +15,24 @@ namespace EmployeeManagmentView.PhysicalPerson
|
|||||||
|
|
||||||
private void OpenAddPhysicalPersonWindow(object sender, RoutedEventArgs e)
|
private void OpenAddPhysicalPersonWindow(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
// Проверяем, если окно уже открыто
|
||||||
|
foreach (Window window in Application.Current.Windows)
|
||||||
|
{
|
||||||
|
if (window is AddPhysicalPersonWindow)
|
||||||
|
{
|
||||||
|
// Если окно уже открыто, активируем его и ставим на передний план
|
||||||
|
window.Activate();
|
||||||
|
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
window.Topmost = true; // Ставим окно на передний план
|
||||||
|
window.Topmost = false; // Сразу снимаем флаг, чтобы окно не оставалось всегда наверху
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Если окно не найдено, открываем новое
|
||||||
var physicalPersonWindow = new AddPhysicalPersonWindow(_phisicalPersonLogic);
|
var physicalPersonWindow = new AddPhysicalPersonWindow(_phisicalPersonLogic);
|
||||||
physicalPersonWindow.Show();
|
physicalPersonWindow.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user