Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.1 kB
0
Indexable
Never
            if (e.getSource() == search) {
                if (customerID.getText().isEmpty()) {
                    JOptionPane.showMessageDialog(null, "Customer ID is needed to proceed", "Add Customer", JOptionPane.INFORMATION_MESSAGE);
                } else {
                    String employeeID = customerID.getText();
                    Customer result = CustomerViewController.searchCustomer(employeeID);
                    var customer = (Customer) objIs.readObject();
                    String output = String.format("Customer ID: %s\nName: %s\nDate of Birth: %s\nAddress %s\nTelephone: %s\n" +
                                    "Email: %s\nDate of Membership: %s\nDate of Membership Expiry: %s\n", customer.getCustomerID(), customer.getName(), customer.getDob(), customer.getAddress(),
                            customer.getTelephone(), customer.getEmail(), customer.getDateOfMembership(), customer.getDateOfMembershipExpiry());
                    JOptionPane.showMessageDialog(null, "" + output, "Customer information", JOptionPane.INFORMATION_MESSAGE);
                }
                clearField();
            }