public bool borrarEmpleado() { try { DALC.EMPLEADO empleado = CommonBC.Modelo.EMPLEADO.FirstOrDefault(us => us.ID == this.Id); CommonBC.Modelo.EMPLEADO.Remove(empleado); CommonBC.Modelo.SaveChanges(); return(true); } catch (Exception ex) { Logger.Log(ex.Message); return(false); } }
public bool actualizarEmpleado() { try { DALC.EMPLEADO empleado = CommonBC.Modelo.EMPLEADO.FirstOrDefault(us => us.ID == this.Id); empleado.USUARIO_ID = this.UsuarioId; empleado.NOMBRE = this.Nombre; empleado.APELLIDO = this.Apellido; CommonBC.Modelo.SaveChanges(); return(true); } catch (Exception ex) { Logger.Log(ex.Message); return(false); } }
public bool agregarEmpleado() { try { DALC.EMPLEADO emp = new DALC.EMPLEADO(); emp.ID = getEmpleadoMaxId() + 1; emp.NOMBRE = this.Nombre; emp.APELLIDO = this.Apellido; emp.USUARIO_ID = this.UsuarioId; CommonBC.Modelo.EMPLEADO.Add(emp); CommonBC.Modelo.SaveChanges(); return(true); } catch (Exception ex) { Logger.Log(ex.Message); return(false); } }
public int getEmpleadoIdByName(string nombre) { try { DALC.EMPLEADO empleado = CommonBC.Modelo.EMPLEADO.FirstOrDefault(us => us.NOMBRE == nombre); if (empleado != null) { return((int)empleado.ID); } else { return(0); } } catch (Exception ex) { Logger.Log(ex.Message); return(0); } }