Esempio n. 1
0
  // Reports
  public ArrayList<Customer> getAllCustomers() {
    con = new DBConnection();
    ArrayList<Customer> customers = new ArrayList<Customer>();
    try {
      cstmt = con.connection.prepareCall("{call getAllCustomer()}");
      ResultSet rs = cstmt.executeQuery();
      while (rs.next()) {
        Customer objCustomer = new Customer();
        Area objArea = new Area();
        objCustomer.setFirstName(rs.getString("FirstName"));
        objCustomer.setLastName(rs.getString("LastName"));
        objArea.setAreaName(rs.getString("AreaName"));
        objCustomer.setArea(objArea);
        objCustomer.setUserName(rs.getString("UserName"));
        objCustomer.setLane(rs.getString("Lane"));
        objCustomer.setMobileNo(rs.getString("MobileNo"));
        objCustomer.setEmailID(rs.getString("EmailID"));
        objCustomer.setStatus(rs.getBoolean("Status"));
        customers.add(objCustomer);
      }
      rs.close();
    } catch (Exception ex) {
      ex.getMessage();
    } finally {

      con.closeConnection();
    }
    return customers;
  }
Esempio n. 2
0
  public List<Customer> viewCustomerProfile(String user_name) {
    // Author: Vivek Shukla
    // Date: 14-October-2013
    // Description:
    List<Customer> customerList = new ArrayList<Customer>();
    try {
      cstmt = con.connection.prepareCall("{call viewCustomerProfile(?)}");
      cstmt.setString(1, user_name);
      ResultSet rs = cstmt.executeQuery();
      if (rs.next()) {
        Customer objCustomer = new Customer();
        objCustomer.setUserName(rs.getString("UserName"));
        objCustomer.setPassword(rs.getString("Password"));
        objCustomer.setFirstName(rs.getString("FirstName"));
        objCustomer.setLane(rs.getString("Lane"));
        objCustomer.setLastName(rs.getString("LastName"));

        Area objArea = new Area();
        objArea.setAreaName(rs.getString("AreaName"));
        objCustomer.setArea(objArea);

        objCustomer.setMobileNo(rs.getString("MobileNo"));
        objCustomer.setEmailID(rs.getString("EmailID"));

        customerList.add(objCustomer);
      } else {
        return null;
      }
    } catch (Exception ex) {
      ex.getMessage();
    } finally {

      con.closeConnection();
    }
    return customerList;
  }