Package com.alexnevsky.hotel.model

Examples of com.alexnevsky.hotel.model.Customer


    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 + "'"
View Full Code Here


    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);
      } else {
        logger.warn("Customer '" + request.getSession().getAttribute(AttributesManager.PARAM_NAME_LOGIN)
View Full Code Here

   *             If something fails at database level.
   */
  public Customer getCustomer(String login, String password) throws DAOException {
    AbstractDAOFactory daoFactory = Controller.getDAOFactory();
    CustomerAccount customerAccount = daoFactory.getCustomerAccountDAO().find(login, password);
    Customer customer = daoFactory.getCustomerDAO().find(customerAccount.getId());
    return customer;
  }
View Full Code Here

        formDAO.create(form);
      } catch (IllegalArgumentException ex) {
        logger.error(ex, ex);
      }

      Customer customer = (Customer) request.getSession().getAttribute(AttributesManager.ATTRIBUTE_CUSTOMER);

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

      OrderDAO orderDAO = daoFactory.getOrderDAO();
      try {
        orderDAO.create(order);
View Full Code Here

    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);
View Full Code Here

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

    Boolean viewOrdersCustomerList = true;
    request.setAttribute(AttributesManager.ATTRIBUTE_VIEW_ORDERS_CUSTOMER_LIST, viewOrdersCustomerList);

    Customer customer = (Customer) request.getSession().getAttribute(AttributesManager.ATTRIBUTE_CUSTOMER);
    request.setAttribute(AttributesManager.ATTRIBUTE_CUSTOMER_ID, customer.getId());

    page = ConfigurationManager.getInstance().getProperty(ConfigurationManager.ORDERS_PAGE_PATH);

    return page;
  }
View Full Code Here

  }

  private String getData() {
    String dataToView = null;

    Customer customer = null;
    CreditCard creditCard = null;
    Order order = null;
    Form form = null;
    Room orderRoom = null;
    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());
      creditCard = creditCardDAO.find(customer.getCreditCardNumber());

      Long orderRoomId = order.getRoomId();

      Long formId = order.getFormId();
      form = formDAO.find(formId);
View Full Code Here

  private String getData() {
    String dataToView = null;

    Order order = null;
    Form form = null;
    Customer customer = null;

    try {
      AbstractDAOFactory daoFactory = Controller.getDAOFactory();

      OrderDAO orderDAO = daoFactory.getOrderDAO();
View Full Code Here

      CreditCardDAO creditCardDAO = daoFactory.getCreditCardDAO();

      List<Order> orderList = null;
      orderList = orderDAO.list();

      Customer customer = null;
      CreditCard creditCard = null;
      Form form = null;
      Room room = null;

      for (Order order : orderList) {
        customer = customerDAO.find(order.getCustomerId());
        creditCard = creditCardDAO.find(customer.getCreditCardNumber());

        Long orderRoomId = order.getRoomId();
        Long formId = order.getFormId();
        form = formDAO.find(formId);
        room = roomDAO.find(orderRoomId);
View Full Code Here

   */
  private Customer find(String sql, Object... values) throws DAOException {
    Connection connection = null;
    PreparedStatement preparedStatement = null;
    ResultSet resultSet = null;
    Customer customer = null;

    try {
      connection = this.daoFactory.getConnection();
      preparedStatement = prepareStatement(connection, sql, false, values);
      resultSet = preparedStatement.executeQuery();
View Full Code Here

TOP

Related Classes of com.alexnevsky.hotel.model.Customer

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.