Beispiel #1
0
        private void FindCustomerButton_OnClick(object sender, RoutedEventArgs e)
        {
            string name        = SearchCustomerNameTextBox.Text;
            string firstName   = SearchCustomerFirstNameTextBox.Text;
            string phoneNumber = SearchCustomerPhoneNumberTextBox.Text;

            if (!FieldsCompleted(name, firstName, phoneNumber))
            {
                SearchDisplayInfoTextBlock.Text = @"Must complete mandatory fields";
            }
            else
            {
                FindCustomerButton.IsEnabled = true;
                var client = _client.FindCustomer(name, firstName, phoneNumber);

                if (client == null)
                {
                    SearchDisplayInfoTextBlock.Text =
                        @"There is no customer with these specification.";
                }
                else
                {
                    SearchDisplayInfoTextBlock.Text = @"Customer cars are displayed bellow.";

                    string getChassis = "SELECT * FROM Sasiuri";
                    ExecuteQuery(getChassis, DisplayChassisDataGrid);

                    string getClientCars = $"SELECT * FROM Automobile WHERE ClientId = {client.Id}";
                    ExecuteQuery(getClientCars, SearchCustomerDataGrid);
                }
            }
        }