private void checkAndOutputPossibleWPVs(List <string> _usedTimeslots, TimetableWPVs _tableWPVs) { string[] dayNames = { "Monday", "Thuesday", "Wednesday", "Thursday", "Friday" }; for (int day = 0; day < dayNames.Length; day++) { for (int block = 1; block < 7; block++) { for (int i = 0; i < _tableWPVs.days[dayNames[day]][block + ".Block"].Count; i++) { WPVs wpv = _tableWPVs.days[dayNames[day]][block + ".Block"][i]; bool unusedSlot = true; for (int j = 0; j < _usedTimeslots.Count; j += 2) { if (_usedTimeslots[j] == dayNames[day] && _usedTimeslots[j + 1] == block + ".Block") { unusedSlot = false; } } if (unusedSlot == true) { Console.WriteLine(wpv.name + ": " + dayNames[day] + ": " + block + ".block: " + wpv.assignedRoom.roomnumber); } } } } }
private void assignRoomsToWPVs(List <Rooms> _listRooms, TimetableWPVs _tableWPVs) { string[] dayNames = { "Monday", "Thuesday", "Wednesday", "Thursday", "Friday" }; for (int day = 0; day < dayNames.Length; day++) { for (int block = 1; block < 7; block++) { for (int i = 0; i < _tableWPVs.days[dayNames[day]][block + ".Block"].Count; i++) { WPVs wpv = _tableWPVs.days[dayNames[day]][block + ".Block"][i]; if (this.days[dayNames[day]][block + ".Block"].Count == 0) { _tableWPVs.days[dayNames[day]][block + ".Block"][i].assignedRoom = _listRooms[0]; } else { for (int j = 0; j < _listRooms.Count; j++) { if (_listRooms[j].roomnumber != this.days[dayNames[day]][block + ".Block"][0].roomnumber) { wpv.assignedRoom = _listRooms[j]; break; } } } } } } }