busqueda de productos lista
This commit is contained in:
+1
-1
@@ -1566,7 +1566,7 @@ namespace compabetov2.database
|
||||
|
||||
conexion.Open();
|
||||
|
||||
string sql = "SELECT * FROM Producto WHERE nombre LIKE @nombre";
|
||||
string sql = "SELECT * FROM variantes WHERE nombre LIKE @nombre";
|
||||
SQLiteCommand command = new SQLiteCommand(sql, conexion);
|
||||
command.Parameters.AddWithValue("@nombre", $"%{nombreProducto}%");
|
||||
reader = command.ExecuteReader();
|
||||
|
||||
+8
-8
@@ -438,28 +438,28 @@ namespace compabetov2.database
|
||||
return resumen;
|
||||
}
|
||||
|
||||
public static List<Producto> conseguirProductosFiltrados(string nombreProducto)
|
||||
public static List<Variante> conseguirProductosFiltrados(string nombreProducto)
|
||||
{
|
||||
List<Producto> productos = new List<Producto>();
|
||||
List<Variante> productos = new List<Variante>();
|
||||
SQLiteDataReader reader = DAO.conseguirProductosFiltradosDAO(nombreProducto);
|
||||
|
||||
int idIndex = reader.GetOrdinal("idproducto");
|
||||
int idIndex = reader.GetOrdinal("idVariante");
|
||||
int nombreIndex = reader.GetOrdinal("nombre");
|
||||
int descripcionIndex = reader.GetOrdinal("descripcion");
|
||||
int precioIndex = reader.GetOrdinal("precio");
|
||||
int cantidadIndex = reader.GetOrdinal("cantidad");
|
||||
int imgIndex = reader.GetOrdinal("img");
|
||||
int stockIndex = reader.GetOrdinal("stock");
|
||||
int fkProductoIndex = reader.GetOrdinal("fk_producto");
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
|
||||
Producto producto = new Producto(
|
||||
Variante producto = new Variante(
|
||||
reader.GetInt32(idIndex),
|
||||
reader.GetString(nombreIndex),
|
||||
reader.GetString(descripcionIndex),
|
||||
reader.GetDecimal(precioIndex),
|
||||
reader.GetInt32(cantidadIndex),
|
||||
reader.GetString(imgIndex),
|
||||
reader.GetInt32(stockIndex)
|
||||
reader.GetInt32(fkProductoIndex)
|
||||
);
|
||||
|
||||
productos.Add(producto);
|
||||
|
||||
Reference in New Issue
Block a user