From 43903ceb958ae4cf6b27f2268be5e05e07535748 Mon Sep 17 00:00:00 2001 From: maksim Date: Sat, 30 Nov 2024 16:06:37 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B8=D1=81=D0=BA.=20=D0=9C=D0=B1=20=D0=BF=D0=BE?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=B4=D1=83,=20=D0=BD=D0=BE=20=D1=82=D0=B0?= =?UTF-8?q?=D0=BA=20=D1=82=D0=BE=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= =?UTF-8?q?=D0=B5=D1=82.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeletePhysicalPersonWindow.xaml | 10 ++- .../DeletePhysicalPersonWindow.xaml.cs | 28 ++++++- .../EditPhysicalPersonWindow.xaml | 79 ++++++++++--------- .../EditPhysicalPersonWindow.xaml.cs | 21 ++++- .../ViewPhysicalPersonsWindow.xaml | 10 ++- .../ViewPhysicalPersonsWindow.xaml.cs | 32 +++++++- 6 files changed, 138 insertions(+), 42 deletions(-) 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 @@ -