Package com.alexnevsky.hotel.dao

Examples of com.alexnevsky.hotel.dao.OrderDAO


        + this.toString() + ". RemoteAddr: " + request.getRemoteAddr());

    try {
      AbstractDAOFactory daoFactory = Controller.getDAOFactory();

      OrderDAO orderDAO = daoFactory.getOrderDAO();

      Order order = null;
      order = orderDAO.find(orderId);

      logger.info("Admin '" + request.getSession().getAttribute(AttributesManager.PARAM_NAME_LOGIN)
          + "'. Change order status to '" + OrderStatusEnum.CANCELLED.toString() + "' for '" + order + "'"
          + ". RemoteAddr: " + request.getRemoteAddr());

      orderDAO.update(OrderStatusEnum.CANCELLED, orderId);

      request.setAttribute(AttributesManager.ATTRIBUTE_RESULT, MessageManager.RESULT_CANCEL_ORDER_MESSAGE);

    } catch (DAOException ex) {
      logger.error(ex, ex);
View Full Code Here


        + "'. Execute " + this.toString() + ". RemoteAddr: " + request.getRemoteAddr());

    try {
      AbstractDAOFactory daoFactory = Controller.getDAOFactory();

      OrderDAO orderDAO = daoFactory.getOrderDAO();
      Customer customer = (Customer) request.getSession().getAttribute(AttributesManager.ATTRIBUTE_CUSTOMER);

      Order order = null;
      order = orderDAO.find(orderId);

      if (customer.getId().compareTo(order.getCustomerId()) == 0
          && OrderStatusEnum.UNCHECKED.equals(order.getOrderStatus())) {
        orderDAO.update(OrderStatusEnum.CANCELLED, orderId);

        logger.info("Customer '" + request.getSession().getAttribute(AttributesManager.PARAM_NAME_LOGIN)
            + "'. Change order status to '" + OrderStatusEnum.CANCELLED + "' for '" + order + "'"
            + ". RemoteAddr: " + request.getRemoteAddr());
      } else {
View Full Code Here

        + "'. Execute " + this.toString() + ". RemoteAddr: " + request.getRemoteAddr());

    try {
      AbstractDAOFactory daoFactory = Controller.getDAOFactory();

      OrderDAO orderDAO = daoFactory.getOrderDAO();
      Customer customer = (Customer) request.getSession().getAttribute(AttributesManager.ATTRIBUTE_CUSTOMER);

      Order order = null;
      order = orderDAO.find(orderId);

      if (customer.getId().compareTo(order.getCustomerId()) == 0) {
        Boolean viewBillsList = true;
        request.setAttribute(AttributesManager.ATTRIBUTE_VIEW_BILLS_LIST, viewBillsList);
        request.setAttribute(AttributesManager.PARAM_NAME_ORDER_ID, orderId);
View Full Code Here

        + this.toString() + ". RemoteAddr: " + request.getRemoteAddr());

    try {
      AbstractDAOFactory daoFactory = Controller.getDAOFactory();

      OrderDAO orderDAO = daoFactory.getOrderDAO();
      FormDAO formDAO = daoFactory.getFormDAO();

      Order order = null;
      order = orderDAO.find(orderId);

      Form form = null;
      form = formDAO.find(order.getFormId());

      logger.info("Admin '" + request.getSession().getAttribute(AttributesManager.PARAM_NAME_LOGIN)
          + "'. Delete '" + order + "'" + " and '" + form + "'" + ". RemoteAddr: " + request.getRemoteAddr());

      orderDAO.delete(order);
      formDAO.delete(form);

      request.setAttribute(AttributesManager.ATTRIBUTE_RESULT, MessageManager.RESULT_DELETE_ORDER_MESSAGE);

    } catch (DAOException ex) {
View Full Code Here

        + this.toString() + ". RemoteAddr: " + request.getRemoteAddr());

    try {
      AbstractDAOFactory daoFactory = Controller.getDAOFactory();

      OrderDAO orderDAO = daoFactory.getOrderDAO();
      FormDAO formDAO = daoFactory.getFormDAO();
      RoomDAO roomDAO = daoFactory.getRoomDAO();

      Order order = null;
      order = orderDAO.find(orderId);

      Form form = null;
      form = formDAO.find(formId);

      Room room = null;
      room = roomDAO.find(roomId);

      Double amount = null;
      if (form != null && room != null) {
        amount = room.getNightPrice() * form.getNights();
        orderDAO.update(roomId, amount, order.getId());
        orderDAO.update(OrderStatusEnum.CHECKED, order.getId());
      }

      request.setAttribute(AttributesManager.ATTRIBUTE_RESULT, MessageManager.RESULT_SELECT_ROOM_MESSAGE);

    } catch (DAOException ex) {
View Full Code Here

      Order order = new Order();
      order.setCustomerId(customer.getId());
      order.setFormId(form.getId());

      OrderDAO orderDAO = daoFactory.getOrderDAO();
      try {
        orderDAO.create(order);
      } catch (IllegalArgumentException ex) {
        logger.error(ex, ex);
      }

      logger.info("User '" + request.getSession().getAttribute(AttributesManager.PARAM_NAME_LOGIN) + "'. "
View Full Code Here

    request.setAttribute(AttributesManager.ATTRIBUTE_VIEW_FREE_ROOMS_LIST, viewFreeRoomList);

    try {
      AbstractDAOFactory daoFactory = Controller.getDAOFactory();

      OrderDAO orderDAO = daoFactory.getOrderDAO();
      FormDAO formDAO = daoFactory.getFormDAO();

      Order order = null;
      order = orderDAO.find(orderId);

      Form form = null;
      form = formDAO.find(order.getFormId());

      request.getSession().setAttribute(AttributesManager.PARAM_NAME_ORDER_ID, order.getId());
View Full Code Here

        + "'. Execute " + this.toString() + ". RemoteAddr: " + request.getRemoteAddr());

    try {
      AbstractDAOFactory daoFactory = Controller.getDAOFactory();

      OrderDAO orderDAO = daoFactory.getOrderDAO();
      FormDAO formDAO = daoFactory.getFormDAO();
      Customer customer = (Customer) request.getSession().getAttribute(AttributesManager.ATTRIBUTE_CUSTOMER);

      Order order = null;
      order = orderDAO.find(orderId);

      Form form = null;
      form = formDAO.find(order.getFormId());

      if (customer.getId().compareTo(order.getCustomerId()) == 0
          && OrderStatusEnum.CANCELLED.equals(order.getOrderStatus())) {
        logger.info("Customer '" + request.getSession().getAttribute(AttributesManager.PARAM_NAME_LOGIN)
            + "'. Delete '" + order + "'" + " and '" + form + "'" + ". RemoteAddr: "
            + request.getRemoteAddr());
        orderDAO.delete(order);
        formDAO.delete(form);
      } else {
        logger.warn("Customer '" + request.getSession().getAttribute(AttributesManager.PARAM_NAME_LOGIN)
            + "'. Trying to delete not own order '" + orderId + "'" + ". RemoteAddr: "
            + request.getRemoteAddr());
View Full Code Here

    List<Room> freeRoomList = null;

    try {
      AbstractDAOFactory daoFactory = Controller.getDAOFactory();

      OrderDAO orderDAO = daoFactory.getOrderDAO();
      FormDAO formDAO = daoFactory.getFormDAO();
      CustomerDAO customerDAO = daoFactory.getCustomerDAO();
      RoomDAO roomDAO = daoFactory.getRoomDAO();
      CreditCardDAO creditCardDAO = daoFactory.getCreditCardDAO();

      order = orderDAO.find(this.orderId);
      form = formDAO.find(order.getFormId());

      freeRoomList = this.getFreeRooms(form);

      customer = customerDAO.find(order.getCustomerId());
View Full Code Here

  private List<Room> getFreeRooms(Form form) throws DAOException {
    List<Room> freeRoomList = null;

    AbstractDAOFactory daoFactory = Controller.getDAOFactory();

    OrderDAO orderDAO = daoFactory.getOrderDAO();
    FormDAO formDAO = daoFactory.getFormDAO();
    RoomDAO roomDAO = daoFactory.getRoomDAO();

    Date arrival = form.getArrival();
    Integer nights = form.getNights();
    Date departure = this.getDepartureDate(arrival, nights);

    Integer adult = form.getAdult();
    Integer child = form.getChild();
    RoomClassEnum roomClass = form.getRoomClass();

    List<Room> roomParamList = null;
    roomParamList = roomDAO.list(adult, child, roomClass);

    List<Room> notFreeRoomList = new ArrayList<Room>();

    for (Room room : roomParamList) {
      List<Order> orderWithParamRoomList = null;
      orderWithParamRoomList = orderDAO.listWhereRoomAndStatus(room.getId(), OrderStatusEnum.CHECKED);

      for (Order orderTmp : orderWithParamRoomList) {
        Form formTmp = null;
        formTmp = formDAO.find(orderTmp.getFormId());
View Full Code Here

TOP

Related Classes of com.alexnevsky.hotel.dao.OrderDAO

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.