コード例 #1
0
  public List<UserMenuAccess> getUserMenuAccess() {
    List<UserMenuAccess> umaList = new ArrayList<UserMenuAccess>();
    Connection conn = getConnection.connection();
    Statement stmt = null;
    ResultSet rs = null;
    try {
      stmt = conn.createStatement();
      rs =
          stmt.executeQuery(
              "SELECT uma.id AS id, CONCAT_WS(', ', e.lastname, CONCAT_WS(' ', e.firstname, LEFT(e.lastname, 1))) AS name, "
                  + "u.username_ AS username, uma.main AS main, uma.timekeeping, uma.payroll AS payroll, uma.contributions AS contributions, "
                  + "uma.administrator AS administrator FROM user_ u INNER JOIN employee e ON u.employeeId = e.employeeId INNER JOIN "
                  + "user_menu_access uma ON u.id = uma.userID");
      while (rs.next()) {
        UserMenuAccess uma = new UserMenuAccess();
        uma.setUmaId(Integer.parseInt(rs.getString("id")));
        uma.setName(rs.getString("name"));
        uma.setUsername(rs.getString("username"));
        uma.setMain(conUtil.convertStringToBoolean(rs.getString("main")));
        uma.setTimekeeping(conUtil.convertStringToBoolean(rs.getString("timekeeping")));
        uma.setPayroll(conUtil.convertStringToBoolean(rs.getString("payroll")));
        uma.setContributions(conUtil.convertStringToBoolean(rs.getString("contributions")));
        uma.setAdministrator(conUtil.convertStringToBoolean(rs.getString("administrator")));
        umaList.add(uma);
      }
    } catch (SQLException ex) {
      Logger.getLogger(UserMenuAccessDAO.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
      try {
        if (conn != null || !conn.isClosed()) {
          stmt.close();
          rs.close();
          conn.close();
        }
      } catch (SQLException ex) {
        Logger.getLogger(UserMenuAccessDAO.class.getName()).log(Level.SEVERE, null, ex);
      }
    }

    return umaList;
  }
コード例 #2
0
ファイル: TaxDAO.java プロジェクト: jetdario/bellkenz
  public List<Tax> getTaxTableData() {
    List<Tax> taxList = new ArrayList<Tax>();
    Connection conn = getConnection.connection();
    Statement stmt = null;
    ResultSet rs = null;
    try {
      stmt = conn.createStatement();
      rs = stmt.executeQuery("SELECT * FROM tax_table");
      while (rs.next()) {
        Tax tax = new Tax();
        tax.setId(conUtil.convertStringToInteger(rs.getString("id")));
        tax.setStatus(rs.getString("status"));
        tax.setTaxRate1(conUtil.convertStringToDouble(rs.getString("taxRate1")));
        tax.setTaxRate2(conUtil.convertStringToDouble(rs.getString("taxRate2")));
        tax.setTaxRate3(conUtil.convertStringToDouble(rs.getString("taxRate3")));
        tax.setTaxRate4(conUtil.convertStringToDouble(rs.getString("taxRate4")));
        tax.setTaxRate5(conUtil.convertStringToDouble(rs.getString("taxRate5")));
        tax.setTaxRate6(conUtil.convertStringToDouble(rs.getString("taxRate6")));
        tax.setTaxRate7(conUtil.convertStringToDouble(rs.getString("taxRate7")));
        taxList.add(tax);
      }
    } catch (SQLException ex) {
      Logger.getLogger(TaxDAO.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
      try {
        if (conn != null || !conn.isClosed()) {
          stmt.close();
          rs.close();
          conn.close();
        }
      } catch (SQLException ex) {
        Logger.getLogger(TaxDAO.class.getName()).log(Level.SEVERE, null, ex);
      }
    }

    return taxList;
  }
コード例 #3
0
  public List<UserEventAccess> getUserEventAccess() {
    List<UserEventAccess> ueaList = new ArrayList<UserEventAccess>();
    Connection conn = getConnection.connection();
    Statement stmt = null;
    ResultSet rs = null;
    try {
      stmt = conn.createStatement();
      rs =
          stmt.executeQuery(
              "SELECT uea.id AS id, CONCAT_WS(', ', e.lastname, CONCAT_WS(' ', e.firstname, LEFT(e.lastname, 1))) AS name, "
                  + "u.username_ AS username, uea.calendarEvent AS calendarEvent, uea.addNewEmployee AS addNewEmployee, "
                  + "uea.addEditDivision AS addEditDivision, uea.addEditDepartment AS addEditDepartment, uea.updateEmployeeData AS updateEmployeeData, "
                  + "uea.addBenefits AS addBenefits, uea.addLeaveCredits AS addLeaveCredits, uea.generateAttendanceTable AS generateAttendanceTable, "
                  + "uea.generateSalaryLedger AS generateSalaryLedger, uea.generatePayrollRegister AS generatePayrollRegister, "
                  + "uea.updateContributions AS updateContributions, uea.addNewUser AS addNewUser "
                  + "FROM user_event_access uea INNER JOIN user_ u ON uea.userId = u.id INNER JOIN "
                  + "employee e ON u.employeeId = e.employeeId");
      while (rs.next()) {
        UserEventAccess uea = new UserEventAccess();
        uea.setId(Integer.parseInt(rs.getString("id")));
        uea.setName(rs.getString("name"));
        uea.setUsername(rs.getString("username"));
        uea.setCalendarEvent(conUtil.convertStringToBoolean(rs.getString("calendarEvent")));
        uea.setAddNewEmployee(conUtil.convertStringToBoolean(rs.getString("addNewEmployee")));
        uea.setAddEditDivision(conUtil.convertStringToBoolean(rs.getString("addEditDivision")));
        uea.setAddEditDepartment(conUtil.convertStringToBoolean(rs.getString("addEditDepartment")));
        uea.setUpdateEmployeeData(
            conUtil.convertStringToBoolean(rs.getString("updateEmployeeData")));
        uea.setAddBenefits(conUtil.convertStringToBoolean(rs.getString("addBenefits")));
        uea.setAddLeaveCredits(conUtil.convertStringToBoolean(rs.getString("addLeaveCredits")));
        uea.setGenerateAttendanceTable(
            conUtil.convertStringToBoolean(rs.getString("generateAttendanceTable")));
        uea.setGenerateSalaryLedger(
            conUtil.convertStringToBoolean(rs.getString("generateSalaryLedger")));
        uea.setGeneratePayrollRegister(
            conUtil.convertStringToBoolean(rs.getString("generatePayrollRegister")));
        uea.setUpdateContributions(
            conUtil.convertStringToBoolean(rs.getString("updateContributions")));
        uea.setAddNewUser(conUtil.convertStringToBoolean(rs.getString("addNewUser")));
        ueaList.add(uea);
      }
    } catch (SQLException ex) {
      Logger.getLogger(UserEventAccessDAO.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
      try {
        if (conn != null || !conn.isClosed()) {
          stmt.close();
          rs.close();
          conn.close();
        }
      } catch (SQLException ex) {
        Logger.getLogger(UserEventAccessDAO.class.getName()).log(Level.SEVERE, null, ex);
      }
    }

    return ueaList;
  }