diff --git a/EmployeeManagmentView/PhysicalPerson/DeletePhysicalPersonWindow.xaml b/EmployeeManagmentView/PhysicalPerson/DeletePhysicalPersonWindow.xaml
index 4fb005c..3fbc099 100644
--- a/EmployeeManagmentView/PhysicalPerson/DeletePhysicalPersonWindow.xaml
+++ b/EmployeeManagmentView/PhysicalPerson/DeletePhysicalPersonWindow.xaml
@@ -15,9 +15,17 @@
Foreground="#FFFFFF"
Margin="0,20,0,0" />
+
+
+
diff --git a/EmployeeManagmentView/PhysicalPerson/DeletePhysicalPersonWindow.xaml.cs b/EmployeeManagmentView/PhysicalPerson/DeletePhysicalPersonWindow.xaml.cs
index 0d21282..f03620a 100644
--- a/EmployeeManagmentView/PhysicalPerson/DeletePhysicalPersonWindow.xaml.cs
+++ b/EmployeeManagmentView/PhysicalPerson/DeletePhysicalPersonWindow.xaml.cs
@@ -7,6 +7,7 @@ namespace EmployeeManagmentView.PhysicalPerson
public partial class DeletePhysicalPersonWindow : Window
{
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
+ private IEnumerable _allPersons; // Храним все записи для фильтрации
public DeletePhysicalPersonWindow(IPhisicalPersonLogic phisicalPersonLogic)
{
@@ -17,7 +18,8 @@ namespace EmployeeManagmentView.PhysicalPerson
private void LoadPhysicalPersons()
{
- PhysicalPersonsDataGrid.ItemsSource = _phisicalPersonLogic.GetFullList();
+ _allPersons = _phisicalPersonLogic.GetFullList();
+ PhysicalPersonsDataGrid.ItemsSource = _allPersons;
}
private void DeleteButton_Click(object sender, RoutedEventArgs e)
@@ -36,5 +38,29 @@ namespace EmployeeManagmentView.PhysicalPerson
MessageBox.Show("Пожалуйста, выберите физическое лицо для удаления.");
}
}
+
+ private void SearchTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
+ {
+ string searchQuery = SearchTextBox.Text.ToLower(); // Получаем текст для поиска
+
+ if (string.IsNullOrWhiteSpace(searchQuery))
+ {
+ // Если поле пустое, показываем все записи
+ PhysicalPersonsDataGrid.ItemsSource = _allPersons;
+ }
+ else
+ {
+ // Фильтруем записи по всем полям
+ var filteredList = _allPersons.Where(p =>
+ p.FullName.ToLower().Contains(searchQuery) || // Поиск по ФИО
+ p.Address.ToLower().Contains(searchQuery) || // Поиск по адресу
+ p.Telephone.Contains(searchQuery) || // Поиск по телефону
+ p.Gender.ToLower().Contains(searchQuery) || // Поиск по полу
+ p.Birthday.ToString("dd.MM.yyyy").Contains(searchQuery) // Поиск по дате рождения
+ ).ToList();
+
+ PhysicalPersonsDataGrid.ItemsSource = filteredList;
+ }
+ }
}
}
diff --git a/EmployeeManagmentView/PhysicalPerson/EditPhysicalPersonWindow.xaml b/EmployeeManagmentView/PhysicalPerson/EditPhysicalPersonWindow.xaml
index 17c4d6a..0a85f33 100644
--- a/EmployeeManagmentView/PhysicalPerson/EditPhysicalPersonWindow.xaml
+++ b/EmployeeManagmentView/PhysicalPerson/EditPhysicalPersonWindow.xaml
@@ -8,7 +8,6 @@
Background="#0D2D4F">
-
-
-
-
@@ -40,49 +36,49 @@
+ Width="250" Height="40"
+ Style="{StaticResource RoundedTextBoxStyle}"
+ Margin="0,5"
+ ToolTip="Введите имя" HorizontalAlignment="Center"/>
+ Width="250" Height="40"
+ Style="{StaticResource RoundedTextBoxStyle}"
+ Margin="0,5"
+ ToolTip="Введите фамилию" HorizontalAlignment="Center"/>
+ Width="250" Height="40"
+ Style="{StaticResource RoundedTextBoxStyle}"
+ Margin="0,5"
+ ToolTip="Введите отчество" HorizontalAlignment="Center"/>
+ Width="250" Height="40"
+ Margin="0,5"
+ ToolTip="Выберите дату рождения" HorizontalAlignment="Center"/>
+ Width="250" Height="40"
+ Margin="0,5"
+ ToolTip="Выберите пол"
+ Background="White" HorizontalAlignment="Center">
@@ -92,31 +88,43 @@
+ Width="250" Height="40"
+ Style="{StaticResource RoundedTextBoxStyle}"
+ Margin="0,5"
+ ToolTip="Введите адрес" HorizontalAlignment="Center"/>
+ Width="250" Height="40"
+ Style="{StaticResource RoundedTextBoxStyle}"
+ Margin="0,5"
+ ToolTip="Введите номер телефона" HorizontalAlignment="Center"/>
+
+
+
+
+
+
+
+
+ Width="400" Height="40"
+ SelectionChanged="PhysicalPersonComboBox_SelectionChanged"
+ ToolTip="Выберите физическое лицо" HorizontalAlignment="Center"/>
-
-
diff --git a/EmployeeManagmentView/PhysicalPerson/EditPhysicalPersonWindow.xaml.cs b/EmployeeManagmentView/PhysicalPerson/EditPhysicalPersonWindow.xaml.cs
index ea18150..99f5cd9 100644
--- a/EmployeeManagmentView/PhysicalPerson/EditPhysicalPersonWindow.xaml.cs
+++ b/EmployeeManagmentView/PhysicalPerson/EditPhysicalPersonWindow.xaml.cs
@@ -23,8 +23,8 @@ namespace EmployeeManagmentView.PhysicalPerson
{
_physicalPersons = _phisicalPersonLogic.GetFullList();
PhysicalPersonComboBox.ItemsSource = _physicalPersons;
- PhysicalPersonComboBox.DisplayMemberPath = "FullNameWithBirthday";
- PhysicalPersonComboBox.SelectedValuePath = "Id";
+ PhysicalPersonComboBox.DisplayMemberPath = "FullNameWithBirthday";
+ PhysicalPersonComboBox.SelectedValuePath = "Id";
}
// Событие при выборе физ.лица
@@ -52,6 +52,23 @@ namespace EmployeeManagmentView.PhysicalPerson
}
}
+ // Фильтрация списка физических лиц по всем полям
+ private void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ var searchText = SearchTextBox.Text.ToLower();
+ var filteredPersons = _physicalPersons
+ .Where(p => p.Name.ToLower().Contains(searchText) ||
+ p.Surname.ToLower().Contains(searchText) ||
+ p.Patronymic.ToLower().Contains(searchText) ||
+ p.Gender.ToLower().Contains(searchText) ||
+ p.Address.ToLower().Contains(searchText) ||
+ p.Telephone.ToLower().Contains(searchText) ||
+ p.Birthday.ToString("dd.MM.yyyy").Contains(searchText) // Поиск по дате рождения
+ ).ToList();
+
+ PhysicalPersonComboBox.ItemsSource = filteredPersons;
+ }
+
private void SaveButton_Click(object sender, RoutedEventArgs e)
{
if (PhysicalPersonComboBox.SelectedValue is int selectedPersonId)
diff --git a/EmployeeManagmentView/PhysicalPerson/ViewPhysicalPersonsWindow.xaml b/EmployeeManagmentView/PhysicalPerson/ViewPhysicalPersonsWindow.xaml
index 6dcf5d0..1010a2d 100644
--- a/EmployeeManagmentView/PhysicalPerson/ViewPhysicalPersonsWindow.xaml
+++ b/EmployeeManagmentView/PhysicalPerson/ViewPhysicalPersonsWindow.xaml
@@ -15,9 +15,17 @@
Foreground="#FFFFFF"
Margin="0,20,0,0" />
+
+
+
diff --git a/EmployeeManagmentView/PhysicalPerson/ViewPhysicalPersonsWindow.xaml.cs b/EmployeeManagmentView/PhysicalPerson/ViewPhysicalPersonsWindow.xaml.cs
index b5266a1..4866f83 100644
--- a/EmployeeManagmentView/PhysicalPerson/ViewPhysicalPersonsWindow.xaml.cs
+++ b/EmployeeManagmentView/PhysicalPerson/ViewPhysicalPersonsWindow.xaml.cs
@@ -1,4 +1,6 @@
using EmployeeManagmentContracts.BusinessLogicContracts;
+using EmployeeManagmentContracts.ViewModels;
+using System.Linq;
using System.Windows;
namespace EmployeeManagmentView.PhysicalPerson
@@ -6,6 +8,7 @@ namespace EmployeeManagmentView.PhysicalPerson
public partial class ViewPhysicalPersonsWindow : Window
{
private readonly IPhisicalPersonLogic _phisicalPersonLogic;
+ private IEnumerable _allPersons; // Храним все записи для фильтрации
public ViewPhysicalPersonsWindow(IPhisicalPersonLogic phisicalPersonLogic)
{
@@ -16,7 +19,34 @@ namespace EmployeeManagmentView.PhysicalPerson
private void LoadPhysicalPersons()
{
- PhysicalPersonsDataGrid.ItemsSource = _phisicalPersonLogic.GetFullList();
+ _allPersons = _phisicalPersonLogic.GetFullList();
+ PhysicalPersonsDataGrid.ItemsSource = _allPersons;
+ }
+
+ private void SearchTextBox_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
+ {
+ string searchQuery = SearchTextBox.Text.ToLower(); // Получаем текст для поиска
+
+ if (string.IsNullOrWhiteSpace(searchQuery))
+ {
+ // Если поле пустое, показываем все записи
+ PhysicalPersonsDataGrid.ItemsSource = _allPersons;
+ }
+ else
+ {
+ // Фильтруем записи по всем полям
+ var filteredList = _allPersons.Where(p =>
+ p.Name.ToLower().Contains(searchQuery) ||
+ p.Surname.ToLower().Contains(searchQuery) ||
+ p.Patronymic.ToLower().Contains(searchQuery) || // Поиск по ФИО
+ p.Address.ToLower().Contains(searchQuery) || // Поиск по адресу
+ p.Telephone.Contains(searchQuery) || // Поиск по телефону
+ p.Gender.ToLower().Contains(searchQuery) || // Поиск по полу
+ p.Birthday.ToString("dd.MM.yyyy").Contains(searchQuery) // Поиск по дате рождения
+ ).ToList();
+
+ PhysicalPersonsDataGrid.ItemsSource = filteredList;
+ }
}
}
}