Package com.jada.myaccount.shipinfo

Examples of com.jada.myaccount.shipinfo.MyAccountShipInfoActionForm


    public ActionForward start(ActionMapping actionMapping,
            ActionForm actionForm,
            HttpServletRequest request,
            HttpServletResponse response)
        throws Throwable {
      MyAccountShipInfoActionForm form = (MyAccountShipInfoActionForm) actionForm;
      ActionForward actionForward = actionMapping.findForward("success");
      Customer customer = getCustomer(request);
    String siteId = getContentBean(request).getContentSessionKey().getSiteId();

      customer = CustomerDAO.load(siteId, customer.getCustId());
      CustomerAddress billingAddress = getBillingAddress(customer);
      if (billingAddress != null) {
        form.setBillingCustPrefix(billingAddress.getCustPrefix());
        form.setBillingCustFirstName(billingAddress.getCustFirstName());
        form.setBillingCustMiddleName(billingAddress.getCustMiddleName());
        form.setBillingCustLastName(billingAddress.getCustLastName());
        form.setBillingCustSuffix(billingAddress.getCustSuffix());
        form.setBillingCustAddressLine1(billingAddress.getCustAddressLine1());
        form.setBillingCustAddressLine2(billingAddress.getCustAddressLine2());
        form.setBillingCustCityName(billingAddress.getCustCityName());
        form.setBillingCustStateCode(billingAddress.getCustStateCode());
        form.setBillingCustCountryCode(billingAddress.getCustCountryCode());
        form.setBillingCustZipCode(billingAddress.getCustZipCode());
        form.setBillingCustPhoneNum(billingAddress.getCustPhoneNum());
        form.setBillingCustFaxNum(billingAddress.getCustFaxNum());
      }
      CustomerAddress shippingAddress = getShippingAddress(customer);
      if (shippingAddress != null) {
        form.setShippingCustPrefix(shippingAddress.getCustPrefix());
        form.setShippingCustFirstName(shippingAddress.getCustFirstName());
        form.setShippingCustMiddleName(shippingAddress.getCustMiddleName());
        form.setShippingCustLastName(shippingAddress.getCustLastName());
        form.setShippingCustSuffix(shippingAddress.getCustSuffix());
        form.setShippingCustAddressLine1(shippingAddress.getCustAddressLine1());
        form.setShippingCustAddressLine2(shippingAddress.getCustAddressLine2());
        form.setShippingCustCityName(shippingAddress.getCustCityName());
        form.setShippingCustStateCode(shippingAddress.getCustStateCode());
        form.setShippingCustCountryCode(shippingAddress.getCustCountryCode());
        form.setShippingCustZipCode(shippingAddress.getCustZipCode());
        form.setShippingCustPhoneNum(shippingAddress.getCustPhoneNum());
        form.setShippingCustFaxNum(shippingAddress.getCustFaxNum());
      }
      else {
        form.setUseBilling(true);
      }
      initSearchInfo(form, siteId);
      createEmptySecureTemplateInfo(request);
        return actionForward;
    }
View Full Code Here


            HttpServletResponse response)
        throws Throwable {
     
    createEmptySecureTemplateInfo(request);
    String siteId = getContentBean(request).getContentSessionKey().getSiteId();
    MyAccountShipInfoActionForm form = (MyAccountShipInfoActionForm) actionForm;

      ActionMessages messages = validate(form);
      if (messages.size() > 0) {
          initSearchInfo(form, siteId);
      saveMessages(request, messages);
            ActionForward actionForward = actionMapping.findForward("error");
            return actionForward;
      }
     
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Customer customer = CustomerDAO.load(siteId, getCustomer(request).getCustId());
   
    customer.setRecUpdateBy(Constants.USERNAME_CUSTOMER);
    customer.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    em.persist(customer);
   
      CustomerAddress billingAddress = getBillingAddress(customer);
      if (billingAddress == null) {
        billingAddress = new CustomerAddress();
        billingAddress.setRecCreateBy(Constants.USERNAME_CUSTOMER);
        billingAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
        customer.getCustAddresses().add(billingAddress);
      }
      billingAddress.setCustPrefix(form.getBillingCustPrefix());
      billingAddress.setCustFirstName(form.getBillingCustFirstName());
      billingAddress.setCustMiddleName(form.getBillingCustMiddleName());
      billingAddress.setCustLastName(form.getBillingCustLastName());
      billingAddress.setCustSuffix(form.getBillingCustSuffix());
      billingAddress.setCustAddressType(Constants.CUSTOMER_ADDRESS_BILLING);
      billingAddress.setCustAddressLine1(form.getBillingCustAddressLine1());
      billingAddress.setCustAddressLine2(form.getBillingCustAddressLine2());
      billingAddress.setCustCityName(form.getBillingCustCityName());
      billingAddress.setCustStateCode(form.getBillingCustStateCode());
      billingAddress.setCustStateName(Utility.getStateName(siteId, form.getBillingCustStateCode()));
      billingAddress.setCustCountryCode(form.getBillingCustCountryCode());
      billingAddress.setCustCountryName(Utility.getCountryName(siteId, form.getBillingCustCountryCode()));
      billingAddress.setCustZipCode(form.getBillingCustZipCode());
      billingAddress.setCustPhoneNum(form.getBillingCustPhoneNum());
    billingAddress.setCustFaxNum(form.getBillingCustPhoneNum());
    billingAddress.setRecUpdateBy(Constants.USERNAME_CUSTOMER);
    billingAddress.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    if (billingAddress.getCustAddressId() == null) {
      em.persist(billingAddress);
    }
   
      CustomerAddress shippingAddress = getShippingAddress(customer);
      if (form.isUseBilling()) {
        if (shippingAddress != null) {
          customer.getCustAddresses().remove(shippingAddress);
          em.remove(shippingAddress);
        }
      }
      else {
          if (shippingAddress == null) {
            shippingAddress = new CustomerAddress();
            shippingAddress.setRecCreateBy(Constants.USERNAME_CUSTOMER);
            shippingAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
            customer.getCustAddresses().add(shippingAddress);
          }
          shippingAddress.setCustPrefix(form.getShippingCustPrefix());
          shippingAddress.setCustFirstName(form.getShippingCustFirstName());
          shippingAddress.setCustMiddleName(form.getShippingCustMiddleName());
          shippingAddress.setCustLastName(form.getShippingCustLastName());
          shippingAddress.setCustSuffix(form.getShippingCustSuffix());
          shippingAddress.setCustAddressType(Constants.CUSTOMER_ADDRESS_BILLING);
          shippingAddress.setCustAddressLine1(form.getShippingCustAddressLine1());
          shippingAddress.setCustAddressLine2(form.getShippingCustAddressLine2());
          shippingAddress.setCustCityName(form.getShippingCustCityName());
          shippingAddress.setCustStateCode(form.getShippingCustStateCode());
          shippingAddress.setCustStateName(Utility.getStateName(siteId, form.getShippingCustStateCode()));
          shippingAddress.setCustCountryCode(form.getShippingCustCountryCode());
          shippingAddress.setCustCountryName(Utility.getCountryName(siteId, form.getShippingCustCountryCode()));
          shippingAddress.setCustZipCode(form.getShippingCustZipCode());
          shippingAddress.setCustPhoneNum(form.getShippingCustPhoneNum());
        shippingAddress.setCustFaxNum(form.getShippingCustPhoneNum());
        shippingAddress.setRecUpdateBy(Constants.USERNAME_CUSTOMER);
        shippingAddress.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        if (shippingAddress.getCustAddressId() == null) {
          em.persist(shippingAddress);
        }
View Full Code Here

TOP

Related Classes of com.jada.myaccount.shipinfo.MyAccountShipInfoActionForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.