Search in sources :

Example 6 with OldCustomer

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());
}
Also used : OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer) UiCustomer(eu.ggnet.dwoss.customer.opi.UiCustomer) Test(org.junit.Test)

Example 7 with OldCustomer

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);
}
Also used : OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer) OldCustomerAgent(eu.ggnet.dwoss.customer.ee.priv.OldCustomerAgent)

Example 8 with OldCustomer

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());
}
Also used : OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer)

Example 9 with OldCustomer

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;
}
Also used : OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer) OldCustomerAgent(eu.ggnet.dwoss.customer.ee.priv.OldCustomerAgent) AddressService(eu.ggnet.dwoss.customer.opi.AddressService) AddressChange(eu.ggnet.dwoss.event.AddressChange) OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) UiParent(eu.ggnet.saft.core.ui.UiParent)

Example 10 with OldCustomer

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);
}
Also used : OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer)

Aggregations

OldCustomer (eu.ggnet.dwoss.customer.ee.priv.OldCustomer)11 Customer (eu.ggnet.dwoss.customer.ee.entity.Customer)3 OldCustomerAgent (eu.ggnet.dwoss.customer.ee.priv.OldCustomerAgent)3 UiCustomer (eu.ggnet.dwoss.customer.opi.UiCustomer)2 OkCancelDialog (eu.ggnet.dwoss.util.OkCancelDialog)2 Test (org.junit.Test)2 AbstractGuardian (eu.ggnet.dwoss.common.AbstractGuardian)1 CustomerGenerator (eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator)1 MandatorMetadata (eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata)1 AddressService (eu.ggnet.dwoss.customer.opi.AddressService)1 CustomerMetaData (eu.ggnet.dwoss.customer.opi.CustomerMetaData)1 CustomerService (eu.ggnet.dwoss.customer.opi.CustomerService)1 CustomerCreateWithSearchController (eu.ggnet.dwoss.customer.ui.old.CustomerCreateWithSearchController)1 CustomerCreateWithSearchView (eu.ggnet.dwoss.customer.ui.old.CustomerCreateWithSearchView)1 AddressChange (eu.ggnet.dwoss.event.AddressChange)1 Mandators (eu.ggnet.dwoss.mandator.Mandators)1 DefaultCustomerSalesdata (eu.ggnet.dwoss.mandator.api.value.DefaultCustomerSalesdata)1 GeneratedAddress (eu.ggnet.dwoss.util.gen.GeneratedAddress)1 AuthenticationException (eu.ggnet.saft.core.auth.AuthenticationException)1 UiParent (eu.ggnet.saft.core.ui.UiParent)1