parte visual envios

This commit is contained in:
carlos
2024-01-23 17:44:38 -06:00
parent da855a6c85
commit 2b2624fb41
11 changed files with 183 additions and 12 deletions
+27 -1
View File
@@ -1212,7 +1212,7 @@ namespace compabetov2.database
{
try
{
string sqlEnvio = "INSERT INTO envios (fecha, direccion, telefono) VALUES(@fecha,@direccion , @telefono);";
string sqlEnvio = "INSERT INTO envios (fecha, direccion, telefono,total) VALUES(@fecha,@direccion , @telefono,@total);";
string sqlDetalle = "INSERT INTO detalle_envios (fk_envios, fk_producto, cantidad) VALUES(@fk_envios, @fk_producto, @cantidad);";
string sqlIdCuenta = "SELECT idEnvios FROM envios ORDER BY idEnvios DESC LIMIT 1";
@@ -1220,6 +1220,7 @@ namespace compabetov2.database
commandCuenta.Parameters.AddWithValue("@fecha", envio.fecha);
commandCuenta.Parameters.AddWithValue("@direccion", "");
commandCuenta.Parameters.AddWithValue("@telefono", "");
commandCuenta.Parameters.AddWithValue("@total", envio.total);
commandCuenta.ExecuteNonQuery();
SQLiteCommand commandConsulta = new SQLiteCommand(sqlIdCuenta, conexion);
@@ -1283,6 +1284,31 @@ namespace compabetov2.database
}
}
public static SQLiteDataReader conseguirDetalleEnvioDAO(int idEnvio)
{
SQLiteDataReader reader = null;
var db_conexion = new Conexion();
try
{
SQLiteConnection conexion = db_conexion.get_connection();
conexion.Open();
string sql = "Select p.idproducto, p.nombre , de.cantidad from detalle_envios de, Producto p WHERE de.fk_producto = p.idproducto and de.fk_envios = @fk_envios;";
SQLiteCommand command = new SQLiteCommand(sql, conexion);
command.Parameters.AddWithValue("@fk_envios", idEnvio);
reader = command.ExecuteReader();
return reader;
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return reader;
}
}
private static void crearDB()
{
var db_conexion = new Conexion();