busqueda de productos lista
This commit is contained in:
+1
-1
@@ -787,7 +787,7 @@ namespace compabetov2
|
|||||||
{
|
{
|
||||||
if (!txtbusqueda.Text.Equals(""))
|
if (!txtbusqueda.Text.Equals(""))
|
||||||
{
|
{
|
||||||
//productos = service.conseguirProductosFiltrados(txtbusqueda.Text);
|
productos = service.conseguirProductosFiltrados(txtbusqueda.Text);
|
||||||
llenarLayout();
|
llenarLayout();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
+1
-1
@@ -1566,7 +1566,7 @@ namespace compabetov2.database
|
|||||||
|
|
||||||
conexion.Open();
|
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);
|
SQLiteCommand command = new SQLiteCommand(sql, conexion);
|
||||||
command.Parameters.AddWithValue("@nombre", $"%{nombreProducto}%");
|
command.Parameters.AddWithValue("@nombre", $"%{nombreProducto}%");
|
||||||
reader = command.ExecuteReader();
|
reader = command.ExecuteReader();
|
||||||
|
|||||||
+8
-8
@@ -438,28 +438,28 @@ namespace compabetov2.database
|
|||||||
return resumen;
|
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);
|
SQLiteDataReader reader = DAO.conseguirProductosFiltradosDAO(nombreProducto);
|
||||||
|
|
||||||
int idIndex = reader.GetOrdinal("idproducto");
|
int idIndex = reader.GetOrdinal("idVariante");
|
||||||
int nombreIndex = reader.GetOrdinal("nombre");
|
int nombreIndex = reader.GetOrdinal("nombre");
|
||||||
int descripcionIndex = reader.GetOrdinal("descripcion");
|
|
||||||
int precioIndex = reader.GetOrdinal("precio");
|
int precioIndex = reader.GetOrdinal("precio");
|
||||||
|
int cantidadIndex = reader.GetOrdinal("cantidad");
|
||||||
int imgIndex = reader.GetOrdinal("img");
|
int imgIndex = reader.GetOrdinal("img");
|
||||||
int stockIndex = reader.GetOrdinal("stock");
|
int fkProductoIndex = reader.GetOrdinal("fk_producto");
|
||||||
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
|
|
||||||
Producto producto = new Producto(
|
Variante producto = new Variante(
|
||||||
reader.GetInt32(idIndex),
|
reader.GetInt32(idIndex),
|
||||||
reader.GetString(nombreIndex),
|
reader.GetString(nombreIndex),
|
||||||
reader.GetString(descripcionIndex),
|
|
||||||
reader.GetDecimal(precioIndex),
|
reader.GetDecimal(precioIndex),
|
||||||
|
reader.GetInt32(cantidadIndex),
|
||||||
reader.GetString(imgIndex),
|
reader.GetString(imgIndex),
|
||||||
reader.GetInt32(stockIndex)
|
reader.GetInt32(fkProductoIndex)
|
||||||
);
|
);
|
||||||
|
|
||||||
productos.Add(producto);
|
productos.Add(producto);
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user