Beispiel #1
0
  private synchronized void saveInput() {
    if ((customer == null) && (operation == CRUDOperationEnum.NEW)) {
      final Customer newCustomer =
          new Customer(
              NumberController.readLastNumber(NumberEnum.CUSTOMER.getType(), 0).toString(),
              jTextFieldCusName.getText(),
              jTextFieldCusVat.getText(),
              jTextFieldCusPhone.getText(),
              jTextFieldCusMobile.getText(),
              jTextFieldCusFax.getText(),
              jTextFieldCusemail.getText(),
              jTextFieldCusWebsite.getText(),
              cusTypes.get(jComboBoxCusType.getSelectedItem().toString()),
              cusCats.get(jComboBoxCusCat.getSelectedItem().toString()),
              cusLangs.get(jComboBoxCusLang.getSelectedItem().toString()),
              cusCurs.get(jComboBoxCusCur.getSelectedItem().toString()),
              cusPays.get(jComboBoxCusPay.getSelectedItem().toString()),
              jTextFieldCusActivity.getText(),
              jTextFieldCusAccount.getText(),
              jTextFieldCusInfo.getText(),
              true);
      CustomerController.createCustomer(newCustomer);
      customer = new Customer(newCustomer);
      greenMessage(newCustomer.getCusName() + " werd Toegevoegd");
    }
    if (operation == CRUDOperationEnum.UPDATE) {
      final Customer newCustomer =
          new Customer(
              getCustomer().getIdCus(),
              jTextFieldCusName.getText(),
              jTextFieldCusVat.getText(),
              jTextFieldCusPhone.getText(),
              jTextFieldCusMobile.getText(),
              jTextFieldCusFax.getText(),
              jTextFieldCusemail.getText(),
              jTextFieldCusWebsite.getText(),
              cusTypes.get(jComboBoxCusType.getSelectedItem().toString()),
              cusCats.get(jComboBoxCusCat.getSelectedItem().toString()),
              cusLangs.get(jComboBoxCusLang.getSelectedItem().toString()),
              cusCurs.get(jComboBoxCusCur.getSelectedItem().toString()),
              cusPays.get(jComboBoxCusPay.getSelectedItem().toString()),
              jTextFieldCusActivity.getText(),
              jTextFieldCusAccount.getText(),
              jTextFieldCusInfo.getText(),
              true);

      if (!customer.equals(newCustomer)) {
        CustomerController.updateCustomer(newCustomer);
        customer = new Customer(newCustomer);
        greenMessage(newCustomer.getCusName() + " werd gewijzigd");
      }
    }
  }
Beispiel #2
0
  private void initializeFields() {
    jTextFieldCusWebsite.setText(customer.getCusWebsite());
    jTextFieldCusemail.setText(customer.getCusEMail());
    jTextFieldCusFax.setText(customer.getCusFax());
    jTextFieldCusMobile.setText(customer.getCusMobile());
    jTextFieldCusPhone.setText(customer.getCusPhone());
    jTextFieldCusVat.setText(customer.getCusVat());
    jTextFieldCusName.setText(customer.getCusName());
    jTextFieldCusActivity.setText(customer.getCusActivity());
    jTextFieldCusAccount.setText(customer.getCusAccount());
    jTextFieldCusInfo.setText(customer.getCusInfo());

    jComboBoxCusType.setSelectedItem(getSelectedItem(cusTypes, customer.getCusType()));
    jComboBoxCusCat.setSelectedItem(getSelectedItem(cusCats, customer.getCusClass()));
    jComboBoxCusLang.setSelectedItem(getSelectedItem(cusLangs, customer.getCusLang()));
    jComboBoxCusCur.setSelectedItem(getSelectedItem(cusCurs, customer.getCusCur()));
    jComboBoxCusPay.setSelectedItem(getSelectedItem(cusPays, customer.getCusPay()));
  }