%-- welcome.jsp Alan Pinder - April 14th 2005 This is the welcome/index page. It's the first page the user sees This page shows the user's private messages. From here they can compose new messages, view their messages, and delete them. Classes Used: None Attributes Used: None Parameters Get: loginMessage - Message to display --%> <%-- Standard page declarations --%> <%@ page import="apz.db.*" %> <%@ page session="true" %> <%@ page errorPage="error.jsp" %> <%-- Static function to generate a human-readable status from the order object--%> <%! private static String parseOrderStatus(DbUser.Order pOrder) throws DbException { // Check the order item ID points to a valid item // If it doesn't throw an error // ^^ Means bad stuff happened DbItem pItem = DB.getItem(pOrder.getItemID()); if (pItem == null) throw new DbItemNotFoundException(pOrder.getItemID()); // Create the string and return it String tempString = "Your order of " + pOrder.getQuantity() + " x " + pItem.getName() + " is currently "; if (pOrder.getOrderStatus() == DbConstants.OrderStatus.COMPLETED) tempString += "completed. You should have recieved the item(s)"; if (pOrder.getOrderStatus() == DbConstants.OrderStatus.PLACED) tempString += "being processed by our computers"; if (pOrder.getOrderStatus() == DbConstants.OrderStatus.PROCESSING) tempString += "being processed by our sales team"; if (pOrder.getOrderStatus() == DbConstants.OrderStatus.WAREHOUSE) tempString += "being stored in our warehouse awaiting despatch"; if (pOrder.getOrderStatus() == DbConstants.OrderStatus.TRANSIT) tempString += "in transit. You should recieve the item(s) soon"; return tempString; } %> <%-- Start of main page --%> <% // Global (to page) object references // Please note these are only meaningful if the user is logged-in DbUser currentUser = null; DbUser.Order[] currentOrders = null; // Check whether use is logged in/not boolean isActive = (session.getAttribute("isActive") != null); if (isActive) { // Load user from session currentUser = (DbUser)session.getAttribute("userObject"); // Read outstanding orders currentOrders = currentUser.getOrders(); } %>
|
|
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
|   | ||||||||||||||||||||||||||||||||