private void btnBuscar_Click(object sender, EventArgs e) { Services.Libro oLibro = new Services.Libro(); BO.Libro oLibroBO = new BO.Libro(); if (txtISBN.Text.Trim().Length > 0) { oLibroBO.Isbn = txtISBN.Text.Trim(); } if (txtAutor.Text.Trim().Length > 0) { oLibroBO.Autor = txtAutor.Text.Trim(); } if (txtEditorial.Text.Trim().Length > 0) { oLibroBO.Editorial = txtEditorial.Text.Trim(); } if (txtNombre.Text.Trim().Length > 0) { oLibroBO.Titulo = txtNombre.Text.Trim(); } if (txtPrecio.Text.Trim().Length > 0) { oLibroBO.Precio = Convert.ToDecimal(txtISBN.Text.Trim()); } dgListado.DataSource = oLibro.ListarLibro(oLibroBO).Tables[0]; dsReporte = oLibro.ListarLibro(oLibroBO).Tables[0]; }
//---------------------Metodos------------------------ //-------cargarLibro----- private void Edit(BO.Libro obj) { Services.Libro oLibro = new Services.Libro(); DataTable dt = oLibro.ListarLibro(obj).Tables[0]; if (dt.Rows.Count != 0) { txtAutor.Text = dt.Rows[0]["Autor"].ToString(); txtEditorial.Text = dt.Rows[0]["Editorial"].ToString(); txtISBN.Text = dt.Rows[0]["ISBN"].ToString(); txtNombre.Text = dt.Rows[0]["Titulo"].ToString(); txtPrecio.Text = dt.Rows[0]["Precio"].ToString(); this.cargar(dt.Rows[0]["Imgen"].ToString()); } }