// 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;
         }
     }
 }
        // obsługa przycisku potwierdzającego wykonanie operacji i odpowiednie działanie na konkretnej bazie danych
        private void button_confirm_Click(object sender, RoutedEventArgs e)
        {
            int salary;
            int phoneNr;
            int id;
            int yearofprod;
            int miles;
            int horses;

            // dla pracowników
            if (ifAddClicked == true && ifWorkersClicked == true)
            {
                if (Int32.TryParse(textBox5.Text, out salary) && Int32.TryParse(textBox7.Text, out phoneNr))
                {
                    Workers.AddWorker(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, salary, textBox6.Text, phoneNr, textBox8.Text);
                }
                if (Workers.ifCorrect)
                {
                    MessageBox.Show("data inserted", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    Workers.ifCorrect = false;
                }
                else
                {
                    MessageBox.Show("something went wrong...", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            if (ifRemoveClicked == true && ifWorkersClicked == true)
            {
                if (Int32.TryParse(textBox1.Text, out id))
                {
                    Workers.RemoveWorker(id);
                }
                if (Workers.ifCorrect)
                {
                    MessageBox.Show("data removed", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    Workers.ifCorrect = false;
                }
                else
                {
                    MessageBox.Show("something went wrong...", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            if (ifEditClicked == true && ifWorkersClicked == true)
            {
                if (Int32.TryParse(textBox5.Text, out salary) && Int32.TryParse(textBox7.Text, out phoneNr) && Int32.TryParse(textBox9.Text, out id))
                {
                    Workers.EditWorker(id, textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, salary, textBox6.Text, phoneNr, textBox8.Text);
                }
                if (Workers.ifCorrect)
                {
                    MessageBox.Show("data edited", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    Workers.ifCorrect = false;
                }
                else
                {
                    MessageBox.Show("something went wrong...", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }

            //dla klientów
            if (ifAddClicked == true && ifClientsClicked == true)
            {
                if (Int32.TryParse(textBox7.Text, out phoneNr))
                {
                    Clients.AddClient(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text, phoneNr, textBox8.Text);
                }
                if (Clients.ifCorrect)
                {
                    MessageBox.Show("data inserted", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    Clients.ifCorrect = false;
                }
                else
                {
                    MessageBox.Show("something went wrong...", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            if (ifRemoveClicked == true && ifClientsClicked == true)
            {
                if (Int32.TryParse(textBox1.Text, out id))
                {
                    Clients.RemoveClient(id);
                }
                if (Clients.ifCorrect)
                {
                    MessageBox.Show("data removed", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    Clients.ifCorrect = false;
                }
                else
                {
                    MessageBox.Show("something went wrong...", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            if (ifEditClicked == true && ifClientsClicked == true)
            {
                if (Int32.TryParse(textBox7.Text, out phoneNr) && Int32.TryParse(textBox9.Text, out id))
                {
                    Clients.EditClient(id, textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text, phoneNr, textBox8.Text);
                }
                if (Clients.ifCorrect)
                {
                    MessageBox.Show("data edited", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    Clients.ifCorrect = false;
                }
                else
                {
                    MessageBox.Show("something went wrong...", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }

            // dla samochodów
            if (ifAddClicked == true && ifCarsClicked == true)
            {
                if (Int32.TryParse(textBox2.Text, out yearofprod) && Int32.TryParse(textBox5.Text, out miles) && Int32.TryParse(textBox7.Text, out horses))
                {
                    Cars.AddCar(textBox1.Text, yearofprod, textBox3.Text, textBox4.Text, miles, textBox6.Text, horses, textBox8.Text);
                }
                if (Cars.ifCorrect)
                {
                    MessageBox.Show("data inserted", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    Cars.ifCorrect = false;
                }
                else
                {
                    MessageBox.Show("something went wrong...", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            if (ifRemoveClicked == true && ifCarsClicked == true)
            {
                if (Int32.TryParse(textBox1.Text, out id))
                {
                    Cars.RemoveCar(Int32.Parse(textBox1.Text));
                }
                if (Cars.ifCorrect)
                {
                    MessageBox.Show("data removed", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    Cars.ifCorrect = false;
                }
                else
                {
                    MessageBox.Show("something went wrong...", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            if (ifEditClicked == true && ifCarsClicked == true)
            {
                if (Int32.TryParse(textBox9.Text, out id) && Int32.TryParse(textBox2.Text, out yearofprod) && Int32.TryParse(textBox5.Text, out miles) && Int32.TryParse(textBox7.Text, out horses))
                {
                    Cars.EditCar(id, textBox1.Text, yearofprod, textBox3.Text, textBox4.Text, miles, textBox6.Text, horses, textBox8.Text);
                }
                if (Cars.ifCorrect)
                {
                    MessageBox.Show("data edited", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    Cars.ifCorrect = false;
                }
                else
                {
                    MessageBox.Show("something went wrong...", "", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            textBox1.Clear();
            textBox2.Clear();
            textBox3.Clear();
            textBox4.Clear();
            textBox5.Clear();
            textBox6.Clear();
            textBox7.Clear();
            textBox8.Clear();
            textBox9.Clear();
        }