use of models.UserBean in project bil372-proje by mertserezli.
the class ProjectLoader method getWorkers.
public static String getWorkers(ProjectBean project) {
String html = "";
ArrayList<UserBean> workers = Work_Emp_ProDAO.getWorkers(project);
for (UserBean worker : workers) {
html += "<a href=\"profile.jsp?username=" + worker.getUsername() + "\">" + worker.getUsername() + "</a>" + "<br>";
}
return html;
}
use of models.UserBean in project bil372-proje by mertserezli.
the class Man_Emp_ProDAO method getManeger.
public static UserBean getManeger(ProjectBean project) {
UserBean manager = new UserBean();
String query = "select username from man_emp_pro where pid=?";
try {
connect = new ConnectionManager();
currentConnection = connect.getConnection();
ps = currentConnection.prepareStatement(query);
ps.setInt(1, project.getPid());
rs = ps.executeQuery();
if (rs.next()) {
manager.setUserName(rs.getString("username"));
ProfileDAO.loadUser(manager);
}
} catch (Exception e) {
e.printStackTrace();
}
return manager;
}
use of models.UserBean in project bil372-proje by mertserezli.
the class ProjectDAO method getEmployees.
public static ArrayList<UserBean> getEmployees(ProjectBean project) {
int pid = project.getPid();
ArrayList<UserBean> result = new ArrayList<UserBean>();
String query = "select * from work_emp_pro w, employee e where w.pid=? AND w.username=e.username";
try {
connection = new ConnectionManager();
currentConnection = connection.getConnection();
ps = currentConnection.prepareStatement(query);
ps.setInt(1, pid);
rs = ps.executeQuery();
while (rs.next()) {
UserBean employee = new UserBean();
employee.setUserName(rs.getString("username"));
employee.setEmail(rs.getString("email"));
employee.setFirstName(rs.getString("firstname"));
employee.setJobTitle(rs.getString("jobtitle"));
employee.setLastName(rs.getString("lastname"));
employee.setMiddleName(rs.getString("middlename"));
result.add(employee);
}
} catch (Exception ex) {
System.out.println("Failed: An Exception has occurred! " + ex);
} finally {
finalizeConnection(currentConnection, ps, rs);
}
connection = null;
currentConnection = null;
return result;
}
use of models.UserBean in project bil372-proje by mertserezli.
the class ProjectLoader method getInviteLink.
public static String getInviteLink(ProjectBean project, UserBean user) {
String html = "";
UserBean manager = Man_Emp_ProDAO.getManeger(project);
if (user.getUsername().equals(manager.getUsername())) {
html += "<form action=\"ProjectServlet\" method=\"post\">" + "<label>Add New Employee:</label>" + "<input type=\"text\" placeholder=\"username\" name=\"username\">" + "<input type=\"submit\" value=\"Add Employee\" name=\"click\">" + "</form>";
}
return html;
}
use of models.UserBean in project bil372-proje by mertserezli.
the class ProjectLoader method getAddCommentButton.
public static String getAddCommentButton(ProjectBean project, UserBean user) {
String html = "";
ArrayList<UserBean> workers = Work_Emp_ProDAO.getWorkers(project);
for (UserBean worker : workers) if (user.getUsername().equals(worker.getUsername())) {
html += "<div>" + "<form action=\"ProjectServlet\" method=\"post\">" + "<label>Add New Comment:</label>" + "<textarea rows=\"4\" cols=\"50\" style=\"margin-top:2cm\" name=\"content\">" + "</textarea>" + "<input type=\"submit\" value=\"Add Comment\" name=\"click\">" + "</form>" + "</div>";
break;
}
return html;
}
Aggregations