Search in sources :

Example 11 with UserBean

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;
}
Also used : UserBean(models.UserBean)

Example 12 with UserBean

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;
}
Also used : UserBean(models.UserBean)

Example 13 with UserBean

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;
}
Also used : UserBean(models.UserBean) ArrayList(java.util.ArrayList)

Example 14 with UserBean

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;
}
Also used : UserBean(models.UserBean)

Example 15 with UserBean

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;
}
Also used : UserBean(models.UserBean)

Aggregations

UserBean (models.UserBean)21 ArrayList (java.util.ArrayList)8 PrintWriter (java.io.PrintWriter)6 ProjectBean (models.ProjectBean)5 ServletException (javax.servlet.ServletException)4 NotificationBean (models.NotificationBean)4 PreparedStatement (java.sql.PreparedStatement)3 Date (java.sql.Date)2 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 List (java.util.List)1 RequestDispatcher (javax.servlet.RequestDispatcher)1 ServletContext (javax.servlet.ServletContext)1 HttpSession (javax.servlet.http.HttpSession)1 Part (javax.servlet.http.Part)1 CommentBean (models.CommentBean)1 CompanyBean (models.CompanyBean)1 MessageBean (models.MessageBean)1 TaskBean (models.TaskBean)1