From 69726bde25a65897613c37f545de5b901447d41b Mon Sep 17 00:00:00 2001 From: maksim Date: Sat, 7 Dec 2024 23:36:29 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D0=BE=D0=B2=D0=B8=D0=BD=D1=83=20=D0=B4=D0=B5=D0=B7?= =?UTF-8?q?=D0=B8=D0=B3=D0=BD=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/EmployeeViewModel.cs | 2 + .../ViewModels/VacationViewModel.cs | 10 ++ .../Implements/EmployeeStorage.cs | 6 +- .../Implements/VacationStorage.cs | 6 +- .../EmployeeManagmentDataModels.csproj | 1 + .../Enums/BooleanToSalaryConverter.cs | 28 +++++ .../Enums/BooleanToVacationConverter.cs | 27 ++++ EmployeeManagmentView/App.xaml | 1 + .../Employee/AddEmployeeWindow.xaml | 12 +- .../Employee/AddEmployeeWindow.xaml.cs | 107 +++++++++++++++- .../Employee/EditEmployeeWindow.xaml | 14 ++- .../Employee/EditEmployeeWindow.xaml.cs | 84 ++++++++++++- .../Employee/EmployeeManagementWindow.xaml.cs | 2 +- .../Employee/Salary/AddSalaryWindow.xaml | 11 +- .../Employee/Salary/AddSalaryWindow.xaml.cs | 118 +++++++++++++++++- .../Employee/Salary/EditSalaryWindow.xaml | 11 +- .../Employee/Salary/EditSalaryWindow.xaml.cs | 118 +++++++++++++++++- .../Salary/SalaryManagementWindow.xaml.cs | 8 +- .../Employee/Salary/ViewSalaryWindow.xaml | 12 +- .../Employee/Salary/ViewSalaryWindow.xaml.cs | 2 + .../Vacation/AddVacationWindow.xaml.cs | 89 ++++++++++++- .../Vacation/EditVacationWindow.xaml.cs | 74 ++++++++++- .../Vacation/VacationManagementWindow.xaml.cs | 10 +- .../Employee/Vacation/ViewVacationWindow.xaml | 9 +- .../Vacation/ViewVacationWindow.xaml.cs | 11 +- .../Employee/ViewEmployeeWindow.xaml.cs | 12 +- .../EditPhysicalPersonWindow.xaml | 16 ++- .../EditPhysicalPersonWindow.xaml.cs | 70 +++++++++++ 28 files changed, 819 insertions(+), 52 deletions(-) create mode 100644 EmployeeManagmentDataModels/Enums/BooleanToSalaryConverter.cs create mode 100644 EmployeeManagmentDataModels/Enums/BooleanToVacationConverter.cs diff --git a/EmployeeManagmentContracts/ViewModels/EmployeeViewModel.cs b/EmployeeManagmentContracts/ViewModels/EmployeeViewModel.cs index 4bf5bef..119b947 100644 --- a/EmployeeManagmentContracts/ViewModels/EmployeeViewModel.cs +++ b/EmployeeManagmentContracts/ViewModels/EmployeeViewModel.cs @@ -16,6 +16,8 @@ namespace EmployeeManagmentContracts.ViewModels public float Bid { get; set; } public int? PhysicalPersonsId { get; set; } public string? PhysicalPersonName { get; set; } + // Новое свойство для отображения комбинированного текста + public string DisplayText => $"{NameJob} ({PhysicalPersonName})"; } } diff --git a/EmployeeManagmentContracts/ViewModels/VacationViewModel.cs b/EmployeeManagmentContracts/ViewModels/VacationViewModel.cs index a40b950..9f3d5aa 100644 --- a/EmployeeManagmentContracts/ViewModels/VacationViewModel.cs +++ b/EmployeeManagmentContracts/ViewModels/VacationViewModel.cs @@ -14,5 +14,15 @@ namespace EmployeeManagmentContracts.ViewModels public bool Passed { get; set; } public int? EmployeeId { get; set; } public string? EmployeeName { get; set; } = string.Empty; + + public string DisplayName + { + get + { + return $"{EmployeeName} ({StartData:dd.MM.yyyy} - {EndData:dd.MM.yyyy})"; + } + } + + } } diff --git a/EmployeeManagmentDataBaseImplement/Implements/EmployeeStorage.cs b/EmployeeManagmentDataBaseImplement/Implements/EmployeeStorage.cs index ef13084..4d78289 100644 --- a/EmployeeManagmentDataBaseImplement/Implements/EmployeeStorage.cs +++ b/EmployeeManagmentDataBaseImplement/Implements/EmployeeStorage.cs @@ -22,7 +22,7 @@ namespace EmployeeManagmentDataBaseImplement.Implements PartTimeJob = e.PartTimeJob, Bid = e.Bid, PhysicalPersonsId = e.PhisicalPersonsId, - PhysicalPersonName = $"{e.PhisicalPerson.Surname} {e.PhisicalPerson.Name}" + PhysicalPersonName = $"{e.PhisicalPerson.Surname} {e.PhisicalPerson.Name} {e.PhisicalPerson.Patronymic} " }) .ToList(); } @@ -48,7 +48,7 @@ namespace EmployeeManagmentDataBaseImplement.Implements PartTimeJob = e.PartTimeJob, Bid = e.Bid, PhysicalPersonsId = e.PhisicalPersonsId, - PhysicalPersonName = $"{e.PhisicalPerson.Surname} {e.PhisicalPerson.Name}" + PhysicalPersonName = $"{e.PhisicalPerson.Surname} {e.PhisicalPerson.Name} {e.PhisicalPerson.Patronymic}", }) .ToList(); } @@ -71,7 +71,7 @@ namespace EmployeeManagmentDataBaseImplement.Implements Bid = entity.Bid, PhysicalPersonsId = entity.PhisicalPersonsId, PhysicalPersonName = entity.PhisicalPerson != null - ? $"{entity.PhisicalPerson.Surname} {entity.PhisicalPerson.Name}" + ? $"{entity.PhisicalPerson.Surname} {entity.PhisicalPerson.Name} {entity.PhisicalPerson.Patronymic} " : "Не указано" // Обработка отсутствующего физического лица }; } diff --git a/EmployeeManagmentDataBaseImplement/Implements/VacationStorage.cs b/EmployeeManagmentDataBaseImplement/Implements/VacationStorage.cs index 22f9d9d..73d74b3 100644 --- a/EmployeeManagmentDataBaseImplement/Implements/VacationStorage.cs +++ b/EmployeeManagmentDataBaseImplement/Implements/VacationStorage.cs @@ -22,7 +22,7 @@ namespace EmployeeManagmentDataBaseImplement.Implements EndData = v.EndData, Passed = v.Passed, EmployeeId = v.EmployeesId, - EmployeeName = v.Employee != null ? $"{v.Employee.PhisicalPerson.Surname} {v.Employee.PhisicalPerson.Name}" : "Не указано" + EmployeeName = v.Employee != null ? $"{v.Employee.PhisicalPerson.Surname} {v.Employee.PhisicalPerson.Name} {v.Employee.PhisicalPerson.Patronymic} ({v.Employee.NameJob})" : "Не указано" }) .ToList(); } @@ -44,7 +44,7 @@ namespace EmployeeManagmentDataBaseImplement.Implements EndData = v.EndData, Passed = v.Passed, EmployeeId = v.EmployeesId, - EmployeeName = v.Employee != null ? $"{v.Employee.PhisicalPerson.Surname} {v.Employee.PhisicalPerson.Name}" : "Не указано" + EmployeeName = v.Employee != null ? $"{v.Employee.PhisicalPerson.Surname} {v.Employee.PhisicalPerson.Name} {v.Employee.PhisicalPerson.Patronymic} ({v.Employee.NameJob})" : "Не указано" }) .ToList(); } @@ -63,7 +63,7 @@ namespace EmployeeManagmentDataBaseImplement.Implements EndData = entity.EndData, Passed = entity.Passed, EmployeeId = entity.EmployeesId, - EmployeeName = entity.Employee != null ? $"{entity.Employee.PhisicalPerson.Surname} {entity.Employee.PhisicalPerson.Name}" : "Не указано" + EmployeeName = entity.Employee != null ? $"{entity.Employee.PhisicalPerson.Surname} {entity.Employee.PhisicalPerson.Name} {entity.Employee.PhisicalPerson.Patronymic} ({entity.Employee.NameJob})" : "Не указано" }; } diff --git a/EmployeeManagmentDataModels/EmployeeManagmentDataModels.csproj b/EmployeeManagmentDataModels/EmployeeManagmentDataModels.csproj index acb35f3..7518d5f 100644 --- a/EmployeeManagmentDataModels/EmployeeManagmentDataModels.csproj +++ b/EmployeeManagmentDataModels/EmployeeManagmentDataModels.csproj @@ -18,6 +18,7 @@ + diff --git a/EmployeeManagmentDataModels/Enums/BooleanToSalaryConverter.cs b/EmployeeManagmentDataModels/Enums/BooleanToSalaryConverter.cs new file mode 100644 index 0000000..6484750 --- /dev/null +++ b/EmployeeManagmentDataModels/Enums/BooleanToSalaryConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System; +using System.Windows.Data; + +namespace EmployeeManagmentDataModels.Enums +{ + public class BooleanToSalaryConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is bool booleanValue) + { + return booleanValue ? "Заплачено" : "Не заплачено"; + } + return "Неизвестно"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException("Обратное преобразование не поддерживается."); + } + } +} diff --git a/EmployeeManagmentDataModels/Enums/BooleanToVacationConverter.cs b/EmployeeManagmentDataModels/Enums/BooleanToVacationConverter.cs new file mode 100644 index 0000000..915cf98 --- /dev/null +++ b/EmployeeManagmentDataModels/Enums/BooleanToVacationConverter.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace EmployeeManagmentDataModels.Enums +{ + public class BooleanToVacationConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is bool booleanValue) + { + return booleanValue ? "Завершен" : "Не завершено"; + } + return "Неизвестно"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException("Обратное преобразование не поддерживается."); + } + } +} diff --git a/EmployeeManagmentView/App.xaml b/EmployeeManagmentView/App.xaml index 1476ad8..0229ece 100644 --- a/EmployeeManagmentView/App.xaml +++ b/EmployeeManagmentView/App.xaml @@ -2,6 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> +