modificacion a la interfaz de personal
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user