Search in sources :

Example 1 with OrderImpl

use of org.olat.resource.accesscontrol.model.OrderImpl in project OpenOLAT by OpenOLAT.

the class ACOrderDAO method createOrder.

public OrderImpl createOrder(Identity delivery) {
    OrderImpl order = new OrderImpl();
    Date now = new Date();
    order.setLastModified(now);
    order.setCreationDate(now);
    order.setDelivery(delivery);
    order.setOrderStatus(OrderStatus.NEW);
    dbInstance.getCurrentEntityManager().persist(order);
    return order;
}
Also used : OrderImpl(org.olat.resource.accesscontrol.model.OrderImpl) Date(java.util.Date)

Example 2 with OrderImpl

use of org.olat.resource.accesscontrol.model.OrderImpl in project OpenOLAT by OpenOLAT.

the class ACOrderDAO method saveOneClick.

public Order saveOneClick(Identity delivery, OfferAccess link, OrderStatus status) {
    OrderImpl order = createOrder(delivery);
    order.setOrderStatus(status);
    if (link.getOffer().getPrice().isEmpty()) {
        order.setCurrencyCode("CHF");
    } else {
        order.setCurrencyCode(link.getOffer().getPrice().getCurrencyCode());
    }
    OrderPartImpl part = new OrderPartImpl();
    part.setCreationDate(new Date());
    order.getParts().add(part);
    OrderLineImpl line = createOrderLine(link.getOffer());
    part.getOrderLines().add(line);
    order.recalculate();
    dbInstance.getCurrentEntityManager().persist(order);
    dbInstance.getCurrentEntityManager().persist(part);
    dbInstance.getCurrentEntityManager().persist(line);
    return order;
}
Also used : OrderLineImpl(org.olat.resource.accesscontrol.model.OrderLineImpl) OrderImpl(org.olat.resource.accesscontrol.model.OrderImpl) OrderPartImpl(org.olat.resource.accesscontrol.model.OrderPartImpl) Date(java.util.Date)

Example 3 with OrderImpl

use of org.olat.resource.accesscontrol.model.OrderImpl in project openolat by klemens.

the class ACOrderDAO method createOrder.

public OrderImpl createOrder(Identity delivery) {
    OrderImpl order = new OrderImpl();
    Date now = new Date();
    order.setLastModified(now);
    order.setCreationDate(now);
    order.setDelivery(delivery);
    order.setOrderStatus(OrderStatus.NEW);
    dbInstance.getCurrentEntityManager().persist(order);
    return order;
}
Also used : OrderImpl(org.olat.resource.accesscontrol.model.OrderImpl) Date(java.util.Date)

Example 4 with OrderImpl

use of org.olat.resource.accesscontrol.model.OrderImpl in project openolat by klemens.

the class ACOrderDAO method saveOneClick.

public Order saveOneClick(Identity delivery, OfferAccess link, OrderStatus status) {
    OrderImpl order = createOrder(delivery);
    order.setOrderStatus(status);
    if (link.getOffer().getPrice().isEmpty()) {
        order.setCurrencyCode("CHF");
    } else {
        order.setCurrencyCode(link.getOffer().getPrice().getCurrencyCode());
    }
    OrderPartImpl part = new OrderPartImpl();
    part.setCreationDate(new Date());
    order.getParts().add(part);
    OrderLineImpl line = createOrderLine(link.getOffer());
    part.getOrderLines().add(line);
    order.recalculate();
    dbInstance.getCurrentEntityManager().persist(order);
    dbInstance.getCurrentEntityManager().persist(part);
    dbInstance.getCurrentEntityManager().persist(line);
    return order;
}
Also used : OrderLineImpl(org.olat.resource.accesscontrol.model.OrderLineImpl) OrderImpl(org.olat.resource.accesscontrol.model.OrderImpl) OrderPartImpl(org.olat.resource.accesscontrol.model.OrderPartImpl) Date(java.util.Date)

Aggregations

Date (java.util.Date)4 OrderImpl (org.olat.resource.accesscontrol.model.OrderImpl)4 OrderLineImpl (org.olat.resource.accesscontrol.model.OrderLineImpl)2 OrderPartImpl (org.olat.resource.accesscontrol.model.OrderPartImpl)2