private void Button_Click_2(object sender, RoutedEventArgs e) { Conexion.eliminarCliente(txtRutCliente.Text); Conexion.eliminarContrato(txtRutCliente.Text); MessageBoxResult result = MessageBox.Show("Cliente y contratos vinculados eliminados correctamente!"); Console.WriteLine(result); tablax.ItemsSource = Conexion.BuscarContrato(txtRutCliente.Text); txtRutCliente.Text = ""; txtNombreCliente.Text = ""; txtApellidoCliente.Text = ""; fechaNacimiento.Text = ""; estadoCivil.SelectedIndex = 0; if (rFemenino.IsChecked == true) { rFemenino.IsChecked = false; } else if (rMasculino.IsChecked == true) { rMasculino.IsChecked = false; } }
private void Button_Click_1(object sender, RoutedEventArgs e) { try { txtNombreCliente.Tag = Conexion.devolverNombreCliente(txtRutCliente.Text); txtApellidoCliente.Tag = Conexion.devolverApellidoCliente(txtRutCliente.Text); fechaNacimiento.Text = Conexion.devolverFechaCliente(txtRutCliente.Text); string estado = Conexion.devolverEstadoCivilCliente(txtRutCliente.Text); if (estado == "Soltero") { estadoCivil.SelectedIndex = estadoCivil.SelectedIndex + 1; } if (estado == "Casado") { estadoCivil.SelectedIndex = estadoCivil.SelectedIndex + 2; } if (estado == "Viudo") { estadoCivil.SelectedIndex = estadoCivil.SelectedIndex + 3; } if (estado == "Cónyuge") { estadoCivil.SelectedIndex = estadoCivil.SelectedIndex + 4; } string genero = Conexion.devolverGeneroCliente(txtRutCliente.Text); if (genero.Equals("F ")) { rFemenino.IsChecked = true; } else if (genero.Equals("M ")) { rMasculino.IsChecked = true; } tablax.ItemsSource = Conexion.BuscarContrato(txtRutCliente.Text); estadoCivil.IsEnabled = true; } catch (Exception) { MessageBoxResult result = MessageBox.Show("Error, rut ingresado no existe en la base de datos..."); Console.WriteLine(result); } }
private void btnBuscar_Click(object sender, RoutedEventArgs e) { tabla.ItemsSource = Conexion.BuscarContrato(txtBuscar.Text); }