use of eu.ggnet.dwoss.customer.ee.priv.OldCustomer in project dwoss by gg-net.
the class CustomerServiceSimpleSearchIT method testFind.
@Test
public void testFind() {
OldCustomer c1 = new OldCustomer("Die Firma", "Herr", "Max", "Mustermann", "Keine Bemerkungen", "Helle Strasse 22", "12345", "Musterhausen");
OldCustomer c2 = new OldCustomer(null, "Frau", "Marria", "Mustermann", "Grosse Tüten", "Dunkle Allee 7", "12345", "Musterhausen", "Dünne Gasse 2", "22222", "Wolfsstaaad");
c2.setPaymentMethod(PaymentMethod.DIRECT_DEBIT);
c2.addFlag(CustomerFlag.CONFIRMS_DOSSIER);
c1.setPaymentCondition(PaymentCondition.CUSTOMER);
// by pp
OldCustomer c3 = new OldCustomer("Schlagstock Ltd.", "Herr", "Michael", "Wankelmeier", "Bloß freundlich sein !!!", "Adamsweg 3", "00666", "Eisenhüttenstadt");
c3.addFlag(CustomerFlag.CONFIRMS_DOSSIER);
c3.addFlag(CustomerFlag.CONFIRMED_CASH_ON_DELIVERY);
c3.setPaymentMethod(PaymentMethod.CASH_ON_DELIVERY);
c3.setAllowedSalesChannels(EnumSet.of(SalesChannel.CUSTOMER, SalesChannel.RETAILER));
c3.setPaymentCondition(PaymentCondition.DEALER_3_PERCENT_DISCOUNT);
c3.setShippingCondition(ShippingCondition.DEALER_ONE);
OldCustomer c4 = new OldCustomer(null, "Frau", "Lisa", "Lüstling", null, "Freie Straße 2", "98745", "Heimwehrhausen", "Dünne Gasse 2", "22222", "Heimwehrhausen");
c4.addFlag(CustomerFlag.CONFIRMS_DOSSIER);
c4.setAllowedSalesChannels(EnumSet.of(SalesChannel.CUSTOMER));
c4.setPaymentCondition(PaymentCondition.EMPLOYEE);
c4.setShippingCondition(ShippingCondition.DEALER_ONE);
c4.setPaymentMethod(PaymentMethod.INVOICE);
c4.setEmail("lisa@xxx.com");
// --------
agent.store(c1);
agent.store(c2);
agent.store(c3);
agent.store(c4);
assertEquals("Finding all Customers", 4, eao.findAll().size());
List<UiCustomer> asUiCustomers = customerService.asUiCustomers("Die Firma", null, "", " ", true);
assertThat(asUiCustomers).hasSize(1);
L.info("Y(" + asUiCustomers.size() + "):" + asUiCustomers);
asUiCustomers = customerService.asUiCustomers("Die Fi", "Max", "", " ", true);
L.info("Y(" + asUiCustomers.size() + "):" + asUiCustomers);
asUiCustomers = customerService.asUiCustomers("Die Fi", "Max", "Muster", " ", true);
L.info("Y(" + asUiCustomers.size() + "):" + asUiCustomers);
asUiCustomers = customerService.asUiCustomers("Die Fi", "Moritz", "", " ", true);
L.info("N(" + asUiCustomers.size() + "):" + asUiCustomers);
asUiCustomers = customerService.asUiCustomers("Die Fi", null, "", " ", false);
L.info("N(" + asUiCustomers.size() + "):" + asUiCustomers);
asUiCustomers = customerService.asUiCustomers("Die Fam", null, "", " ", true);
L.info("N(" + asUiCustomers.size() + "):" + asUiCustomers);
asUiCustomers = customerService.asUiCustomers(null, null, null, "lisa", true);
L.info("Y(" + asUiCustomers.size() + "):" + asUiCustomers);
assertEquals("Finding all Customers", 4, customerService.asUiCustomers(null, null, "", " ", true).size());
assertEquals(1, customerService.asUiCustomers("Die Firma", null, null, null, true).size());
assertEquals(1, customerService.asUiCustomers("Schla", null, null, null, true).size());
assertEquals(1, customerService.asUiCustomers(null, "Mic", null, null, true).size());
assertEquals(3, customerService.asUiCustomers(null, "M", null, null, true).size());
}
use of eu.ggnet.dwoss.customer.ee.priv.OldCustomer in project dwoss by gg-net.
the class CustomerCreateWithSearchController method selectCustomer.
/**
* Handles a new selection in the SearchResult of the View.
*
* @param customerId the id of the customer that is selected
*/
public void selectCustomer(long customerId) {
OldCustomer existingCustomer = Dl.remote().lookup(OldCustomerAgent.class).findById(customerId);
view.setCustomer(existingCustomer);
setCustomer(existingCustomer);
}
use of eu.ggnet.dwoss.customer.ee.priv.OldCustomer in project dwoss by gg-net.
the class CustomerEditView method setCustomer.
public void setCustomer(OldCustomer customer) {
OldCustomer oldCustomer = this.customer;
this.customer = customer;
this.original = new OldCustomer(customer);
firePropertyChange("customer", oldCustomer, customer);
reteilerChannelAllowedCheck.setSelected(customer.getAllowedSalesChannels().contains(SalesChannel.RETAILER));
endUserChannelAllowedCheck.setSelected(customer.getAllowedSalesChannels().contains(SalesChannel.CUSTOMER));
isSystemCustomerCheck.setSelected(customer.getFlags().contains(CustomerFlag.SYSTEM_CUSTOMER));
titleBox.setSelectedItem(customer.getTitel() != null ? customer.getTitel() : null);
payCountryBox.setSelectedItem(customer.getPayCountry());
shipCountryBox.setSelectedItem(customer.getPayCountry());
ledgerField.setText(Integer.toString(customer.getLedger()));
taxIdField.setText(customer.getTaxId());
customerFlagsModel.setMarked(customer.getFlags());
}
use of eu.ggnet.dwoss.customer.ee.priv.OldCustomer in project dwoss by gg-net.
the class OldCustomerUpi method updateCustomer.
@Override
public boolean updateCustomer(UiParent parent, long customerId) {
OldCustomer customer = Dl.remote().lookup(OldCustomerAgent.class).findById(customerId);
CustomerEditView ec = new CustomerEditView();
ec.setCustomer(customer);
// HINT: This was RedTapeView as parrent. If users complain about the location of create customer, add it to Workspace or else.
OkCancelDialog<CustomerEditView> dialog = new OkCancelDialog<>(SwingCore.windowAncestor(Optional.ofNullable(parent).map(UiParent::swingOrMain).orElse(null)).orElse(SwingCore.mainFrame()), Dialog.ModalityType.DOCUMENT_MODAL, "Kunden editieren", ec);
dialog.setVisible(true);
boolean changed = false;
if (dialog.getCloseType() == CloseType.OK) {
Dl.remote().lookup(OldCustomerAgent.class).store(ec.getCustomer());
for (AddressChange addressChange : ec.getChangedAdresses()) {
if (JOptionPane.showOptionDialog(dialog, "Adresse wurde geändert, soll diese Änderung an allen Dokumenten des Kunden übernommen werden?", "Adressänderung", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null) == JOptionPane.YES_OPTION) {
Dl.remote().lookup(AddressService.class).notifyAddressChange(addressChange);
}
changed = true;
}
}
return changed;
}
use of eu.ggnet.dwoss.customer.ee.priv.OldCustomer in project dwoss by gg-net.
the class CustomerCreateWithSearchView method initCustomer.
private void initCustomer() {
// FIXME: This is not perfect. Better use the CustomerCreateModel and set the customer there. Works for now.
OldCustomer customer = new OldCustomer();
customerDetails.setCustomer(customer);
if (controller != null)
controller.setCustomer(customer);
}
Aggregations