Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public RoomsController(IRooms rooms)
 {
     this._rooms = rooms;
 }
Ejemplo n.º 3
0
 public ChatService(IUsers users, IRooms rooms, IChatter chatter)
 {
     _users   = users;
     _rooms   = rooms;
     _chatter = chatter;
 }
Ejemplo n.º 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>());
            }
        }
Ejemplo n.º 5
0
 public void CheckOutClient(int roomNumber, IRooms roomsCollection)
 {
     roomsCollection.CheckOutClient(roomNumber);
 }
Ejemplo n.º 6
0
 public RoomsController(IRooms rooms)
 {
     _rooms = rooms;
 }
    public List <Room> GetAllRooms()
    {
        IRooms r = (IRooms)ShowRooms;

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