Examples of Room


Examples of edu.drexel.cs544.mcmuc.channels.Room

                message = m;
            }

            public void run() {
                if (message.hasKey()) {
                    Room r = (Room) channel;
                    Certificate privateKey = r.getKeyPairs().get(message.getKey());
                    if (privateKey != null)
                        message.decryptBody(privateKey);
                }
                if (message.hasTo()) {
                    Room r = (Room) channel;
                    if (r.getUserName().equals(message.getTo()))
                        Controller.getInstance().output(message.getFrom() + "@" + ((Room) channel).getName() + " (private): " + message.getBody() + " (" + message.getUID() + ")");
                } else
                    Controller.getInstance().output(message.getFrom() + "@" + ((Room) channel).getName() + ": " + message.getBody() + " (" + message.getUID() + ")");
                channel.send(message);
            }
View Full Code Here

Examples of edu.drexel.cs544.mcmuc.channels.Room

                message = m;
            }

            public void run() {
                if (message.hasKey()) {
                    Room r = (Room) channel;
                    Certificate privateKey = r.getKeyPairs().get(message.getKey());
                    if (privateKey != null)
                        message.decryptBody(privateKey);
                }
                if (message.hasTo()) {
                    Room r = (Room) channel;
                    if (r.getUserName().equals(message.getTo()))
                        Controller.getInstance().output(message.getFrom() + "@" + ((Room) channel).getName() + " (private): " + message.getBody() + " (" + message.getUID() + ")");
                } else
                    Controller.getInstance().output(message.getFrom() + "@" + ((Room) channel).getName() + ": " + message.getBody() + " (" + message.getUID() + ")");
                channel.send(message);
            }
View Full Code Here

Examples of hotel.model.Room

    String roomid = request.getParameter("roomid");
    Float price = Misc.toFloat(request.getParameter("price"), 0);
    int beds = Misc.toInt(request.getParameter("beds"), 0);
    int styles = Misc.toInt(request.getParameter("styles"), 0);
    if (null == proomid) {
      Room r = roomService.getRoom(roomid);
      request.setAttribute("room", r);
      return "managerupdate";
    }
    Room room = new Room();
    room.setRoomid(roomid);
    room.setPrice(price);
    room.setBeds(beds);
    room.setStyles(styles);
    if (roomService.updateRoom(proomid, room))
      request.setAttribute("errMsg", "房间信息修改成功!");
    else
      request.setAttribute("errMsg", "房间信息修改失败!");
    return managerroom(request);
View Full Code Here

Examples of hotel.model.Room

    int beds = Misc.toInt(request.getParameter("beds"), 0);
    int styles = Misc.toInt(request.getParameter("styles"), 0);
    if (null == roomid) {
      return "managercreate";
    }
    Room room = new Room();
    room.setRoomid(roomid);
    room.setPrice(price);
    room.setBeds(beds);
    room.setStyles(styles);
    room.setStatus(Room.AVAILABLE);
    if (roomService.createRoom(room))
      request.setAttribute("errMsg", "房间添加成功!");
    else
      request.setAttribute("errMsg", "房间添加失败,可能房间已存在!");
    return managerroom(request);
View Full Code Here

Examples of hotel.model.Room

    if (null == user) {
      return "login";
    }
    String roomid = request.getParameter("roomid");
    if (null != roomid) {
      Room room = roomService.getRoom(roomid);
      request.setAttribute("room", room);
    }
    List<Room> list = roomService.listRoom();
    request.setAttribute("rooms", list);
    return "managercheck";
View Full Code Here

Examples of hotel.model.Room

      }
    }
    List<OrderInfo> list = userService.listOrderInfo(orderid);
    Order order = userService.getOrder(orderid);
    for (OrderInfo info : list) {
      Room room = roomService.getRoom(info.getRoomNumber());
      if (null != room)
        info.setRoom(room);
    }

    request.setAttribute("order", order);
View Full Code Here

Examples of hotel.model.Room

          }
        }
      } else if ("checkIn".equals(op)) {// 确认入住
        boolean flag = true;
        for (String roomid : roomids) {
          Room r = roomService.getRoom(roomid);
          if (r.getStatus() != Room.RESERVE) {
            flag = false;
          }
          if (!flag) {
            request.setAttribute("errMsg", "只有已经预订的房间才能入住!");
            break;
          }
        }
        if (flag) {
          for (String roomid : roomids) {
            userService.checkIn(orderid, roomid);
          }
          request.setAttribute("errMsg", "入住成功");
        }
      } else if ("checkOut".equals(op)) {// 退房,只有预订中和已入住的房间才能退房,退房后结算金额
        boolean flag = true;
        for (String roomid : roomids) {
          Room r = roomService.getRoom(roomid);
          if (r.getStatus() != Room.RESERVE
              && r.getStatus() != Room.CHECKIN) {
            flag = false;
          }
          if (!flag) {
            request.setAttribute("errMsg", "只有预订中和已入住的房间才能退房");
            break;
          }
        }
        if (flag) {
          float totalprices = 0;
          for (String roomid : roomids) {
            userService.checkOut(orderid, roomid);
            List<OrderInfo> infos = userService
                .listOrderInfo(orderid);
            for (OrderInfo info : infos) {
              if (info.getRoomNumber().equals(roomid))
                totalprices += info.getTotalprices();
            }
          }
          request.setAttribute("errMsg", "退房成功,应付金额为:" + totalprices
              + "元!");
        }
      }
    }
    List<OrderInfo> list = userService.listOrderInfo(orderid);
    Order order = userService.getOrder(orderid);
    for (OrderInfo info : list) {
      Room room = roomService.getRoom(info.getRoomNumber());
      if (null != room)
        info.setRoom(room);
    }
    request.setAttribute("order", order);
    request.setAttribute("rooms", list);
View Full Code Here

Examples of hotel.model.Room

        String roomid = rs.getString("roomid");
        float price = rs.getFloat("price");
        int beds = rs.getInt("beds");
        int styles = rs.getInt("styles");
        int stauts = rs.getInt("status");
        Room r = new Room(roomid, price, beds, styles, stauts);
        list.add(r);
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
View Full Code Here

Examples of hotel.model.Room

  @Override
  public Room getRoom(String roomid) {
    Connection conn = null;
    PreparedStatement ps = null;
    ResultSet rs = null;
    Room room = null;
    String sql = "select * from room where roomid = ?";
    try {
      conn = JdbcUtil.getConnection();
      ps = conn.prepareStatement(sql);
      ps.setString(1, roomid);
      rs = ps.executeQuery();
      if (rs.next()) {
        float price = rs.getFloat("price");
        int beds = rs.getInt("beds");
        int styles = rs.getInt("styles");
        int stauts = rs.getInt("status");
        room = new Room(roomid, price, beds, styles, stauts);
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      JdbcUtil.free(rs, ps, conn);
View Full Code Here

Examples of hotel.model.Room

    return true;
  }

  @Override
  public boolean isAvailable(String roomid) {
    Room room = getRoom(roomid);
    if (null == room) {
      return false;
    } else {
      return Room.AVAILABLE == room.getStatus() ? true : false;
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.