Beispiel #1
0
        public List <RoomCompleteInfo> GetRooms()
        {
            IRoomDAO                rDAO              = DAOFactory.OnlyInstance.GetRoomDAO();
            List <Room>             rooms             = rDAO.GetRooms();
            List <RoomCompleteInfo> roomsCompleteInfo = new List <RoomCompleteInfo>();

            foreach (Room room in rooms)
            {
                int      typeId = room.TypeId;
                RoomType type   = rDAO.GetRoomTypeFromId(typeId);
                room.UpdateType(type);

                RoomCompleteInfo rci = new RoomCompleteInfo(room);
                roomsCompleteInfo.Add(rci);
            }

            return(roomsCompleteInfo);
        }
Beispiel #2
0
        public RoomCompleteInfo CreateRoom(int number, string phone, int typeId)
        {
            IRoomDAO rDAO = DAOFactory.OnlyInstance.GetRoomDAO();
            Room     room = rDAO.CreateRoom(number, phone, typeId);

            if (room == null)
            {
                return(null);
            }

            RoomType type = rDAO.GetRoomTypeFromId(typeId);

            room.UpdateType(type);

            RoomCompleteInfo rci = new RoomCompleteInfo(room);

            return(rci);
        }