Добавление экранов менеджеров для Salary и Vacation

This commit is contained in:
maksim 2024-12-01 16:19:48 +04:00
parent c228db433f
commit eaf9cdb71d
9 changed files with 246 additions and 7 deletions

View File

@ -25,11 +25,15 @@ namespace EmployeeManagmentView.Employee
private readonly IEmployeeLogic _employeeLogic;
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
private readonly ISalaryLogic _salaryLogic;
private readonly IVacationLogic _vacationLogic;
public EmployeeManagementWindow(IEmployeeLogic employeeLogic, IPhisicalPersonLogic phisicalPersonLogic)
public EmployeeManagementWindow(IEmployeeLogic employeeLogic, IPhisicalPersonLogic phisicalPersonLogic, ISalaryLogic salaryLogic, IVacationLogic vacationLogic)
{
_employeeLogic = employeeLogic;
_phisicalPersonLogic = phisicalPersonLogic;
_salaryLogic = salaryLogic;
_vacationLogic = vacationLogic;
InitializeComponent();
}
@ -89,7 +93,7 @@ namespace EmployeeManagmentView.Employee
}
}
var viewWindow = new ViewEmployeeWindow(_employeeLogic);
var viewWindow = new ViewEmployeeWindow(_employeeLogic, _salaryLogic, _vacationLogic);
viewWindow.Show();
}
}

View File

@ -0,0 +1,47 @@
<Window x:Class="EmployeeManagmentView.Employee.Salary.SalaryManagementWindow"
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}"/>
<!-- Кнопка "Добавление зарплаты" -->
<Button Content="Добавление зарплаты"
Width="250" Height="40"
Margin="0,0,0,10"
Style="{StaticResource RoundedButtonStyle}"
Background="#004890" Foreground="#FFFFFF"/>
<!-- Кнопка "Редактирование зарплаты" -->
<Button Content="Редактирование зарплаты"
Width="250" Height="40"
Margin="0,0,0,10"
Style="{StaticResource RoundedButtonStyle}"
Background="#004890" Foreground="#FFFFFF"/>
<!-- Кнопка "Просмотр зарплат" -->
<Button Content="Просмотр зарплат"
Width="250" Height="40"
Style="{StaticResource RoundedButtonStyle}"
Background="#004890" Foreground="#FFFFFF"/>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,36 @@
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.Salary
{
/// <summary>
/// Логика взаимодействия для SalaryManagementWindow.xaml
/// </summary>
public partial class SalaryManagementWindow : Window
{
private readonly ISalaryLogic _salaryLogic;
public SalaryManagementWindow(ISalaryLogic salaryLogic)
{
_salaryLogic = salaryLogic;
InitializeComponent();
}
}
}

View File

@ -0,0 +1,48 @@
<Window x:Class="EmployeeManagmentView.Employee.Vacation.VacationManagementWindow"
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}"/>
<!-- Кнопка "Добавление отпуска" -->
<Button Content="Добавление отпуска"
Width="250" Height="40"
Margin="0,0,0,10"
Style="{StaticResource RoundedButtonStyle}"
Background="#004890" Foreground="#FFFFFF"/>
<!-- Кнопка "Редактирование отпуска" -->
<Button Content="Редактирование отпуска"
Width="250" Height="40"
Margin="0,0,0,10"
Style="{StaticResource RoundedButtonStyle}"
Background="#004890" Foreground="#FFFFFF"/>
<!-- Кнопка "Просмотр отпусков" -->
<Button Content="Просмотр отпусков"
Width="250" Height="40"
Style="{StaticResource RoundedButtonStyle}"
Background="#004890" Foreground="#FFFFFF"/>
</StackPanel>
</Grid>
</Window>

View File

@ -0,0 +1,36 @@
using EmployeeManagmentBusinessLogic.BusinessLogic;
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.Vacation
{
/// <summary>
/// Логика взаимодействия для VacationManagementWindow.xaml
/// </summary>
public partial class VacationManagementWindow : Window
{
private readonly IVacationLogic _vacationLogic;
public VacationManagementWindow(IVacationLogic vacationLogic)
{
_vacationLogic = vacationLogic;
InitializeComponent();
}
}
}

View File

@ -26,7 +26,7 @@
<!-- Таблица сотрудников -->
<DataGrid x:Name="EmployeesDataGrid"
Margin="20,100,20,30"
Margin="20,100,20,75"
AutoGenerateColumns="False"
Style="{StaticResource RoundedDataGridStyle}">
<DataGrid.Columns>
@ -39,5 +39,23 @@
</DataGrid.Columns>
</DataGrid>
<Button Content="Работа с отпусками"
HorizontalAlignment="Left" VerticalAlignment="Bottom"
Width="200" Height="40"
Margin="180,0,0,20"
Background="#004890"
Foreground="White"
Style="{StaticResource RoundedButtonStyle}"
Click="OpenVacationManagementWindow"/>
<Button Content="Работа с зарплатой"
HorizontalAlignment="Right" VerticalAlignment="Bottom"
Width="200" Height="40"
Margin="0,0,180,20"
Background="#004890"
Foreground="White"
Style="{StaticResource RoundedButtonStyle}"
Click="OpenSalaryManagementWindow"/>
</Grid>
</Window>

View File

@ -1,5 +1,8 @@
using EmployeeManagmentContracts.BusinessLogicContracts;
using EmployeeManagmentBusinessLogic.BusinessLogic;
using EmployeeManagmentContracts.BusinessLogicContracts;
using EmployeeManagmentContracts.ViewModels;
using EmployeeManagmentView.Employee.Salary;
using EmployeeManagmentView.Employee.Vacation;
using System;
using System.Collections.Generic;
using System.Linq;
@ -23,11 +26,15 @@ namespace EmployeeManagmentView.Employee
{
private readonly IEmployeeLogic _employeeLogic;
private readonly ISalaryLogic _salaryLogic;
private readonly IVacationLogic _vacationLogic;
private IEnumerable<EmployeeViewModel> _allEmployees; // Список сотрудников для фильтрации
public ViewEmployeeWindow(IEmployeeLogic employeeLogic)
public ViewEmployeeWindow(IEmployeeLogic employeeLogic, ISalaryLogic salaryLogic, IVacationLogic vacationLogic)
{
_employeeLogic = employeeLogic;
_salaryLogic = salaryLogic;
_vacationLogic = vacationLogic;
InitializeComponent();
LoadEmployees();
}
@ -63,5 +70,43 @@ namespace EmployeeManagmentView.Employee
EmployeesDataGrid.ItemsSource = filteredList;
}
}
private void OpenSalaryManagementWindow(object sender, RoutedEventArgs e)
{
foreach (Window window in Application.Current.Windows)
{
if (window is SalaryManagementWindow)
{
// Если окно уже открыто, активируем его и ставим на передний план
window.Activate();
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
window.Topmost = true; // Ставим окно на передний план
window.Topmost = false; // Сразу снимаем флаг, чтобы окно не оставалось всегда наверху
return;
}
}
var salaryWindow = new SalaryManagementWindow(_salaryLogic);
salaryWindow.Show();
}
private void OpenVacationManagementWindow(object sender, RoutedEventArgs e)
{
foreach (Window window in Application.Current.Windows)
{
if (window is VacationManagementWindow)
{
// Если окно уже открыто, активируем его и ставим на передний план
window.Activate();
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
window.Topmost = true; // Ставим окно на передний план
window.Topmost = false; // Сразу снимаем флаг, чтобы окно не оставалось всегда наверху
return;
}
}
var vacationWindow = new VacationManagementWindow(_vacationLogic);
vacationWindow.Show();
}
}
}

View File

@ -12,12 +12,16 @@ namespace EmployeeManagmentView
private readonly IEmployeeLogic _employeeLogic;
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
private readonly ISalaryLogic _salaryLogic;
private readonly IVacationLogic _vacationLogic;
// Constructor with Dependency Injection
public MainWindow(IEmployeeLogic employeeLogic, IPhisicalPersonLogic phisicalPersonLogic)
public MainWindow(IEmployeeLogic employeeLogic, IPhisicalPersonLogic phisicalPersonLogic, ISalaryLogic salaryLogic, IVacationLogic vacationLogic)
{
_employeeLogic = employeeLogic;
_phisicalPersonLogic = phisicalPersonLogic;
_salaryLogic = salaryLogic;
_vacationLogic = vacationLogic;
InitializeComponent();
}
@ -55,7 +59,7 @@ namespace EmployeeManagmentView
}
}
var employeeWindow = new EmployeeManagementWindow(_employeeLogic, _phisicalPersonLogic);
var employeeWindow = new EmployeeManagementWindow(_employeeLogic, _phisicalPersonLogic, _salaryLogic, _vacationLogic);
employeeWindow.Show();
}

View File

@ -40,5 +40,6 @@
<DataGridTextColumn Header="Телефон" Binding="{Binding Telephone}" Width="*" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</Window>