private void btnModificar_Click(object sender, EventArgs e) { try { if (this.txtNombre.Text == string.Empty || this.txtApellido.Text == string.Empty) { errorIcono.SetError(txtNombre, "Ingrese un dato"); errorIcono.SetError(txtApellido, "Ingrese un dato"); } else { DialogResult resul = MessageBox.Show("Realmente desea modificar el registro", "Modificar registro", MessageBoxButtons.YesNo); if (resul == DialogResult.Yes) { NAutor.Editar(Convert.ToInt32(txtIdAutor.Text), this.txtNombre.Text.ToUpper(), this.txtApellido.Text.ToUpper(), "", Convert.ToInt32(txtTelefono.Text), this.txtDireccion.Text, this.txtEmail.Text); MessageBox.Show("Registro Modificado"); Limpiar(); } } } catch (Exception ex) { MessageBox.Show(ex.StackTrace); } }
private void btnBuscar_Click(object sender, EventArgs e) { try { this.dataListado.DataSource = NAutor.BuscarNombreCompleto(this.txtBuscar.Text); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void frmLibros_Load(object sender, EventArgs e) { try { txtcbEditorial.DataSource = NEditorial.Mostrar(); txtcbEditorial.ValueMember = "IdEditorial"; txtcbEditorial.DisplayMember = "Editorial"; txtcbAutor.DataSource = NAutor.MostrarNombreCompleto(); // txtcbAutor.ValueMember = "idAutor"; txtcbAutor.DisplayMember = "NombreCompleto"; } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { if (this.txtNombre.Text == string.Empty || this.txtApellido.Text == string.Empty) { errorIcono.SetError(txtNombre, "Ingrese un dato"); errorIcono.SetError(txtApellido, "Ingrese un dato"); } else { //Convert.ToInt32(txtTelefono.Text) NAutor.Insertar(this.txtNombre.Text.ToUpper(), this.txtApellido.Text.ToUpper(), "", Convert.ToInt32(txtTelefono.Text), this.txtDireccion.Text, this.txtEmail.Text); MessageBox.Show("Registro guardado"); Limpiar(); } } catch (Exception ex) { MessageBox.Show(ex.StackTrace); } }
private void btnEliminar_Click(object sender, EventArgs e) { try { if (txtIdAutor.Text == string.Empty) { errorIcono.SetError(txtIdAutor, "Debe seleccionar un autor"); } else { DialogResult resul = MessageBox.Show("Realmente desea eliminar el registro. ?", "Eliminar registro", MessageBoxButtons.YesNo); if (resul == DialogResult.Yes) { NAutor.Eliminar(Convert.ToInt32(txtIdAutor.Text)); MessageBox.Show("Registro eliminado"); Limpiar(); } } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }