PIbd-42_Kashin_M.I_CPO_Cour.../EmployeeManagmentView/Employee/EmployeeManagementWindow.xaml.cs

101 lines
3.3 KiB
C#
Raw Normal View History

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;
private readonly ISalaryLogic _salaryLogic;
private readonly IVacationLogic _vacationLogic;
public EmployeeManagementWindow(IEmployeeLogic employeeLogic, IPhisicalPersonLogic phisicalPersonLogic, ISalaryLogic salaryLogic, IVacationLogic vacationLogic)
{
_employeeLogic = employeeLogic;
_phisicalPersonLogic = phisicalPersonLogic;
_salaryLogic = salaryLogic;
_vacationLogic = vacationLogic;
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, _phisicalPersonLogic);
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, _salaryLogic, _vacationLogic, _phisicalPersonLogic);
viewWindow.Show();
}
}
}