Пример #1
0
        private void AddNewCustomerButton_OnClick(object sender, RoutedEventArgs e)
        {
            string name        = AddCustomerNameTextBox.Text;
            string firstName   = AddCustomerFirstNameTextBox.Text;
            string address     = AddCustomerAddressTextBox.Text;
            string city        = AddCustomerCityTextBox.Text;
            string county      = AddCustomerCountyTextBox.Text;
            string phoneNumber = AddCustomerPhoneNumberTextBox.Text;
            string email       = AddCustomerEmailTextBox.Text;

            if (!FieldsCompleted(name, firstName, address, city, county, phoneNumber))
            {
                AddCustomerDisplayInfoTextBlock.Text = @"Must complete mandatory fields.";
            }
            else
            {
                AddNewCustomerButton.IsEnabled = true;
                List <Auto> cars   = new List <Auto>();
                Client      client = new Client()
                {
                    Nume       = name,
                    Prenume    = firstName,
                    Adresa     = address,
                    Localitate = city,
                    Judet      = county,
                    Telefon    = phoneNumber,
                    Email      = email,
                    Automobile = cars.ToArray()
                };

                _client.AddCustomer(client);

                AddCustomerDisplayInfoTextBlock.Text       = @"Client added.";
                AddCustomerDisplayInfoTextBlock.Visibility = Visibility.Visible;
            }

            CustomersTabItem_OnLoaded(sender, e);
        }