crud de variante en proceso
This commit is contained in:
@@ -1782,6 +1782,31 @@ namespace compabetov2.database
|
||||
}
|
||||
}
|
||||
|
||||
public static SQLiteDataReader conseguirVarianteDAO(int idProducto)
|
||||
{
|
||||
SQLiteDataReader reader = null;
|
||||
var db_conexion = new Conexion();
|
||||
try
|
||||
{
|
||||
SQLiteConnection conexion = db_conexion.get_connection();
|
||||
|
||||
conexion.Open();
|
||||
|
||||
string sql = "SELECT * FROM variantes WHERE fk_producto = @fk_producto";
|
||||
SQLiteCommand command = new SQLiteCommand(sql, conexion);
|
||||
command.Parameters.AddWithValue("@fk_producto", idProducto);
|
||||
reader = command.ExecuteReader();
|
||||
|
||||
return reader;
|
||||
|
||||
}
|
||||
catch (SQLiteException ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
return reader;
|
||||
}
|
||||
}
|
||||
|
||||
public static SQLiteDataReader conseguirImportesDAO()
|
||||
{
|
||||
SQLiteDataReader reader = null;
|
||||
|
||||
@@ -574,6 +574,35 @@ namespace compabetov2.database
|
||||
return variantes;
|
||||
}
|
||||
|
||||
public static List<Variante> conseguirVariante(int idProducto)
|
||||
{
|
||||
List<Variante> variantes = new List<Variante>();
|
||||
SQLiteDataReader reader = DAO.conseguirVarianteDAO(idProducto);
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
int idVariante = (int)reader.GetInt64(0);
|
||||
string nombre = reader.GetString(1);
|
||||
decimal precio = reader.GetDecimal(2);
|
||||
int cantidad = (int)reader.GetInt64(3);
|
||||
string img = reader.GetString(4);
|
||||
int fkProducto = (int)reader.GetInt64(5);
|
||||
decimal precioCompra = reader.GetDecimal(6);
|
||||
|
||||
variantes.Add(new Variante(
|
||||
idVariante,
|
||||
nombre,
|
||||
precio,
|
||||
cantidad,
|
||||
img,
|
||||
fkProducto,
|
||||
precioCompra
|
||||
));
|
||||
}
|
||||
|
||||
return variantes;
|
||||
}
|
||||
|
||||
public static List<ImporteModel> conseguirImportes()
|
||||
{
|
||||
List<ImporteModel> importes = new List<ImporteModel>();
|
||||
|
||||
Reference in New Issue
Block a user