Добавил просмотр для сотрудников и прочее. Остался фулл дезигн и делать 6 лабу

This commit is contained in:
maksim 2024-12-02 23:48:58 +04:00
parent b83fcba0aa
commit f5f36425c0
9 changed files with 166 additions and 18 deletions

View File

@ -34,6 +34,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 EmployeeName}" Width="*" />
</DataGrid.Columns>
</DataGrid>

View File

@ -70,6 +70,7 @@ namespace EmployeeManagmentView.Employee.Salary
(sal.EmployeeName?.ToLower().Contains(query) ?? false) ||
sal.CountHours.ToString().Contains(query) ||
sal.PriceHour.ToString().Contains(query) ||
sal.Passed.ToString().ToLower().Contains(query) ||
(sal.Premium.HasValue && sal.Premium.Value.ToString().Contains(query)) ||
(sal.Date.HasValue && sal.Date.Value.ToString("dd.MM.yyyy").Contains(query))
).ToList();

View File

@ -1,12 +1,52 @@
<Window x:Class="EmployeeManagmentView.Employee.Salary.ViewSalaryWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:EmployeeManagmentView.Employee.Salary"
mc:Ignorable="d"
Title="ViewSalaryWindow" Height="450" Width="800">
<Grid>
Title="Управление зарплатами"
Height="600" Width="800"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Background="#0D2D4F">
<Grid>
<!-- Заголовок окна -->
<TextBlock Text="Список зарплат"
HorizontalAlignment="Center" VerticalAlignment="Top"
FontSize="18" FontWeight="Bold"
Foreground="White"
Margin="0,20,0,0" />
<!-- Поле поиска -->
<TextBox x:Name="SearchTextBox"
Width="560"
VerticalAlignment="Top"
Margin="0,60,0,0"
HorizontalAlignment="Center"
Style="{StaticResource RoundedTextBoxStyle}"
TextChanged="SearchTextBox_TextChanged" />
<!-- Таблица зарплат -->
<DataGrid x:Name="SalariesDataGrid"
Margin="20,100,20,80"
AutoGenerateColumns="False"
Style="{StaticResource RoundedDataGridStyle}">
<DataGrid.Columns>
<DataGridTextColumn Header="Часы работы" Binding="{Binding CountHours}" Width="*" />
<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 EmployeeName}" Width="*" />
</DataGrid.Columns>
</DataGrid>
<!-- Кнопка генерации отчета -->
<Button Content="Генерация отчета"
HorizontalAlignment="Center" VerticalAlignment="Bottom"
Width="150" Height="40"
Margin="0,0,0,20"
Background="#004890"
Foreground="White"
Style="{StaticResource RoundedButtonStyle}" />
</Grid>
</Window>

View File

@ -1,4 +1,5 @@
using EmployeeManagmentContracts.BusinessLogicContracts;
using EmployeeManagmentContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
@ -21,12 +22,46 @@ namespace EmployeeManagmentView.Employee.Salary
public partial class ViewSalaryWindow : Window
{
private readonly ISalaryLogic _salaryLogic;
private IEnumerable<SalaryViewModel> _allSalaries;
public ViewSalaryWindow(ISalaryLogic salaryLogic)
{
_salaryLogic = salaryLogic;
InitializeComponent();
LoadSalaries();
}
private void LoadSalaries()
{
_allSalaries = _salaryLogic.GetFullList(); // Загрузка всех данных
SalariesDataGrid.ItemsSource = _allSalaries;
}
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.Passed.ToString().ToLower().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;
}
}
}
}

View File

@ -32,6 +32,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 EmployeeName}" Width="*" />
</DataGrid.Columns>
</DataGrid>

View File

@ -68,7 +68,8 @@ namespace EmployeeManagmentView.Employee.Vacation
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))
(vac.EndData.ToString("dd.MM.yyyy").Contains(query)) ||
(vac.Passed.ToString().ToLower().Contains(query))
).ToList();
VacationsDataGrid.ItemsSource = filteredList;

View File

@ -57,9 +57,9 @@
<Label Content="Дата окончания" Foreground="White" HorizontalAlignment="Center"/>
<DatePicker x:Name="EndDatePicker" Width="250" Height="40" />
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="10">
<Label Content="Сохранить" Foreground="White" HorizontalAlignment="Center"/>
<CheckBox x:Name="PassedCheckBox" Content="Завершено" Foreground="White" />
<StackPanel Grid.Row="1" Grid.ColumnSpan="2" Margin="10" HorizontalAlignment="Center">
<Label Content="Завершение отпуска" Foreground="White" HorizontalAlignment="Center"/>
<CheckBox x:Name="PassedCheckBox" Content="Завершено" Foreground="White" HorizontalAlignment="Center" />
</StackPanel>
</Grid>

View File

@ -1,12 +1,49 @@
<Window x:Class="EmployeeManagmentView.Employee.Vacation.ViewVacationWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:EmployeeManagmentView.Employee.Vacation"
mc:Ignorable="d"
Title="ViewVacationWindow" Height="450" Width="800">
<Grid>
Title="Управление отпусками"
Height="600" Width="800"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Background="#0D2D4F">
<Grid>
<!-- Заголовок окна -->
<TextBlock Text="Список отпусков"
HorizontalAlignment="Center" VerticalAlignment="Top"
FontSize="18" FontWeight="Bold"
Foreground="White"
Margin="0,20,0,0" />
<!-- Поле поиска -->
<TextBox x:Name="SearchTextBox"
Width="560"
VerticalAlignment="Top"
Margin="0,60,0,0"
HorizontalAlignment="Center"
Style="{StaticResource RoundedTextBoxStyle}"
TextChanged="SearchTextBox_TextChanged" />
<!-- Таблица отпусков -->
<DataGrid x:Name="VacationsDataGrid"
Margin="20,100,20,80"
AutoGenerateColumns="False"
Style="{StaticResource RoundedDataGridStyle}">
<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 EmployeeName}" Width="*" />
</DataGrid.Columns>
</DataGrid>
<!-- Кнопка отчета -->
<Button Content="Генерация отчета"
HorizontalAlignment="Center" VerticalAlignment="Bottom"
Width="150" Height="40"
Margin="0,0,0,20"
Background="#004890"
Foreground="White"
Style="{StaticResource RoundedButtonStyle}" />
</Grid>
</Window>

View File

@ -1,4 +1,5 @@
using EmployeeManagmentContracts.BusinessLogicContracts;
using EmployeeManagmentContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
@ -22,11 +23,42 @@ namespace EmployeeManagmentView.Employee.Vacation
{
private readonly IVacationLogic _vacationLogic;
private IEnumerable<VacationViewModel> _allVacations;
public ViewVacationWindow(IVacationLogic vacationLogic)
{
_vacationLogic = vacationLogic;
InitializeComponent();
LoadVacations();
}
private void LoadVacations()
{
_allVacations = _vacationLogic.GetFullList(); // Загрузка всех данных
VacationsDataGrid.ItemsSource = _allVacations;
}
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)) ||
(vac.Passed.ToString().ToLower().Contains(query))
).ToList();
VacationsDataGrid.ItemsSource = filteredList;
}
}
}
}