crud de variante terminado, tal vez con detalles

This commit is contained in:
Carlos Sandoval
2024-06-24 23:15:03 -06:00
parent a9c9bd2c05
commit a610343abe
24 changed files with 288 additions and 227 deletions
+31
View File
@@ -1862,6 +1862,37 @@ namespace compabetov2.database
}
}
public static bool editarVarianteDAO(Variante variante)
{
var db_conexion = new Conexion();
try
{
SQLiteConnection conexion = db_conexion.get_connection();
conexion.Open();
string sql = "UPDATE variantes SET nombre = @nombre, precio = @precio, cantidad = @cantidad, img = @img, " +
"fk_producto = @fk_producto, precioCompra = @precioCompra WHERE idVariante = @idVariante; ";
SQLiteCommand command = new SQLiteCommand(sql, conexion);
command.Parameters.AddWithValue("@nombre", variante.nombre);
command.Parameters.AddWithValue("@precio", variante.precio);
command.Parameters.AddWithValue("@cantidad", variante.cantidad);
command.Parameters.AddWithValue("@img", variante.img);
command.Parameters.AddWithValue("@fk_producto", variante.fkProducto);
command.Parameters.AddWithValue("@precioCompra", variante.precioCompra);
command.Parameters.AddWithValue("@idVariante", variante.idVariante);
command.ExecuteNonQuery();
return true;
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
public static SQLiteDataReader conseguirImportesDAO()
{
SQLiteDataReader reader = null;