private void hireWorker(int workId, int projId, long salary, HttpServletResponse response, RequestContext rc) throws SQLException, IOException {
        int requesterId = rc.getId();
        if(WorkerManager.isFree(workId) && ProjectManager.ownsProject(projId, requesterId)) {
            if(!ProjectManager.isFull(projId)) {
                if(salary <= WorkerManager.MAX_SALARY) {
                    if(salary >= WorkerManager.MIN_SALARY) {
                        if(ProjectManager.getCompanyID(projId) != WorkerManager.getPrevCompany(workId)) {
                            WorkerManager.hireWorker(workId, projId, (long)(salary*Config.MONEY_FACTOR));
                            response.sendRedirect("worker.jsp?id=" + workId + "&tip=hireok");
                        } else {
                            response.sendRedirect("worker.jsp?id=" + workId + "&err=refuse");
                        }
                    } else {
                        response.sendRedirect("worker.jsp?id=" + workId + "&err=toolow");
                    }
                } else {
                    response.sendRedirect("worker.jsp?id=" + workId + "&err=toolong");
                }
            } else {
                response.sendRedirect("worker.jsp?id=" + workId + "&err=projectfull");
            }
        } else {
            response.sendRedirect("worker.jsp?id=" + workId + "&err=permdenied");
        }
    }