public void saveHeader() throws Exception { EntityManager em = JpaConnection.getInstance().getCurrentEntityManager(); String userId = user == null ? Constants.USERNAME_SYSTEM : user.getUserId(); Date current = new Date(); if (isNew) { orderHeader.setOrderNum( generateNumber(orderHeader.getSiteDomain().getSite(), Constants.SEQUENCE_ORDER)); orderHeader.setRecCreateBy(userId); orderHeader.setRecCreateDatetime(current); orderHeader.setOrderStatus(Constants.ORDERSTATUS_OPEN); } orderHeader.setRecUpdateBy(userId); orderHeader.setRecUpdateDatetime(current); if (orderHeader.getOrderHeaderId() == null) { em.persist(orderHeader); } isNew = false; }
public OrderHeader clone(OrderHeader header) { OrderHeader orderHeader = new OrderHeader(); orderHeader.setOrderHeaderId(header.getOrderHeaderId()); orderHeader.setOrderNum(header.getOrderNum()); orderHeader.setCustEmail(header.getCustEmail()); orderHeader.setShippingTotal(header.getShippingTotal()); orderHeader.setShippingDiscountTotal(header.getShippingDiscountTotal()); orderHeader.setOrderTotal(header.getOrderTotal()); orderHeader.setPaymentGatewayProvider(header.getPaymentGatewayProvider()); orderHeader.setCreditCardDesc(header.getCreditCardDesc()); orderHeader.setCustCreditCardNum(header.getCustCreditCardNum()); orderHeader.setShippingMethodName(header.getShippingMethodName()); orderHeader.setOrderStatus(header.getOrderStatus()); orderHeader.setOrderDate(header.getOrderDate()); orderHeader.setRecUpdateBy(header.getRecUpdateBy()); orderHeader.setRecUpdateDatetime(header.getRecUpdateDatetime()); orderHeader.setRecCreateBy(header.getRecCreateBy()); orderHeader.setRecCreateDatetime(header.getRecCreateDatetime()); orderHeader.setSiteDomain(header.getSiteDomain()); orderHeader.setSiteProfile(header.getSiteProfile()); orderHeader.setSiteCurrency(header.getSiteCurrency()); return orderHeader; }