private void Buscarbutton_Click(object sender, EventArgs e) { int id; Ubicaciones ubicaciones = new Ubicaciones(); int.TryParse(IDnumericUpDown.Text, out id); Limpiar(); ubicaciones = UbicacionBLL.Buscar(id); if (ubicaciones != null) { MessageBox.Show("Producto Encontrado."); LlenaCampo(ubicaciones); } else { MessageBox.Show("Producto no encontrado."); } }
private void Eliminarbutton_Click(object sender, EventArgs e) { errorProvider.Clear(); if (!ValidarEliminar()) { return; } int id; int.TryParse(IDnumericUpDown.Text, out id); Limpiar(); if (UbicacionBLL.Eliminar(id)) { MessageBox.Show("Eliminado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { errorProvider.SetError(IDnumericUpDown, "No se puede eliminar ubicacion que no existe."); } }
private void Gaurdarbutton_Click(object sender, EventArgs e) { Ubicaciones ubicaciones; bool paso = false; if (!ValidarGuardar()) { return; } ubicaciones = LlenaClase(); if (IDnumericUpDown.Value == 0) { paso = UbicacionBLL.Guardar(ubicaciones); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede guardar un producto que no existe", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } paso = UbicacionBLL.Modificar(ubicaciones); } if (paso) { MessageBox.Show("Guardado!!", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No fue posible guardar!!", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); } Limpiar(); }