private void btnBorrar_Click(object sender, RoutedEventArgs e) { try { Biblioteca.Anfitrion anfitrion = new Biblioteca.Anfitrion() { Id_tributario = txtRut.Text, Estado_antecedentes = "D", AMaterno = txtAMaterno.Text, APaterno = txtAPaterno.Text, Direccion = txt_direccion.Text, Email = txt_email.Text, Fecha_nac = DateTime.Parse(dp_fecha_nac.Text), Id_Ciudad = cb_ciudad.SelectedIndex + 1, Nombre = txtNombre.Text, Tel_hogar = txt_tel_hogar.Text, Tel_movil = txt_tel_movil.Text, Fecha_antecedentes = DateTime.Now, Cupos_alojamiento = Int32.Parse(txt_cupos.Text) }; lblMsj.Content = anfitrion.crud(3); } catch (Exception ex) { lblMsj.Content = "Error: " + ex; } }
private void btnCrear_Click(object sender, RoutedEventArgs e) { try { if (!(String.IsNullOrEmpty(txtRut.Text) || String.IsNullOrEmpty(txtNombre.Text) || String.IsNullOrEmpty(txtAPaterno.Text) || String.IsNullOrEmpty(txtAMaterno.Text) || String.IsNullOrEmpty(txt_cupos.Text) || String.IsNullOrEmpty(txt_tel_movil.Text) || String.IsNullOrEmpty(txt_tel_hogar.Text) || String.IsNullOrEmpty(txt_email.Text) || String.IsNullOrEmpty(txt_direccion.Text))) { if (!Validaciones.validarRut(txtRut.Text)) { lblMsj.Content = "Rut Invalido"; return; } Biblioteca.Anfitrion anf = new Biblioteca.Anfitrion() { Id_tributario = txtRut.Text, Estado_antecedentes = "A", AMaterno = txtAMaterno.Text, APaterno = txtAPaterno.Text, Direccion = txt_direccion.Text, Email = txt_email.Text, Fecha_nac = DateTime.Parse(dp_fecha_nac.Text), Id_Ciudad = cb_ciudad.SelectedIndex + 1, Nombre = txtNombre.Text, Tel_hogar = txt_tel_hogar.Text, Tel_movil = txt_tel_movil.Text, Fecha_antecedentes = DateTime.Now, Cupos_alojamiento = Int32.Parse(txt_cupos.Text) }; lblMsj.Content = anf.crud(1); } else { lblMsj.Content = "Llene todos los campos."; } } catch (Exception ex) { lblMsj.Content = "Error: " + ex; } }