modificacion a la interfaz de personal

This commit is contained in:
carlos
2024-01-09 23:29:11 -06:00
parent 0ff84fd596
commit 45a34a62b6
18 changed files with 288 additions and 715 deletions
+71
View File
@@ -141,6 +141,77 @@ namespace compabetov2.database
return reader;
}
}
public static bool actualizarEmpleadoDAO(Empleado empleado)
{
var db_conexion = new Conexion();
try
{
using (SQLiteConnection conexion = db_conexion.get_connection())
{
conexion.Open();
string sql = "UPDATE Empleado SET " +
"VALUES (@nombre, @apellidos, @calle, @fecha_contratacion, @estado, @colonia, @cp, @no_ext, @no_int, @referencia, @fecha_nac, @telefono)";
using (SQLiteCommand command = new SQLiteCommand(sql, conexion))
{
command.Parameters.AddWithValue("@nombre", empleado.nombre);
command.Parameters.AddWithValue("@apellidos", empleado.apellidos);
command.Parameters.AddWithValue("@calle", empleado.calle);
command.Parameters.AddWithValue("@fecha_contratacion", empleado.fecha_contratacion);
command.Parameters.AddWithValue("@estado", empleado.estado);
command.Parameters.AddWithValue("@colonia", empleado.colonia);
command.Parameters.AddWithValue("@cp", empleado.cp);
command.Parameters.AddWithValue("@no_ext", empleado.no_ext);
command.Parameters.AddWithValue("@no_int", empleado.no_int);
command.Parameters.AddWithValue("@referencia", empleado.referencia);
command.Parameters.AddWithValue("@fecha_nac", empleado.fecha_nac);
command.Parameters.AddWithValue("@telefono", empleado.telefono);
int filasAfectadas = command.ExecuteNonQuery();
if (filasAfectadas > 0) { return true; }
else { return false; }
}
}
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
public static bool eliminarEmpleadoDAO(int idEmpleado) {
var db_conexion = new Conexion();
try
{
using (SQLiteConnection conexion = db_conexion.get_connection())
{
conexion.Open();
string sql = "DELETE FROM Empleado WHERE idproducto = @idempleado";
using (SQLiteCommand command = new SQLiteCommand(sql, conexion))
{
command.Parameters.AddWithValue("@idempleado", idEmpleado);
int filasAfectadas = command.ExecuteNonQuery();
if (filasAfectadas > 0) { return true; }
else { return false; }
}
}
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
public static SQLiteDataReader conseguirProductosDAO()
{
SQLiteDataReader reader = null;
+5
View File
@@ -131,5 +131,10 @@ namespace compabetov2.database
{
return DAO.aumentarStockDAO(stockNuevo);
}
public static bool eliminarEmpleado(int idEmpleado)
{
return DAO.eliminarEmpleadoDAO(idEmpleado);
}
}
}