private void Eliminarbutton_Click(object sender, EventArgs e) { int id = Utilidades.TOINT(librosIdTextBox.Text); using (var db = new DAL.Repositorio <Libros>()) { if (db.Eliminar(db.Buscar(p => p.LibrosId == id))) { MessageBox.Show("Correcto"); } else { MessageBox.Show("error"); } } }
private void buttonEliminar_Click(object sender, EventArgs e) { int id = Convert.ToInt32(productoIdTextBox.Text); using (var db = new DAL.Repositorio <Produtos>()) { if (db.Eliminar(db.Buscar(p => p.ProductoId == id))) { MessageBox.Show("Correcto"); } else { MessageBox.Show("Error"); } } }
private void Deletebutton_Click(object sender, EventArgs e) { int UsuarioId = Convert.ToInt32(ProductoIdTextBox.Text); using (var eliminar = new DAL.Repositorio <Entidades.Productos>()) { if (eliminar.Eliminar(eliminar.Buscar(p => p.ProductoId == UsuarioId))) { MessageBox.Show("El Producto Fue eliminado..."); Limpiar(); } else { MessageBox.Show("No se pudo eliminar el producto..."); } } }
private void EliminarButton_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(empleadoIdTextBox.Text)) { int id = int.Parse(empleadoIdTextBox.Text); using (var context = new DAL.Repositorio <Empleado>()) { if (context.Eliminar(context.Buscar(x => x.EmpleadoId == id))) { Limpiar(); MessageBox.Show("Este empleado eliminado!"); } else { MessageBox.Show("No se puedo eliminar!"); } } } else { IderrorProvider.SetError(empleadoIdTextBox, "Id vacio!"); } }
public static bool EliminarRelacion(Entidades.Facturas facturaG) { using (var repositorio = new DAL.Repositorio <Entidades.Facturas>()) { bool relacionesEliminadas = true; List <Entidades.FacturaDetalles> listaRelaciones = BLL.FacturaDetallesBLL.GetList(R => R.IdFactura == facturaG.IdFactura); foreach (var relacion in listaRelaciones) { if (!FacturaDetallesBLL.Eliminar(relacion)) { relacionesEliminadas = false; } } if (relacionesEliminadas) { return(repositorio.Eliminar(facturaG)); } return(false); } }
private void Deletebutton_Click(object sender, EventArgs e) { if (!Validar()) { MessageBox.Show("Los campos estan vacios"); } else { int id = Utilidades.TOINT(IdtextBox.Text); using (var conec = new DAL.Repositorio <Entidades.Clientes>()) { if (conec.Eliminar(conec.Buscar(p => p.ClienteId == id))) { Limpiar(); MessageBox.Show("Cliente eliminado con exito."); } else { MessageBox.Show("No se pudo eliminar el cliente."); } } } }