private void RefreshTextBoxes() { CustomerIdTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); NameTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); ContactInfoTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); NicTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); }
private void UpdateButton_OnClick(object sender, RoutedEventArgs e) { if (SelectedCustomer == null) { MessageBox.Show("Please select a customer", "GOLDLINE", MessageBoxButton.OK); } else if (NameTextBox.Text == "" || ContactInfoTextBox.Text == "" || NicTextBox.Text == "") { MessageBox.Show("Please enter valid inputs", "GOLDLINE", MessageBoxButton.OK); } else { if (ValidateValues()) { _customerHandler.UpdateCustomer((Customer)CustomerDataGrid.SelectedItem, NameTextBox.Text, NicTextBox.Text, ContactInfoTextBox.Text); MessageBox.Show("Changes updated successfully", "GOLDLINE", MessageBoxButton.OK); CustomerDataGrid.Items.Refresh(); NameTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); NicTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); ContactInfoTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); } else { MessageBox.Show("Please enter valid inputs", "GOLDLINE", MessageBoxButton.OK); } } }
private void ResetButton_OnClick(object sender, RoutedEventArgs e) { NameTextBox.Clear(); ContactInfoTextBox.Clear(); NicTextBox.Clear(); }
private void DiscardButton_Click(object sender, RoutedEventArgs e) { NameTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); NicTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); ContactInfoTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget(); }