PIbd-42_Kashin_M.I_CPO_Cour.../EmployeeManagmentView/Employee/Vacation/VacationManagementWindow.xaml.cs

98 lines
2.9 KiB
C#
Raw Normal View History

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;
private readonly IEmployeeLogic _employeeLogic;
public VacationManagementWindow(IVacationLogic vacationLogic, IEmployeeLogic employeeLogic)
{
_vacationLogic = vacationLogic;
_employeeLogic = employeeLogic;
InitializeComponent();
}
private void OpenAddVacationWindow(object sender, RoutedEventArgs e)
{
foreach (Window window in Application.Current.Windows)
{
if (window is AddVacationWindow existingWindow)
{
existingWindow.Activate();
return;
}
}
var addWindow = new AddVacationWindow(_vacationLogic, _employeeLogic);
addWindow.Show();
}
private void OpenDeleteVacationWindow(object sender, RoutedEventArgs e)
{
foreach (Window window in Application.Current.Windows)
{
if (window is DeleteVacationWindow existingWindow)
{
existingWindow.Activate();
return;
}
}
var deleteWindow = new DeleteVacationWindow(_vacationLogic);
deleteWindow.Show();
}
private void OpenEditVacationWindow(object sender, RoutedEventArgs e)
{
foreach (Window window in Application.Current.Windows)
{
if (window is EditVacationWindow existingWindow)
{
existingWindow.Activate();
return;
}
}
var editWindow = new EditVacationWindow(_vacationLogic, _employeeLogic);
editWindow.Show();
}
private void OpenViewVacationWindow(object sender, RoutedEventArgs e)
{
foreach (Window window in Application.Current.Windows)
{
if (window is ViewVacationWindow existingWindow)
{
existingWindow.Activate();
return;
}
}
var viewWindow = new ViewVacationWindow(_vacationLogic);
viewWindow.Show();
}
}
}