public void Buscar() { LibroBO oLibroBO = new LibroBO(); CtrlLibro oLibroCtrl = new CtrlLibro(); if (txtISBN.Text.Trim().Length != 0) { oLibroBO.ISBN = Convert.ToInt32(txtISBN.Text.Trim()); } if (txtAutor.Text.Trim().Length != 0) { oLibroBO.Autor = txtAutor.Text.Trim(); } if (txtNombre.Text.Trim().Length != 0) { oLibroBO.Titulo = txtNombre.Text.Trim(); } if (txtEditorial.Text.Trim().Length != 0) { oLibroBO.Editorial = txtEditorial.Text.Trim(); } if (txtPrecio.Text.Trim().Length != 0) { oLibroBO.Precio = Convert.ToInt32(txtPrecio.Text.Trim()); } dsReporte = oLibroCtrl.BusquedaLibro(oLibroBO); dgvAlumno.AutoGenerateColumns = false; dgvAlumno.DataSource = dsReporte.Tables[0]; }
public void eliminar() { LibroBO oLibroBO = new LibroBO(); CtrlLibro oCtrlLibro = new CtrlLibro(); oLibroBO.ISBN = Convert.ToInt32(txtISBN.Text.Trim()); int i = oCtrlLibro.eliminaLibro(oLibroBO); if (i == 1) { MessageBox.Show("Los datos se eliminaron correctamente"); } else { MessageBox.Show("Los datos no se eliminaron, intenta de nuevo"); } }
public void modificar() { string mensaje = ""; if (txtNombre.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el Nombre \n"; } if (txtAutor.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el Autor \n"; } if (txtEditorial.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce la Editorial \n"; } if (txtPrecio.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el Precio \n"; } if (txtPrecio.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el Teléfono \n"; } if (mensaje.Trim().Length == 0) { LibroBO oLibroBO = new LibroBO(); CtrlLibro LibroCtrl = new CtrlLibro(); oLibroBO.ISBN = Convert.ToInt32(txtISBN.Text.Trim()); oLibroBO.Titulo = txtNombre.Text.Trim(); oLibroBO.Autor = txtAutor.Text.Trim(); oLibroBO.Editorial = txtEditorial.Text.Trim(); oLibroBO.Precio = Convert.ToInt32(txtPrecio.Text.Trim()); LibroCtrl.modificaLibro(oLibroBO); MessageBox.Show("El libro se modifico correctamete"); } else { MessageBox.Show("Favor de ingresar los siguientes datos:\n" + mensaje); } }
public void BuscarLibro(LibroBO oLibroBO) { //AlumnoBO oAlumnoBO = new AlumnoBO(); CtrlLibro CtrlLibro = new CtrlLibro(); DataTable dt = CtrlLibro.BusquedaLibro(oLibroBO).Tables[0]; if (dt.Rows.Count != 0) { txtISBN.Text = dt.Rows[0]["ISBN"].ToString(); txtNombre.Text = dt.Rows[0]["Titulo"].ToString(); txtAutor.Text = dt.Rows[0]["Autor"].ToString(); txtEditorial.Text = dt.Rows[0]["Editorial"].ToString(); txtPrecio.Text = dt.Rows[0]["Precio"].ToString(); pbImagen.Image = this.AbrirImagen(dt.Rows[0]["Imagen"].ToString()); } else { this.Close(); } }
public void agregar() { string mensaje = ""; if (txtNombre.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el Nombre \n"; } if (txtAutor.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el Autor \n"; } if (txtEditorial.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce la Editorial \n"; } if (txtPrecio.Text.Trim().Length == 0) { mensaje = mensaje + "Introduce el Precio \n"; } if (mensaje.Trim().Length == 0) { LibroBO oLibroBO = new LibroBO(); CtrlLibro oServicio = new CtrlLibro(); oLibroBO.Titulo = txtNombre.Text.Trim(); oLibroBO.Autor = txtAutor.Text.Trim(); oLibroBO.Editorial = txtEditorial.Text.Trim(); oLibroBO.Precio = Convert.ToInt32(txtPrecio.Text.Trim()); GuardarImagen(); oLibroBO.Imagen = imagen; oServicio.creaLibro(oLibroBO); MessageBox.Show("El Libro se guardo correctamete"); } else { MessageBox.Show("Favor de ingresar los siguientes datos:\n" + mensaje); } }