예제 #1
0
        private void EliminarButton_Click(object sender, RoutedEventArgs e)
        {
            int id;

            id = Convert.ToInt32(ProductoIdTextBox.Text);

            Limpiar();

            if (ProductosBll.Eliminar(id))
            {
                MessageBox.Show("Eliminado", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show(ProductoIdTextBox.Text, "No se puede eliminar porque no existe");
            }
        }
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            int       id       = Utilidades.ToInt(IdProductoTextBox.Text);
            Productos producto = ProductosBll.Buscar(p => p.IdProductos == id);

            if (producto != null)
            {
                if (producto.IdProductos != 1)
                {
                    ProductosBll.Eliminar(producto);
                    Utilidades.ShowToastr(this, "El Producto", " Se Elimino Correctamente", "Success");
                    Limpiar();
                }
                else
                {
                    Utilidades.ShowToastr(this, "El Producto", "No Se Elimino", "warning");
                }
            }
        }