private bool Validar() { bool paso = true; if (NombreTextBox.Text == string.Empty) { MessageBox.Show(NombreTextBox.Text, "El Campo Nombre no Puede estar vacio"); NombreTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(DireccionTextBox.Text)) { MessageBox.Show(DireccionTextBox.Text, "El Campo Direccion no puede estar vacio"); DireccionTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(CedulaTextBox.Text)) { MessageBox.Show(CedulaTextBox.Text, "El Campo Cedula no puede estar vacio"); CedulaTextBox.Focus(); paso = false; } if (this.Detalle.Count == 0) { MessageBox.Show("Debe agregar algun telefono"); TelefonosTextBox.Focus(); paso = false; } return(paso); }
private void AgregarButton_Click(object sender, RoutedEventArgs e) { if (DetalleDataGrid.ItemsSource != null) { this.Detalle = (List <TelefonosDetalle>)DetalleDataGrid.ItemsSource; } this.Detalle.Add( new TelefonosDetalle { Telefono = TelefonosTextBox.Text, TipoTelefono = TipoTextBox.Text } ); CargaGrid(); TelefonosTextBox.Focus(); TipoTextBox.Text = string.Empty; }
private bool Validar() { bool paso = true; if (NombreTextBox.Text == string.Empty) { System.Windows.MessageBox.Show(NombreTextBox.Text, "No puede estar vacio"); NombreTextBox.Focus(); paso = false; } if (ApellidosTextBox.Text == string.Empty) { System.Windows.MessageBox.Show(ApellidosTextBox.Text, "No puede estar vacio"); ApellidosTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(DireccionTextBox.Text)) { System.Windows.MessageBox.Show(DireccionTextBox.Text, "No puede estar vacio"); DireccionTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(CorreoTextBox.Text)) { System.Windows.MessageBox.Show(CorreoTextBox.Text, "No puede estar vacio"); CorreoTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(TelefonosTextBox.Text)) { System.Windows.MessageBox.Show(TelefonosTextBox.Text, "No puede estar vacio"); TelefonosTextBox.Focus(); paso = false; } return(paso); }