// obsługa wyświetlenia konkretnej bazy danych private void button_show_Click(object sender, RoutedEventArgs e) { ifActionClicked = true; button_add.Visibility = Visibility.Collapsed; button_edit.Visibility = Visibility.Collapsed; button_remove.Visibility = Visibility.Collapsed; button_show.Visibility = Visibility.Collapsed; category.Visibility = Visibility.Visible; textBox10.Visibility = Visibility.Visible; if (ifWorkersClicked == true) { View_workers_database.Visibility = Visibility.Visible; category.Text = "Workers database"; DataTable tempDT = Workers.ShowWorkers(); View_workers_database.ItemsSource = tempDT.DefaultView; textBox10.Watermark = "type the surname to find a worker and click enter"; } if (ifCarsClicked == true) { View_cars_database.Visibility = Visibility.Visible; category.Text = "Cars database"; DataTable tempDT = Cars.ShowCars(); View_cars_database.ItemsSource = tempDT.DefaultView; textBox10.Watermark = "type the VIN to find a car and click enter"; } if (ifClientsClicked == true) { View_clients_database.Visibility = Visibility.Visible; category.Text = "Clients database"; DataTable tempDT = Clients.ShowClients(); View_clients_database.ItemsSource = tempDT.DefaultView; textBox10.Watermark = "type the surname to find a client and click enter"; } }
// funkcja akceptacji zawartości textboxa, potrzebnej do wyszukiwania jej w bazie danych private void textBox10_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { if (ifWorkersClicked == true && textBox10.Text != "") { DataTable tempDT = Workers.FilterWorkers(textBox10.Text); View_workers_database.ItemsSource = tempDT.DefaultView; } else if (ifWorkersClicked == true && textBox10.Text == "") { DataTable tempDT = Workers.ShowWorkers(); View_workers_database.ItemsSource = tempDT.DefaultView; } if (ifClientsClicked == true && textBox10.Text != "") { DataTable tempDT = Clients.FilterClients(textBox10.Text); View_clients_database.ItemsSource = tempDT.DefaultView; } else if (ifClientsClicked == true && textBox10.Text == "") { DataTable tempDT = Clients.ShowClients(); View_clients_database.ItemsSource = tempDT.DefaultView; } if (ifCarsClicked == true && textBox10.Text != "") { DataTable tempDT = Cars.FilterCars(textBox10.Text); View_cars_database.ItemsSource = tempDT.DefaultView; } else if (ifCarsClicked == true && textBox10.Text == "") { DataTable tempDT = Cars.ShowCars(); View_cars_database.ItemsSource = tempDT.DefaultView; } } }