Ejemplo n.º 1
0
  public void AddCustomer() {
    Customer customer =
        new Customer(
            txtUsername.getText(),
            txtPassword.getText(),
            txtFirstName.getText(),
            txtLastName.getText(),
            txtEmail.getText(),
            txtPhone.getText(),
            txtStreet1.getText(),
            txtStreet2.getText(),
            txtCity.getText(),
            txtState.getText(),
            txtZipcode.getText(),
            txtCountry.getText());
    customer.setIsActive(chkActive.isSelected());

    customer.setID(CustomerID);
    if (CustomerBL.UpdateCustomer(GetPU(), customer)) {
      JOptionPane.showMessageDialog(null, "Customer updated successfully.");
      com.omazan.Mobile.GUI.frmMain.ApplicationForm.ShowListCustomerDialog();
    } else {
      JOptionPane.showMessageDialog(null, "Could not update customer.");
    }
  }
Ejemplo n.º 2
0
 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());
   }
 }