Package simon.entities

Examples of simon.entities.Order


        basket for the user.  The condition check occurs because this servlet is called every time the user
        visits the homepage, thus displaying five different random films each time - the code should not
        remove all items out of the basket on each visit to the homepage.
        */
        if (request.getSession().getAttribute("order") == null) {
            request.getSession().setAttribute("order", new Order());
        }

        //forward the user onto the homepage to homepage JSP to display the results
        RequestDispatcher view = request.getRequestDispatcher("amazune.jsp");
        view.forward(request, response);
View Full Code Here


 
        //retrieve the orders session attributes - this contains all order for the customer, or all orders
  //from all customers if the admin has executed the function.
  ArrayList<Order> orders = (ArrayList<Order>) request.getSession().getAttribute("previousOrders");
        //find the order that matches the provided order number
  Order order = null;
        for (Order o : orders) {
            if (o.getOrderNo() == orderNo) {
                order = o;
            }
        }

  //try to cancel the order only if the username is the same as in the order number or the user is admin
  //also only cancel if the dispatch date is null
        Boolean result = false;
        if ((customerUsername.equals(order.getUsername()) || customerUsername.equals("admin"))
    && order.getDispatchDate() == null) {
            try {
                result = orderEjb.DeleteOrder(dbUrl, dbUsername, dbPassword, order);
            } catch (Exception ex) {
                throw new ServletException(ex);
            }
View Full Code Here

                Boolean orderCreated = false;
                Timestamp orderDate = new Timestamp(new Date().getTime()); //record the current time

                //retrieve the order object stored as a session attribute
                //store the current time as the order date
                Order order = (Order) request.getSession().getAttribute("order");
                order.setOrderDate(orderDate);

                //store the order in the MySQL database
                try {
                    orderCreated = orderEjb.CreateOrder(dbUrl,
                            dbUsername,
                            dbPassword,
                            customerUsername,
                            order);
                } catch (Exception ex) {
                    //allow exceptions to bubble up to the calling method, so they are displayed to the user
                    throw new ServletException(ex);
                }
               
                //display a completion message to the user if the database insertion was successfull
                if (orderCreated) {
                    request.getSession().setAttribute("order", new Order());
                    RequestDispatcher view = request.getRequestDispatcher("/user/orderCompleted.jsp");
                    view.forward(request, response);
                } else {
                    //display an error message if there was a problem adding the order to the database
                    request.setAttribute("error", "stockError");
View Full Code Here

                    Integer orderNumber = rs.getInt("orderNumber");
                    Timestamp datePlaced = rs.getTimestamp("datePlaced");
                    Timestamp dateDispatched = rs.getTimestamp("dateDispatched");
                    String username = rs.getString("customerUsername");
                    ArrayList<OrderLine> dvds = getOrderDetails(dbUrl, dbUsername, dbPassword, orderNumber);
                    results.add(new Order(dvds, datePlaced, dateDispatched, orderNumber, username));
                }
            }
        }
        return results; //the list is returned
    }
View Full Code Here

TOP

Related Classes of simon.entities.Order

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.