/// <summary> /// I should write a method which will save room name, then pick up these room name from roomList and make a selection if the room name is equal to another room name which is picked up from the TTTList, then update information for this room. /// /// </summary> /// <param name="newRoom"></param> /// public void collectTTTInfo(Room newRoom) { int TTTPosition = 0, roomListPosition = 0; //every time, the system will read "room.xml" which only includes a room name. SavingAndReading data = new SavingAndReading(); data.ReadRoomFile("room.xml"); foreach (Room e1 in SystemList.RoomsList) { //termTimetableList size is fixed, if doesnot initialize the TTTPosition, //then the TTTPosition will greater than the size of termTimetable TTTPosition = 0; foreach (WebpageTermTimetable e2 in SystemList.TermTimetableList) { if (e1.RoomName == e2.RoomName) { SystemList.RoomsList[roomListPosition].TtDimensionArray[e2.Day][e2.StartHour - 9].HasSubject = true; SystemList.RoomsList[roomListPosition].TtDimensionArray[e2.Day][e2.StartHour - 9].TermTTListPosition = TTTPosition; } TTTPosition++; } roomListPosition++; } data.WriteRoomFile(); }
public void roomMain() { int choice; SavingAndReading data = new SavingAndReading(); Room newRoom = new Room(); while (true) { Console.WriteLine("\n1. Add A Room \n2. Print A Room \n3. Print All Room \n4. Collect Room Info"); choice = int.Parse(Console.ReadLine()); switch (choice) { case 1: newRoom = newRoom.enterRoomInfo(newRoom); //newRoom.TtCells1 = new TimetableCells(); //newRoom.ttDimensionList[0, 0].HasSubject = true; //newRoom.ttDimensionList[0, 0].TermTTListPosition = 1; SystemList.RoomsList.Add(newRoom); break; case 2: //newRoom.printARoom(); break; case 4: //newRoom.collectCellsInfoTest(); //newRoom.collectInNormalWay(); break; case 5: newRoom.defaultValue(newRoom); break; case 6: newRoom.collectTTTInfo(newRoom); break; } data.WriteRoomFile(); } }