public void BuscarTest() { Libros libro = new Libros(); int id = 1; libro = LibroBLL.Buscar(id); Assert.IsNotNull(libro); }
private void Guardarbutton_Click(object sender, EventArgs e) { Libros _libro; bool paso = false; if (!validar()) { MessageBox.Show("Debe Llenar los Campos Indicados", "Validacion", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { _libro = LlenaClase(); if (LibroIdnumericUpDown.Value == 0) { paso = LibroBLL.Guardar(_libro); MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); SuperErrorProvider.Clear(); } else { int id = Convert.ToInt32(LibroIdnumericUpDown.Value); _libro = LibroBLL.Buscar(id); if (_libro != null) { paso = LibroBLL.Modificar(LlenaClase()); MessageBox.Show("Modificado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Id no existe", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (paso) { Limpiar(); } else { MessageBox.Show("No se pudo guardar!!", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void Buscarbutton_Click(object sender, EventArgs e) { int id = Convert.ToInt32(LibroIdnumericUpDown.Value); Libro libros = LibroBLL.Buscar(id); int.TryParse(LibroIdnumericUpDown.Text, out id); if (libros != null) { LlenaCampo(libros); } else { MessageBox.Show("Libro no Encontrado", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Buscarbutton_Click_1(object sender, EventArgs e) { SupererrorProvider.Clear(); int id; Libro libro = new Libro(); int.TryParse(IDnumericUpDown.Text, out id); libro = LibroBLL.Buscar(id); if (libro != null) { MessageBox.Show("Libro Encontrado"); LlenaCampo(libro); } else { MessageBox.Show("Persona no encontrada"); } }
private void Guardarbutton_Click_1(object sender, EventArgs e) { SupererrorProvider.Clear(); int id; int.TryParse(IDnumericUpDown.Text, out id); Libro Libro = LibroBLL.Buscar(id); Libro libro = Llenaclase(); if (libro == null) { if (GuardarValidar()) { if (LibroBLL.Guardar(libro)) { MessageBox.Show("Libro guardado"); } else { MessageBox.Show("Libro no guardado"); } } } else { if (GuardarValidar()) { if (LibroBLL.Modificar(libro)) { MessageBox.Show("Persona modificada"); } else { MessageBox.Show("Persona no modificada"); } } } }
private void Eliminarbutton_Click(object sender, EventArgs e) { int id = Convert.ToInt32(LibroIdnumericUpDown.Value); Libros mercancia = LibroBLL.Buscar(id); if (mercancia != null) { if (LibroBLL.Eliminar(id)) { MessageBox.Show("Eliminado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); } else { MessageBox.Show("No se pudo eliminar!!", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("No existe!!", "Falló", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void BuscarTest() { var encontrado = LibroBLL.Buscar(1); Assert.IsNotNull(encontrado); }
private bool ExisteEnLaBaseDeDatos() { Libro persona = LibroBLL.Buscar((int)IDnumericUpDown.Value); return(persona != null); }