public static void queryAdd(Room room) { string query; int roomId; query = string.Format("INSERT INTO Room ([Number], Capacity, Price) VALUES ('{0}','{1}','{2}')", room.Number, room.Capacity, room.Price); executeQuery(query); roomId = getRoomId(room); foreach (Student student in room.Students) { StudentDBService.queryAdd(student, roomId); } }
public void parseRooms() { rooms.Clear(); DataSet input = RoomDBService.getRooms(); foreach (DataRow row in input.Tables[0].Rows) { Room room = RoomParser.parseRoom(row[1].ToString(), row[2].ToString(), row[3].ToString()); List <Student> students = new List <Student>(); DataSet data = StudentDBService.getStudentsFromRoom(room); students = StudentService.parseStudents(data); room.Students = students; rooms.Add(room); } }
public static void clearDB() { RoomDBService.queryClear(); StudentDBService.queryClear(); }