Пример #1
0
  /**
   * searches all registry lists for a specific keyword and returns all matches in a a list
   *
   * <p>function is obsolete since 1.19
   *
   * @param req the "search keyword"
   * @return list of matching objects
   */
  public ArrayList<Object> search(String req) {
    ArrayList<Object> returnValues = new ArrayList<Object>();

    for (Customer c : getCustomers().values()) {
      if (c.getName().contains(req)
          || c.getAddress().contains(req)
          || c.getCivic().contains(req)
          || c.getPhone().contains(req)) {
        returnValues.add(c);
      }
    }

    for (Item i : getItems().values()) {
      if (i.getName().contains(req) || i.getPrice().contains(req) || i.getDetails().contains(req)) {
        returnValues.add(i);
      }
    }

    for (Order i : getOrders().values()) {
      if (i.getOrderNo().contains(req) || i.getCustomer().getName().contains(req)) {
        returnValues.add(i);
      }
    }
    return returnValues;
  }
Пример #2
0
 private void fillCustCombo() {
   EntityManager em = MainWindow.em;
   TypedQuery<Customer> q = em.createNamedQuery("Customer.findAll", Customer.class);
   for (Customer c : q.getResultList()) {
     String fName = c.getFName();
     String lName = c.getLName();
     String phone = c.getPhone();
     customerNameChooser.addItem(c.getCustomerID() + " " + fName + " " + lName + ", " + phone);
   }
 }
 public void setCustomerID(int customerID) {
   CustomerID = customerID;
   lblAddCustomer.setText("Edit Customer");
   Customer customer = CustomerBL.GetCustomer(GetPU(), customerID);
   if (customer != null) {
     txtFirstName.setText(customer.getFirstName());
     txtLastName.setText(customer.getLastName());
     txtUsername.setText(customer.getUsername());
     txtUsername.setEditable(false);
     txtPassword.setText("");
     txtEmail.setText(customer.getEmail());
     txtPhone.setText(customer.getPhone());
     txtStreet1.setText(customer.getAddr_Street1());
     txtStreet2.setText(customer.getAddr_Street2());
     txtCity.setText(customer.getAddr_City());
     txtState.setText(customer.getAddr_State());
     txtZipcode.setText(customer.getAddr_Zipcode());
     txtCountry.setText(customer.getAddr_Country());
     chkActive.setSelected(customer.isIsActive());
   }
 }