diff --git a/EmployeeManagmentView/Employee/Salary/DeleteSalaryWindow.xaml b/EmployeeManagmentView/Employee/Salary/DeleteSalaryWindow.xaml
index 2cfd14a..8f34689 100644
--- a/EmployeeManagmentView/Employee/Salary/DeleteSalaryWindow.xaml
+++ b/EmployeeManagmentView/Employee/Salary/DeleteSalaryWindow.xaml
@@ -1,12 +1,51 @@
+ Title="Управление зарплатами"
+ Height="600" Width="800"
+ ResizeMode="NoResize"
+ WindowStartupLocation="CenterScreen"
+ Background="#0D2D4F">
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EmployeeManagmentView/Employee/Salary/DeleteSalaryWindow.xaml.cs b/EmployeeManagmentView/Employee/Salary/DeleteSalaryWindow.xaml.cs
index 8d6ae44..95aedfb 100644
--- a/EmployeeManagmentView/Employee/Salary/DeleteSalaryWindow.xaml.cs
+++ b/EmployeeManagmentView/Employee/Salary/DeleteSalaryWindow.xaml.cs
@@ -1,4 +1,5 @@
using EmployeeManagmentContracts.BusinessLogicContracts;
+using EmployeeManagmentContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -22,11 +23,59 @@ namespace EmployeeManagmentView.Employee.Salary
{
private readonly ISalaryLogic _salaryLogic;
+ private IEnumerable _allSalaries;
public DeleteSalaryWindow(ISalaryLogic salaryLogic)
{
_salaryLogic = salaryLogic;
InitializeComponent();
+ LoadSalaries();
+ }
+
+ private void LoadSalaries()
+ {
+ _allSalaries = _salaryLogic.GetFullList(); // Загрузка всех данных
+ SalariesDataGrid.ItemsSource = _allSalaries;
+ }
+
+ private void DeleteButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (SalariesDataGrid.SelectedItem is SalaryViewModel selectedSalary)
+ {
+ // Удаление зарплаты
+ _salaryLogic.Delete(selectedSalary.Id);
+ MessageBox.Show("Зарплата успешно удалена!");
+ LoadSalaries(); // Перезагрузка данных после удаления
+ SearchTextBox.Text = string.Empty; // Очистка поля поиска
+ }
+ else
+ {
+ MessageBox.Show("Пожалуйста, выберите запись для удаления.");
+ }
+ }
+
+ private void SearchTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
+ {
+ string query = SearchTextBox.Text.ToLower();
+
+ if (string.IsNullOrWhiteSpace(query))
+ {
+ // Отображаем все записи
+ SalariesDataGrid.ItemsSource = _allSalaries;
+ }
+ else
+ {
+ // Фильтрация по всем полям сущности
+ var filteredList = _allSalaries.Where(sal =>
+ (sal.EmployeeName?.ToLower().Contains(query) ?? false) ||
+ sal.CountHours.ToString().Contains(query) ||
+ sal.PriceHour.ToString().Contains(query) ||
+ (sal.Premium.HasValue && sal.Premium.Value.ToString().Contains(query)) ||
+ (sal.Date.HasValue && sal.Date.Value.ToString("dd.MM.yyyy").Contains(query))
+ ).ToList();
+
+ SalariesDataGrid.ItemsSource = filteredList;
+ }
}
}
}
diff --git a/EmployeeManagmentView/Employee/Salary/EditSalaryWindow.xaml b/EmployeeManagmentView/Employee/Salary/EditSalaryWindow.xaml
index aafbb8e..347be0f 100644
--- a/EmployeeManagmentView/Employee/Salary/EditSalaryWindow.xaml
+++ b/EmployeeManagmentView/Employee/Salary/EditSalaryWindow.xaml
@@ -1,12 +1,99 @@
-
-
+ Title="Редактирование зарплаты"
+ Height="600" Width="600"
+ ResizeMode="NoResize"
+ WindowStartupLocation="CenterScreen"
+ Background="#0D2D4F">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EmployeeManagmentView/Employee/Salary/EditSalaryWindow.xaml.cs b/EmployeeManagmentView/Employee/Salary/EditSalaryWindow.xaml.cs
index 25a4fba..0a01d3c 100644
--- a/EmployeeManagmentView/Employee/Salary/EditSalaryWindow.xaml.cs
+++ b/EmployeeManagmentView/Employee/Salary/EditSalaryWindow.xaml.cs
@@ -1,4 +1,5 @@
using EmployeeManagmentContracts.BusinessLogicContracts;
+using EmployeeManagmentContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -22,11 +23,58 @@ namespace EmployeeManagmentView.Employee.Salary
{
private readonly ISalaryLogic _salaryLogic;
+ private readonly IEmployeeLogic _employeeLogic;
+ private List _employees;
- public EditSalaryWindow(ISalaryLogic salaryLogic)
+ public EditSalaryWindow(ISalaryLogic salaryLogic, IEmployeeLogic employeeLogic)
{
_salaryLogic = salaryLogic;
+ _employeeLogic = employeeLogic;
InitializeComponent();
+ LoadEmployees();
+ }
+
+ private void LoadEmployees()
+ {
+ _employees = _employeeLogic.GetFullList();
+ EmployeeComboBox.ItemsSource = _employees;
+ EmployeeComboBox.DisplayMemberPath = "NameJob";
+ EmployeeComboBox.SelectedValuePath = "Id";
+ }
+ private void EmployeeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+
+ }
+
+ private void SaveButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (EmployeeComboBox.SelectedValue is int selectedEmployeeId)
+ {
+ try
+ {
+ var newSalary = new SalaryViewModel
+ {
+ CountHours = int.Parse(CountHoursTextBox.Text),
+ PriceHour = float.Parse(PriceHourTextBox.Text),
+ Premium = string.IsNullOrEmpty(PremiumTextBox.Text) ? (float?)null : float.Parse(PremiumTextBox.Text),
+ Date = DatePicker.SelectedDate,
+ Passed = PassedCheckBox.IsChecked ?? false,
+ EmployeeId = selectedEmployeeId
+ };
+
+ _salaryLogic.Insert(newSalary);
+ MessageBox.Show("Зарплата успешно добавлена!");
+ this.Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show($"Ошибка: {ex.Message}");
+ }
+ }
+ else
+ {
+ MessageBox.Show("Выберите сотрудника перед сохранением!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
}
}
-}
+}
\ No newline at end of file
diff --git a/EmployeeManagmentView/Employee/Salary/SalaryManagementWindow.xaml.cs b/EmployeeManagmentView/Employee/Salary/SalaryManagementWindow.xaml.cs
index 480d288..ae80761 100644
--- a/EmployeeManagmentView/Employee/Salary/SalaryManagementWindow.xaml.cs
+++ b/EmployeeManagmentView/Employee/Salary/SalaryManagementWindow.xaml.cs
@@ -77,7 +77,7 @@ namespace EmployeeManagmentView.Employee.Salary
}
}
- var editWindow = new EditSalaryWindow(_salaryLogic);
+ var editWindow = new EditSalaryWindow(_salaryLogic, _employeeLogic);
editWindow.Show();
}
diff --git a/EmployeeManagmentView/Employee/Vacation/DeleteVacationWindow.xaml b/EmployeeManagmentView/Employee/Vacation/DeleteVacationWindow.xaml
index c155aa2..ce9f831 100644
--- a/EmployeeManagmentView/Employee/Vacation/DeleteVacationWindow.xaml
+++ b/EmployeeManagmentView/Employee/Vacation/DeleteVacationWindow.xaml
@@ -1,12 +1,49 @@
+ Title="Управление отпусками"
+ Height="600" Width="800"
+ ResizeMode="NoResize"
+ WindowStartupLocation="CenterScreen"
+ Background="#0D2D4F">
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/EmployeeManagmentView/Employee/Vacation/DeleteVacationWindow.xaml.cs b/EmployeeManagmentView/Employee/Vacation/DeleteVacationWindow.xaml.cs
index 470578c..842d026 100644
--- a/EmployeeManagmentView/Employee/Vacation/DeleteVacationWindow.xaml.cs
+++ b/EmployeeManagmentView/Employee/Vacation/DeleteVacationWindow.xaml.cs
@@ -1,4 +1,5 @@
using EmployeeManagmentContracts.BusinessLogicContracts;
+using EmployeeManagmentContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -20,13 +21,58 @@ namespace EmployeeManagmentView.Employee.Vacation
///
public partial class DeleteVacationWindow : Window
{
-
private readonly IVacationLogic _vacationLogic;
+ private IEnumerable _allVacations;
public DeleteVacationWindow(IVacationLogic vacationLogic)
{
_vacationLogic = vacationLogic;
InitializeComponent();
+ LoadVacations();
+ }
+
+ private void LoadVacations()
+ {
+ _allVacations = _vacationLogic.GetFullList(); // Загрузка всех данных
+ VacationsDataGrid.ItemsSource = _allVacations;
+ }
+
+ private void DeleteButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (VacationsDataGrid.SelectedItem is VacationViewModel selectedVacation)
+ {
+ // Удаление отпуска
+ _vacationLogic.Delete(selectedVacation.Id);
+ MessageBox.Show("Отпуск успешно удален!");
+ LoadVacations(); // Перезагрузка данных после удаления
+ SearchTextBox.Text = string.Empty; // Очистка поля поиска
+ }
+ else
+ {
+ MessageBox.Show("Пожалуйста, выберите запись для удаления.");
+ }
+ }
+
+ private void SearchTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
+ {
+ string query = SearchTextBox.Text.ToLower();
+
+ if (string.IsNullOrWhiteSpace(query))
+ {
+ // Отображаем все записи
+ VacationsDataGrid.ItemsSource = _allVacations;
+ }
+ else
+ {
+ // Фильтрация по всем полям сущности
+ var filteredList = _allVacations.Where(vac =>
+ (vac.EmployeeName?.ToLower().Contains(query) ?? false) ||
+ (vac.StartData.ToString("dd.MM.yyyy").Contains(query)) ||
+ (vac.EndData.ToString("dd.MM.yyyy").Contains(query))
+ ).ToList();
+
+ VacationsDataGrid.ItemsSource = filteredList;
+ }
}
}
}
diff --git a/EmployeeManagmentView/Employee/Vacation/EditVacationWindow.xaml b/EmployeeManagmentView/Employee/Vacation/EditVacationWindow.xaml
index 3083752..8586de1 100644
--- a/EmployeeManagmentView/Employee/Vacation/EditVacationWindow.xaml
+++ b/EmployeeManagmentView/Employee/Vacation/EditVacationWindow.xaml
@@ -1,12 +1,87 @@
-
-
+ Title="Редактирование отпуска"
+ Height="600" Width="600"
+ ResizeMode="NoResize"
+ WindowStartupLocation="CenterScreen"
+ Background="#0D2D4F">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/EmployeeManagmentView/Employee/Vacation/EditVacationWindow.xaml.cs b/EmployeeManagmentView/Employee/Vacation/EditVacationWindow.xaml.cs
index 34ab555..4b40042 100644
--- a/EmployeeManagmentView/Employee/Vacation/EditVacationWindow.xaml.cs
+++ b/EmployeeManagmentView/Employee/Vacation/EditVacationWindow.xaml.cs
@@ -1,4 +1,5 @@
using EmployeeManagmentContracts.BusinessLogicContracts;
+using EmployeeManagmentContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -22,11 +23,57 @@ namespace EmployeeManagmentView.Employee.Vacation
{
private readonly IVacationLogic _vacationLogic;
+ private readonly IEmployeeLogic _employeeLogic;
+ private List _employees;
- public EditVacationWindow(IVacationLogic vacationLogic)
+ public EditVacationWindow(IVacationLogic vacationLogic, IEmployeeLogic employeeLogic)
{
_vacationLogic = vacationLogic;
+ _employeeLogic = employeeLogic;
InitializeComponent();
+ LoadEmployees();
+ }
+
+ private void LoadEmployees()
+ {
+ _employees = _employeeLogic.GetFullList();
+ EmployeeComboBox.ItemsSource = _employees;
+ EmployeeComboBox.DisplayMemberPath = "NameJob";
+ EmployeeComboBox.SelectedValuePath = "Id";
+ }
+
+ private void SaveButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (EmployeeComboBox.SelectedValue is int selectedEmployeeId)
+ {
+ try
+ {
+ var newVacation = new VacationViewModel
+ {
+ StartData = StartDatePicker.SelectedDate ?? DateTime.MinValue,
+ EndData = EndDatePicker.SelectedDate ?? DateTime.MinValue,
+ Passed = PassedCheckBox.IsChecked ?? false,
+ EmployeeId = selectedEmployeeId
+ };
+
+ _vacationLogic.Insert(newVacation);
+ MessageBox.Show("Отпуск успешно добавлен!");
+ this.Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show($"Ошибка: {ex.Message}");
+ }
+ }
+ else
+ {
+ MessageBox.Show("Выберите сотрудника перед сохранением!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Warning);
+ }
+ }
+
+ private void EmployeeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+
}
}
-}
+}
\ No newline at end of file
diff --git a/EmployeeManagmentView/Employee/Vacation/VacationManagementWindow.xaml.cs b/EmployeeManagmentView/Employee/Vacation/VacationManagementWindow.xaml.cs
index 6dc188b..20af322 100644
--- a/EmployeeManagmentView/Employee/Vacation/VacationManagementWindow.xaml.cs
+++ b/EmployeeManagmentView/Employee/Vacation/VacationManagementWindow.xaml.cs
@@ -75,7 +75,7 @@ namespace EmployeeManagmentView.Employee.Vacation
}
}
- var editWindow = new EditVacationWindow(_vacationLogic);
+ var editWindow = new EditVacationWindow(_vacationLogic, _employeeLogic);
editWindow.Show();
}