예제 #1
0
파일: Room.cs 프로젝트: cverhelst/Timetable
 public object Clone()
 {
     Room clone = new Room();
     clone.Seats = Seats;
     clone.Resources = (List<Resource>)Resources.Clone();
     clone.Name = Name;
     return clone;
 }
예제 #2
0
        public void RemoveRoom(Model.Room oldRoom)
        {
            for (int i = 0; i < rooms.Count; i++)
            {
                if (rooms[i].RoomId == oldRoom.RoomId)
                {
                    rooms.RemoveAt(i); break;
                }
            }

            SerializationAndDeserilazationOfRooms.EnterRoom(rooms);
        }
예제 #3
0
 public void AddRoom(Model.Room newRoom)
 {
     if (newRoom == null)
     {
         return;
     }
     if (this.room == null)
     {
         this.room = new System.Collections.ArrayList();
     }
     if (!this.room.Contains(newRoom))
     {
         this.room.Add(newRoom);
     }
 }
 public void ReschedulePatient(DateTime tImeStart, DateTime timeEnd, Model.Doctor doctor, Model.Room room, String id)
 {
     // TODO: implement
 }
 public Appointment ScedulePatient(DateTime timeStart, DateTime endTime, Model.Doctor doctor, Model.Room room, String id)
 {
     // TODO: implement
     return(null);
 }
예제 #6
0
        public Timetable generateDefaultTimeTable()
        {
            // Resources
            Resource resource1 = new Resource("Projector");
            List<Resource> resources = new List<Resource>() { resource1 };

            // Rooms
            Room room1 = new Room("001", 30, resources);
            Room room2 = new Room("112", 30, null);
            Room room3 = new Room("110", 35, resources);

            // Set Room avalability
            BookableRoom book1 = new BookableRoom(Extensions.DateTimeCreator(0, 8, 30), Extensions.DateTimeCreator(0, 16, 0), room1);
            BookableRoom book2 = new BookableRoom(Extensions.DateTimeCreator(0, 8, 30), Extensions.DateTimeCreator(0, 16, 0), room2);
            BookableRoom book3 = new BookableRoom(Extensions.DateTimeCreator(0, 8, 30), Extensions.DateTimeCreator(0, 16, 0), room3);
            List<BookableRoom> rooms1 = new List<BookableRoom>() { (BookableRoom)book1.Clone(), (BookableRoom)book2.Clone() };
            List<BookableRoom> rooms2 = new List<BookableRoom>() { (BookableRoom)book2.Clone(), (BookableRoom)book3.Clone() };
            List<BookableRoom> rooms3 = new List<BookableRoom>() { (BookableRoom)book1.Clone(), (BookableRoom)book3.Clone() };

            // Days
            Day day1 = new Day(1, rooms1);
            Day day2 = new Day(2, rooms2);
            Day day3 = new Day(3, rooms3);

            // Timetable
            Timetable timetable = new Timetable(new List<Day>() { day1, day2, day3 });

            return timetable;
        }
예제 #7
0
        public void init()
        {
            resource1 = new Resource("TV");
            resource2 = new Resource("Projector");
            resource3 = new Resource("PC");

            resources1 = new List<Resource>() { resource1, resource2 };
            resources2 = new List<Resource>() { resource1, resource3 };

            room1 = new Room(10, resources1);
            room2 = new Room(10, new List<Resource>() { new Resource("Projector"), new Resource("TV") });
            course1 = new Course(10, 10, resources1);
            course2 = new Course(10, 10, resources2);
        }
예제 #8
0
        public void GetHashCode_DifferentFields_DifferentHashCode()
        {
            room1 = new Room("Test", 2, new List<Resource>() { resource1 });
            room2 = new Room("Test2",3,null);

            Assert.AreNotEqual(room1, room2);
            Assert.AreNotEqual(room1.GetHashCode(), room2.GetHashCode());
        }
예제 #9
0
 public void GetHashCode_Clone_SameHashCode()
 {
     room2 = (Room) room1.Clone();
     Assert.AreEqual(room1, room2);
     Assert.AreEqual(room1.GetHashCode(), room2.GetHashCode());
 }
예제 #10
0
 public void Constructor_ResourcesNull_EmptyList()
 {
     room1 = new Room(10, null);
     Assert.IsEmpty(room1.Resources);
 }
예제 #11
0
        public void init()
        {
            resource1 = new Resource("TV");
            resource2 = new Resource("Projector");
            resource3 = new Resource("PC");

            resources1 = new List<Resource>() { resource1, resource2 };
            resources2 = new List<Resource>() { resource1, resource3 };

            room = new Room(10, resources1);

            start = DateTime.Now;
            end = start.AddMinutes(30);

            broom1 = new BookableRoom(start, end, room);
            broom2 = new BookableRoom(start.AddMinutes(1), start.AddMinutes(41), new Room(20, resources2));

            course1 = new Course(30, 10, resources1);
            course2 = new Course(40, 20, resources2);

            broomList1 = new List<BookableRoom>() { broom1, broom2 };
            broomList2 = new List<BookableRoom>() { (BookableRoom)broom1.Clone(), (BookableRoom)broom2.Clone() };
            day1 = new Day(broomList1);
            day2 = new Day(broomList2);
        }
예제 #12
0
파일: Room.cs 프로젝트: cverhelst/Timetable
 public bool Equals(Room other)
 {
     if (other == null)
     {
         return false;
     }
     if (Seats != other.Seats)
     {
         return false;
     }
     if (Resources.Count != other.Resources.Count)
     {
         return false;
     }
     if (Resources.Except(other.Resources).Any())
     {
         return false;
     }
     return true;
 }
예제 #13
0
        public void init()
        {
            resource1 = new Resource("TV");
            resource2 = new Resource("Projector");
            resource3 = new Resource("PC");

            resources1 = new List<Resource>() { resource1, resource2 };
            resources2 = new List<Resource>() { resource3 };

            room1 = new Room(10, resources1);
            room2 = new Room(10, resources2);

            start = DateTime.Now;
            end = start.AddMinutes(5);

            broom1 = new BookableRoom(start, end, room1);
            broom2 = new BookableRoom(end.AddMinutes(1), end.AddMinutes(6), room2);
            broom3 = new BookableRoom(end.AddMinutes(2), end.AddMinutes(7), room2);

            course1 = new Course(1, 10, resources1);
            course2 = new Course(1, 10, resources2);
            course3 = new Course(1, 20, new List<Resource>() { new Resource("CoffeeMachine")});

            broomList = new List<BookableRoom>() { broom1, broom2 };
            broomList2 = new List<BookableRoom>() { broom3 };
            day1 = new Day(broomList);
            day2 = new Day(broomList2);

            table1 = new Timetable(new List<Day>() { day1, day2 });
            table2 = new Timetable(new List<Day>() { day1 });
        }