Beispiel #1
0
        public RoomStatus CheckInClient(String reservationID, IRooms roomsCollection)
        {
            int i = 0;

            for (i = 0; i < allReservations.Count; i++)
            {
                if (allReservations[i].ReservationID.Equals(reservationID))
                {
                    roomsCollection[allReservations[i].RoomNumber].Status = RoomStatus.Occupied;
                    break;
                }
            }
            return(roomsCollection[allReservations[i].RoomNumber].Status);
        }
 public RoomsController(IRooms rooms)
 {
     this._rooms = rooms;
 }
Beispiel #3
0
 public ChatService(IUsers users, IRooms rooms, IChatter chatter)
 {
     _users   = users;
     _rooms   = rooms;
     _chatter = chatter;
 }
Beispiel #4
0
        public int[] FindFreeRoom(DateTime startDate, DateTime endDate, int capacity, IRooms roomsCollection)
        {
            if (allReservations.Count == 0)
            {
                return(new int[0]);
            }
            else
            {
                int        index          = 0;
                Room[]     rooms          = roomsCollection.ToArray();
                List <int> availableRooms = new List <int>(roomsCollection.ToRoomNumberArray());
                //int[] availableRooms = roomsCollection.ToRoomNumberArray();
                while (index < allReservations.Count)
                {
                    int roomNumber = allReservations[index].RoomNumber;
                    int i          = 0;
                    for (i = 0; i < rooms.Length; i++)
                    {
                        if (rooms[i].RoomNumber == roomNumber)
                        {
                            break;
                        }
                    }
                    bool capacityIF   = capacity == rooms[i].Capacity;
                    bool firstDateIF  = (startDate < allReservations[index].StartDate) && (endDate <= allReservations[index].StartDate);
                    bool secondDateIF = (startDate >= allReservations[index].EndDate) && (endDate > allReservations[index].EndDate);

                    if (!(capacityIF && (firstDateIF || secondDateIF)))
                    {
                        availableRooms.Remove(roomNumber);
                    }
                    index++;
                }


                for (int j = 0; j < rooms.Length; j++)
                {
                    for (int i = 0; i < availableRooms.Count; i++)
                    {
                        if (availableRooms[i] == rooms[j].RoomNumber)
                        {
                            if (rooms[j].Capacity != capacity)
                            {
                                availableRooms.Remove(availableRooms[i]);
                            }
                            break;
                        }
                    }
                }

                return(availableRooms.ToArray <int>());
            }
        }
Beispiel #5
0
 public void CheckOutClient(int roomNumber, IRooms roomsCollection)
 {
     roomsCollection.CheckOutClient(roomNumber);
 }
Beispiel #6
0
 public RoomsController(IRooms rooms)
 {
     _rooms = rooms;
 }
    public List <Room> GetAllRooms()
    {
        IRooms r = (IRooms)ShowRooms;

        return(r.AvailableRooms());
    }
 public void InitializeRooms(IEnumerable <Room> rooms)
 {
     this._rooms      = new InMemoryRooms(rooms);
     Startup.Factory  = () => this._rooms;
     this._testServer = TestServer.Create <Startup>();
 }
Beispiel #9
0
 public Sessions(ISlots slots, IRooms rooms, ISpeakers speakers)
 {
     _slots    = slots;
     _rooms    = rooms;
     _speakers = speakers;
 }
Beispiel #10
0
 public RoomHandler(IPacketSendStrategy sender, IRooms rooms)
 {
     this.sender = sender;
     this.rooms  = rooms;
 }
Beispiel #11
0
 static Startup()
 {
     _rooms = new InMemoryRooms(Enumerable.Range(0, 10).Select(a => new Room(new Name($"room{a}"))));
 }
Beispiel #12
0
 public void CheckInClient(String reservationID, IRooms roomsCollection)
 {
     throw new NotImplementedException();
 }
Beispiel #13
0
 public Sessions(ISlots slots, IRooms rooms, ISpeakers speakers)
 {
     _slots = slots;
     _rooms = rooms;
     _speakers = speakers;
 }