Фух, осталось только на ввод правила поставить

This commit is contained in:
maksim 2024-12-07 23:59:01 +04:00
parent 69726bde25
commit 5389b63b05
9 changed files with 38 additions and 12 deletions

View File

@ -17,5 +17,13 @@ namespace EmployeeManagmentContracts.ViewModels
public int? EmployeeId { get; set; }
public string? EmployeeName { get; set; } = string.Empty;
public string DisplayName
{
get
{
return $"{EmployeeName} ({Date:dd.MM.yyyy})";
}
}
}
}

View File

@ -24,7 +24,7 @@ namespace EmployeeManagmentDataBaseImplement.Implements
Date = s.Data,
Passed = s.Passed,
EmployeeId = s.EmployeesId,
EmployeeName = s.Employee != null ? $"{s.Employee.PhisicalPerson.Surname} {s.Employee.PhisicalPerson.Name}" : "Не указано"
EmployeeName = s.Employee != null ? $"{s.Employee.PhisicalPerson.Surname} {s.Employee.PhisicalPerson.Name} {s.Employee.PhisicalPerson.Patronymic} ({s.Employee.NameJob})" : "Не указано"
})
.ToList();
}
@ -47,7 +47,7 @@ namespace EmployeeManagmentDataBaseImplement.Implements
Date = s.Data,
Passed = s.Passed,
EmployeeId = s.EmployeesId,
EmployeeName = s.Employee != null ? $"{s.Employee.PhisicalPerson.Surname} {s.Employee.PhisicalPerson.Name}" : "Не указано"
EmployeeName = s.Employee != null ? $"{s.Employee.PhisicalPerson.Surname} {s.Employee.PhisicalPerson.Name} {s.Employee.PhisicalPerson.Patronymic} ({s.Employee.NameJob})" : "Не указано"
})
.ToList();
}
@ -68,7 +68,7 @@ namespace EmployeeManagmentDataBaseImplement.Implements
Date = entity.Data,
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})" : "Не указано"
};
}

View File

@ -23,6 +23,7 @@ namespace EmployeeManagmentDataBaseImplement.Implements
Passed = v.Passed,
EmployeeId = v.EmployeesId,
EmployeeName = v.Employee != null ? $"{v.Employee.PhisicalPerson.Surname} {v.Employee.PhisicalPerson.Name} {v.Employee.PhisicalPerson.Patronymic} ({v.Employee.NameJob})" : "Не указано"
})
.ToList();
}

View File

@ -25,6 +25,7 @@ namespace EmployeeManagmentView.Employee.Salary
private readonly ISalaryLogic _salaryLogic;
private readonly IEmployeeLogic _employeeLogic;
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
private List<EmployeeViewModel> _employees;
public AddSalaryWindow(ISalaryLogic salaryLogic, IEmployeeLogic employeeLogic, IPhisicalPersonLogic phisicalPersonLogic)
{
@ -151,9 +152,17 @@ namespace EmployeeManagmentView.Employee.Salary
private void LoadEmployees()
{
var employees = _employeeLogic.GetFullList();
EmployeeComboBox.ItemsSource = employees;
EmployeeComboBox.DisplayMemberPath = "NameJob";
_employees = _employeeLogic.GetFullList();
// Заполняем комбинированное свойство, если нужно
foreach (var employee in _employees)
{
var physicalPerson = _phisicalPersonLogic.GetElement(employee.PhysicalPersonsId ?? 0);
employee.PhysicalPersonName = physicalPerson?.FullNameWithBirthday;
}
EmployeeComboBox.ItemsSource = _employees;
EmployeeComboBox.DisplayMemberPath = "DisplayText"; // Используем новое свойство
EmployeeComboBox.SelectedValuePath = "Id";
}

View File

@ -1,12 +1,17 @@
<Window x:Class="EmployeeManagmentView.Employee.Salary.DeleteSalaryWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:EmployeeManagmentDataModels.Enums;assembly=EmployeeManagmentDataModels"
Title="Управление зарплатами"
Height="600" Width="800"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Background="#0D2D4F">
<Window.Resources>
<local:BooleanToSalaryConverter x:Key="BooleanToSalaryConverter" />
</Window.Resources>
<Grid>
<!-- Заголовок окна -->
<TextBlock Text="Список зарплат"
@ -34,7 +39,7 @@
<DataGridTextColumn Header="Цена за час" Binding="{Binding PriceHour, StringFormat={}{0:F2}}" Width="*" />
<DataGridTextColumn Header="Премия" Binding="{Binding Premium, StringFormat={}{0:F2}}" Width="*" />
<DataGridTextColumn Header="Дата" Binding="{Binding Date, StringFormat=dd.MM.yyyy}" Width="*" />
<DataGridTextColumn Header="Заврешен" Binding="{Binding Passed}" Width="*" />
<DataGridTextColumn Header="Вылачено" Binding="{Binding Passed, Converter={StaticResource BooleanToSalaryConverter}}" Width="*" />
<DataGridTextColumn Header="Сотрудник" Binding="{Binding EmployeeName}" Width="*" />
</DataGrid.Columns>
</DataGrid>

View File

@ -40,7 +40,7 @@ namespace EmployeeManagmentView.Employee.Salary
{
_salaries = _salaryLogic.GetFullList();
SalaryComboBox.ItemsSource = _salaries;
SalaryComboBox.DisplayMemberPath = "EmployeeName";
SalaryComboBox.DisplayMemberPath = "DisplayName";
SalaryComboBox.SelectedValuePath = "Id";
}

View File

@ -38,8 +38,7 @@
<DataGridTextColumn Header="Премия" Binding="{Binding Premium, StringFormat={}{0:F2}}" Width="*" />
<DataGridTextColumn Header="Дата" Binding="{Binding Date, StringFormat=dd.MM.yyyy}" Width="*" />
<DataGridTextColumn Header="Оплачено" Binding="{Binding Passed, Converter={StaticResource BooleanToSalaryConverter}}" Width="*" />
<DataGridTextColumn Header="Работа" Binding="{Binding EmployeeName}" Width="*" />
<DataGridTextColumn Header="Физ. лицо" Binding="{Binding PhysicalPersonName}" Width="*" />
<DataGridTextColumn Header="Работник" Binding="{Binding EmployeeName}" Width="*" />
</DataGrid.Columns>
</DataGrid>

View File

@ -1,11 +1,15 @@
<Window x:Class="EmployeeManagmentView.Employee.Vacation.DeleteVacationWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:EmployeeManagmentDataModels.Enums;assembly=EmployeeManagmentDataModels"
Title="Управление отпусками"
Height="600" Width="800"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Background="#0D2D4F">
<Window.Resources>
<local:BooleanToVacationConverter x:Key="BooleanToVacationConverter" />
</Window.Resources>
<Grid>
<!-- Заголовок окна -->
@ -32,7 +36,7 @@
<DataGrid.Columns>
<DataGridTextColumn Header="Дата начала" Binding="{Binding StartData, StringFormat=dd.MM.yyyy}" Width="*" />
<DataGridTextColumn Header="Дата окончания" Binding="{Binding EndData, StringFormat=dd.MM.yyyy}" Width="*" />
<DataGridTextColumn Header="Заврешен" Binding="{Binding Passed}" Width="*" />
<DataGridTextColumn Header="Заврешен" Binding="{Binding Passed, Converter={StaticResource BooleanToVacationConverter}}" Width="*" />
<DataGridTextColumn Header="Сотрудник" Binding="{Binding EmployeeName}" Width="*" />
</DataGrid.Columns>
</DataGrid>

View File

@ -41,7 +41,7 @@ namespace EmployeeManagmentView.Employee.Vacation
{
_vacations = _vacationLogic.GetFullList();
VacationComboBox.ItemsSource = _vacations;
VacationComboBox.DisplayMemberPath = "EmployeeName";
VacationComboBox.DisplayMemberPath = "DisplayName";
VacationComboBox.SelectedValuePath = "Id";
}