コード例 #1
0
 private boolean isUserAllowedToViewScOrders(User user) {
   boolean isTrue = false;
   try {
     PreparedStatement stmt =
         conn.prepareStatement("select canAddScOrder,canViewScOrder from users where idusers=?");
     stmt.setInt(1, user.getUserID());
     ResultSet res = stmt.executeQuery();
     if (res.next()) {
       if (res.getBoolean("canViewScOrder")) {
         isTrue = true;
       } else {
         isTrue = false;
       }
     }
   } catch (SQLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return isTrue;
 }
コード例 #2
0
  private void displayIssuesDeps() {
    getDepartments();

    for (int i = 0; i < deps.size(); i++) {
      out.println("<div class=\"col width-33 ui-sotable\">");
      out.println("<div class=\"sortable\" widgetid=\"widgetUserSettingsgetPlugun\">");
      out.println("<div id=\"widgetUserSettingsgetPlugin\" class=\"widget\">");
      out.println("<div class=\"widgetTop\">");
      out.println("<div class=\"widgetName\">" + deps.get(i).getDepName() + "</div>");
      out.println("</div>");
      out.println("<div class=\"widgetContent\">");
      out.println("<div class=\"dataTable\" id=\"dataTable_1\">");
      out.println("<div class=\"dataTableWrapper\">");
      out.println("<table cellspacing=\"0\" class=\"dataTable\">");
      out.println("<thead>");
      out.println("<tr>");
      out.println("<th class=\"sortable first_label\" id=\"label\">");
      out.println("<div id=\"thDiv\">Issues</div>");
      out.println("</th>");
      out.println("<th class=\"sortable columnSorted\" id=\"priority\">");
      out.println("<div id=\"thDiv\">P</div>");
      out.println("</th>");
      out.println("<th class=\"sortable last\" id=\"satus\">");
      out.println("<div id=\"thDiv\">Owner</div>");
      out.println("</th>");
      out.println("<th class=\"sortable last\" id=\"opentime\">");
      out.println("<div id=\"thDiv\">Opened HH:MM</div>");
      out.println("</th>");
      out.println("</tr>");
      out.println("</thead>");
      out.println("<tbody>");
      getOpenIssuesForDep(deps.get(i).getDepName());
      for (int j = 0; j < openIssuesDep.size(); j++) {
        if (j % 2 != 0) {
          out.println("<tr>");
          out.println("<td class=\"label labelodd\" tyle=\"min:width: 145px;\">");
          out.println(
              "<span class=\"label\"><a href=\"ViewIssue.do?id="
                  + String.valueOf(openIssuesDep.get(j).getIssueID())
                  + "\">"
                  + openIssuesDep.get(j).getIssueName()
                  + "</a></span>");
          out.println("</td>");
          if (openIssuesDep.get(j).getPriority().equals("LOW")) {
            out.println(
                "<td class=\"columnodd\" style=\"background-color:#0F0\">" /*+openIssuesDep.get(j).getPriority()*/
                    + "</td>");
          }
          if (openIssuesDep.get(j).getPriority().equals("MED")) {
            out.println(
                "<td class=\"columnodd\" style=\"background-color:#FF0\">" /*+openIssuesDep.get(j).getPriority()*/
                    + "</td>");
          }
          if (openIssuesDep.get(j).getPriority().equals("HIGH")) {
            out.println(
                "<td class=\"columnodd\" style=\"background-color:#F00\">" /*+openIssuesDep.get(j).getPriority()*/
                    + "</td>");
          }
          out.println("<td class=\"columnodd\">" + openIssuesDep.get(j).getOpenByUser() + "</td>");
          out.println(
              "<td class=\"columnodd\">" + openSince(openIssuesDep.get(j).getOpenedAt()) + "</td>");
          out.println("</tr>");
        }
        if (j % 2 == 0) {
          out.println("<tr>");
          out.println("<td class=\"label labeleven\" tyle=\"min:width: 145px;\">");
          out.println(
              "<span class=\"label\"><a href=\"ViewIssue.do?id="
                  + String.valueOf(openIssuesDep.get(j).getIssueID())
                  + "\">"
                  + openIssuesDep.get(j).getIssueName()
                  + "</a>");
          out.println("</td>");
          if (openIssuesDep.get(j).getPriority().equals("LOW")) {
            out.println(
                "<td class=\"columnodd\" style=\"background-color:#0F0\">" /*+openIssuesDep.get(j).getPriority()*/
                    + "</td>");
          }
          if (openIssuesDep.get(j).getPriority().equals("MED")) {
            out.println(
                "<td class=\"columnodd\" style=\"background-color:#FF0\">" /*+openIssuesDep.get(j).getPriority()*/
                    + "</td>");
          }
          if (openIssuesDep.get(j).getPriority().equals("HIGH")) {
            out.println(
                "<td class=\"columnodd\" style=\"background-color:#F00\">" /*+openIssuesDep.get(j).getPriority()*/
                    + "</td>");
          }
          out.println("<td class=\"columneven\">" + openIssuesDep.get(j).getOpenByUser() + "</td>");
          out.println(
              "<td class=\"columnodd\">" + openSince(openIssuesDep.get(j).getOpenedAt()) + "</td>");
          out.println("</tr>");
        }
        if ((j == openIssuesDep.size() - 1) && j == 4) {
          out.println("<tr>");
          out.println("<td class=\"columneven\">");
          out.println(
              "<span class=\"label\"><a href=\"MoreIssues.do?depid="
                  + deps.get(i).getDepID()
                  + "\">All Issues</a>");
          out.println("</td>");
          out.println("</tr>");
        }
      }
      openIssuesDep.clear();
      out.println("<tbody>");
      out.println("</table>"); // table ends
      // out.println("<div class=\"dataTableSpacer\"></div>");
      out.println("</div>"); //  data table wrapper ends
      out.println("</div>"); // data table ends
      out.println("</div>"); // widget content ends
      out.println("</div>"); // widget ends
      out.println("</div>"); // get Plugin ends
      out.println("</div>"); // col width 33 ends
      // out.println("I  value @ "+i);
      if (i == 2) {
        out.println("<div class=\"clear\"></div>");
      }
    }
    deps.clear();

    if (isUserAllowedtoAddNewOrders(loggedUser)) {
      out.println(
          "<div class=\"col width-100 ui-sotable\" style=\" margin-bottom: 1px; padding-bottom: 1px; height: 50px; \">");
      out.println("<div class=\"sortable\" widgetid=\"widgetUserSettingsgetPlugun\">");
      out.println("<div id=\"widgetUserSettingsgetPlugin\" class=\"widget\">");
      out.println("<div class=\"widgetTop\">");
      out.println("<div class=\"widgetName\">Update Orders</div>");
      out.println("</div>");
      out.println("<div class=\"widgetContent\">");
      out.println("<div class=\"dataTable\" id=\"dataTable_1\">");
      out.println("<div class=\"dataTableWrapper\">");
      out.println(
          "<form method=\"post\" action=\"addNewOrder.do\" onsubmit=\"return(validateForm());\">");
      out.println("<input type=\"hidden\" value=\"" + loggedUser.getUserID() + "\"/>");
      out.println("<input name=\"update\" type=\"submit\" value=\"Update Orders\" />");
      out.println(" </form>");
      out.println("<span>");
      lastUpdatedOrders();
      out.println("</span>");
      out.println("</div>"); //  data table wrapper ends
      out.println("</div>"); // data table ends
      out.println("</div>"); // widget content ends
      out.println("</div>"); // widget ends
      out.println("</div>"); // get Plugin ends
      out.println("</div>"); // col width 33 ends
    }
    // if(isUserAllowedToViewNewOrders(loggedUser)){
    out.println(
        "<div class=\"col width-100 ui-sotable\" style=\" margin-bottom: 1px; padding-bottom: 1px; height: 50px; \">");
    out.println("<div class=\"sortable\" widgetid=\"widgetUserSettingsgetPlugun\">");
    out.println("<div id=\"widgetUserSettingsgetPlugin\" class=\"widget\">");
    out.println("<div class=\"widgetTop\">");
    out.println("<div class=\"widgetName\">Orders Last Updated</div>");
    out.println("</div>");
    out.println("<div class=\"widgetContent\">");
    out.println("<div class=\"dataTable\" id=\"dataTable_1\">");
    out.println("<div class=\"dataTableWrapper\">");
    getNewOrdersView();
    out.println("</div>"); //  data table wrapper ends
    out.println("</div>"); // data table ends
    out.println("</div>"); // widget content ends
    out.println("</div>"); // widget ends
    out.println("</div>"); // get Plugin ends
    out.println("</div>"); // col width 33 ends
    // }
    if (isUserAllowedtoAddScOrders(loggedUser)) {
      out.println(
          "<div class=\"col width-100 ui-sotable\" style=\" margin-bottom: 1px; padding-bottom: 1px; height: 50px; \">");
      out.println("<div class=\"sortable\" widgetid=\"widgetUserSettingsgetPlugun\">");
      out.println("<div id=\"widgetUserSettingsgetPlugin\" class=\"widget\">");
      out.println("<div class=\"widgetTop\">");
      out.println("<div class=\"widgetName\">Update Schedules</div>");
      out.println("</div>");
      out.println("<div class=\"widgetContent\">");
      out.println("<div class=\"dataTable\" id=\"dataTable_1\">");
      out.println("<div class=\"dataTableWrapper\">");
      out.println(
          "<form method=\"post\" action=\"AddSchedules.do\" onsubmit=\"return(validateForm());\">");
      out.println("<input type=\"hidden\" value=\"" + loggedUser.getUserID() + "\"/>");
      out.println("<input name=\"update\" type=\"submit\" value=\"Update Schedules\" />");
      out.println(" </form>");
      out.println("<span>");
      lastUpdatedScOrders();
      out.println("</span>");
      out.println("</div>"); //  data table wrapper ends
      out.println("</div>"); // data table ends
      out.println("</div>"); // widget content ends
      out.println("</div>"); // widget ends
      out.println("</div>"); // get Plugin ends
      out.println("</div>"); // col width 33 ends
    }
    // if(isUserAllowedToViewScOrders(loggedUser)){
    out.println(
        "<div class=\"col width-100 ui-sotable\" style=\" margin-bottom: 1px; padding-bottom: 1px; height: 50px; \">");
    out.println("<div class=\"sortable\" widgetid=\"widgetUserSettingsgetPlugun\">");
    out.println("<div id=\"widgetUserSettingsgetPlugin\" class=\"widget\">");
    out.println("<div class=\"widgetTop\">");
    out.println("<div class=\"widgetName\">Schedules Last Updated</div>");
    out.println("</div>");
    out.println("<div class=\"widgetContent\">");
    out.println("<div class=\"dataTable\" id=\"dataTable_1\">");
    out.println("<div class=\"dataTableWrapper\">");
    getScOrdersView();
    out.println("</div>"); //  data table wrapper ends
    out.println("</div>"); // data table ends
    out.println("</div>"); // widget content ends
    out.println("</div>"); // widget ends
    out.println("</div>"); // get Plugin ends
    out.println("</div>"); // col width 33 ends
    // }
    if (isUserAllowedtoAddWorkOrders(loggedUser)) {
      out.println(
          "<div class=\"col width-100 ui-sotable\" style=\" margin-bottom: 1px; padding-bottom: 1px; height: 50px; \">");
      out.println("<div class=\"sortable\" widgetid=\"widgetUserSettingsgetPlugun\">");
      out.println("<div id=\"widgetUserSettingsgetPlugin\" class=\"widget\">");
      out.println("<div class=\"widgetTop\">");
      out.println("<div class=\"widgetName\">Update Work Orders</div>");
      out.println("</div>");
      out.println("<div class=\"widgetContent\">");
      out.println("<div class=\"dataTable\" id=\"dataTable_1\">");
      out.println("<div class=\"dataTableWrapper\">");
      out.println(
          "<form method=\"post\" action=\"AddWorkOrders.do\" onsubmit=\"return(validateForm());\">");
      out.println("<input type=\"hidden\" value=\"" + loggedUser.getUserID() + "\"/>");
      out.println("<input name=\"update\" type=\"submit\" value=\"Update Work Orders\" />");
      out.println(" </form>");
      out.println("<span>");
      lastUpdatedWorkOrders();
      out.println("</span>");
      out.println("</div>"); //  data table wrapper ends
      out.println("</div>"); // data table ends
      out.println("</div>"); // widget content ends
      out.println("</div>"); // widget ends
      out.println("</div>"); // get Plugin ends
      out.println("</div>"); // col width 33 ends
    }
    // if(isUserAllowedToViewWorkOrders(loggedUser)){
    out.println(
        "<div class=\"col width-100 ui-sotable\" style=\" margin-bottom: 1px; padding-bottom: 1px; height: 50px; \">");
    out.println("<div class=\"sortable\" widgetid=\"widgetUserSettingsgetPlugun\">");
    out.println("<div id=\"widgetUserSettingsgetPlugin\" class=\"widget\">");
    out.println("<div class=\"widgetTop\">");
    out.println("<div class=\"widgetName\">Work Orders Last Updated</div>");
    out.println("</div>");
    out.println("<div class=\"widgetContent\">");
    out.println("<div class=\"dataTable\" id=\"dataTable_1\">");
    out.println("<div class=\"dataTableWrapper\">");
    getWorkOrdersView();
    out.println("</div>"); //  data table wrapper ends
    out.println("</div>"); // data table ends
    out.println("</div>"); // widget content ends
    out.println("</div>"); // widget ends
    out.println("</div>"); // get Plugin ends
    out.println("</div>"); // col width 33 ends
    // }
  }