Example #1
0
 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);
                 }
             }
         }
     }
 }
Example #2
0
        public void printTimetable(string _courseOfStudy, int _semester, TimetableWPVs _tableWPVs)
        {
            List <string> usedTimeslots = new List <string>();

            string[] dayNames = { "Monday", "Thuesday", "Wednesday", "Thursday", "Friday" };
            Dictionary <string, List <Courses> >[] blocksOfTheWeekCourses = { this.blocksOfMonday, this.blocksOfThuesday, this.blocksOfWednesday, this.blocksOfThursday, this.blocksOfFriday };
            for (int day = 0; day < blocksOfTheWeekCourses.Length; day++)
            {
                for (int block = 1; block < 7; block++)
                {
                    for (int i = 0; i < blocksOfTheWeekCourses[day][block + ".Block"].Count; i++)
                    {
                        Courses course = blocksOfTheWeekCourses[day][block + ".Block"][i];
                        for (int j = 0; j < course.coursesOfStudy.Length; j++)
                        {
                            if (course.semester == _semester && course.coursesOfStudy[j] == _courseOfStudy)
                            {
                                Console.WriteLine(dayNames[day] + ": " + block + ".Block: " + course.name);
                                usedTimeslots.Add(dayNames[day]);
                                usedTimeslots.Add(block + ".Block");
                                //Bei Block hat ein Punkt gefehlt
                            }
                        }
                    }
                }
            }
            Console.WriteLine("");
            Console.WriteLine("For you possible WPVs: ");
            checkAndOutputPossibleWPVs(usedTimeslots, _tableWPVs);
        }
Example #3
0
 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;
                         }
                     }
                 }
             }
         }
     }
 }
Example #4
0
        //iList in _dozentiList umbenannt
        public TimetableDozenti(List <Dozenti> _dozentiList, TimetableWPVs _tableWPVs)
        {
            fillDictionaries();

            days.Add("Monday", blocksOfMonday);
            days.Add("Thuesday", blocksOfThuesday);
            days.Add("Wednesday", blocksOfWednesday);
            days.Add("Thursday", blocksOfThursday);
            days.Add("Friday", blocksOfFriday);

            _dozentiList = duplicateProfessorsAcordingToCourses(_dozentiList);
            insertObjectsInTimetable(_dozentiList, _tableWPVs);
        }
Example #5
0
        //iList in _dozentiList umbenannt
        private void insertObjectsInTimetable(List <Dozenti> _dozentiList, TimetableWPVs _tableWPVs)
        {
            while (_dozentiList.Count != 0)
            {
                Random        rand      = new Random();
                List <string> keyList   = new List <string>(days.Keys);
                string        randomDay = keyList[rand.Next(keyList.Count)];

                Random        random       = new Random();
                List <string> keyListInner = new List <string>(days[randomDay].Keys);
                string        randomTime   = keyListInner[random.Next(keyListInner.Count)];

                if (_dozentiList.Count != 0)
                {
                    bool placingAllowed = true;
                    foreach (Dozenti d in days[randomDay][randomTime])
                    {
                        if (d.name == _dozentiList[0].name)
                        {
                            placingAllowed = false;
                            break;
                        }
//Fehler behoben, dozentiList[0] eingefügt
                        for (int i = 0; i < _dozentiList[0].unavailable.Length; i++)
                        {
                            string[] splittetUnavailability = _dozentiList[0].unavailable[i].Split(":");
                            if (splittetUnavailability[0] == randomDay && splittetUnavailability[1] == randomTime)
                            {
                                placingAllowed = false;
                                break; //hinzugefügt
                            }
                        }

                        for (int j = 0; j < _tableWPVs.days[randomDay][randomTime].Count; j++)
                        {
                            if (_tableWPVs.days[randomDay][randomTime][j].professor == _dozentiList[0].name)//Fehler behoben, dozentiList[0] eingefügt
                            {
                                placingAllowed = false;
                            }
                        }
                    }

                    if (placingAllowed == true)
                    {
                        days[randomDay][randomTime].Add(_dozentiList[0]);
                        _dozentiList.Remove(_dozentiList[0]);
                    }
                }
            }
        }
Example #6
0
        static void Main(string[] args)
        {
            fillListsWithJsonData();

            TimetableWPVs    tableWPVs    = new TimetableWPVs(allWPVObjects);
            TimetableDozenti tableDozenti = new TimetableDozenti(allDozentiObjects, tableWPVs);
            TimetableCourses tableCourses = new TimetableCourses(allRegularCourseObjects, tableDozenti);
            TimetableRooms   tableRooms   = new TimetableRooms(allRoomsObjects, tableCourses, tableWPVs);

            bool runProgram = true;

            Console.WriteLine("Gooday Day, what would you like to do ?");

            while (runProgram == true)
            {
                Console.WriteLine("");
                Console.WriteLine("You can choose between 4 kinds Timetables");
                Console.WriteLine("1. Specific course of Study");
                Console.WriteLine("2. All Courses");
                Console.WriteLine("3. Professor");
                Console.WriteLine("4. Rooms");
                Console.WriteLine("5. Exit");
                Console.WriteLine("Please type in the number you want");
                string mode = Console.ReadLine();

                switch (mode)
                {
                case "1":
                    Console.Clear();
                    Console.WriteLine("Please, enter the name of the course of study you would like to see (MIB, OMB, MKB)");
                    string course = Console.ReadLine();
                    Console.WriteLine("Which Semester are you interested in ?");
                    string semesterString = Console.ReadLine();
                    int    semesterNumber = Int32.Parse(semesterString);
                    Console.Clear();
                    Console.WriteLine("");
                    tableCourses.printTimetable(course, semesterNumber, tableWPVs);
                    break;

                case "2":
                    Console.Clear();
                    Console.WriteLine("");
                    tableCourses.printAllCoursesTimetable(tableRooms);
                    break;

                case "3":
                    Console.Clear();
                    Console.WriteLine("Please, enter the name of the professor you are interested in");
                    string professorName = Console.ReadLine();
                    Console.WriteLine("");
                    tableDozenti.printTimetable(professorName, tableCourses, tableRooms, tableWPVs);     //tableWPVs
                    break;

                case "4":
                    Console.Clear();
                    Console.WriteLine("Please, enter the roomname you are interested in");
                    string roomName = Console.ReadLine();
                    Console.WriteLine("");
                    tableRooms.printTimetable(roomName, tableCourses, tableDozenti);
                    break;

                case "5":
                    Console.Clear();
                    runProgram = false;
                    break;

                default:
                    Console.Clear();
                    Console.WriteLine("Please, enter a valid number");
                    break;
                }
            }
        }
Example #7
0
 //TimetableWPVs _wpvs
 public void printTimetable(string _professorName, TimetableCourses _courses, TimetableRooms _rooms, TimetableWPVs _wpvs)
 {
     string[] dayNames = { "Monday", "Thuesday", "Wednesday", "Thursday", "Friday" };
     Dictionary <string, List <Dozenti> >[] timesOfDaysDozenti = { this.blocksOfMonday, this.blocksOfThuesday, this.blocksOfWednesday, this.blocksOfThursday, this.blocksOfFriday };
     for (int day = 0; day < timesOfDaysDozenti.Length; day++)
     {
         for (int block = 1; block < 7; block++)
         {
             for (int i = 0; i < timesOfDaysDozenti[day][block + ".Block"].Count; i++)
             {
                 Dozenti dozent = timesOfDaysDozenti[day][block + ".Block"][i];
                 if (dozent.name == _professorName)
                 {
                     Console.WriteLine(dayNames[day] + ": " + block + ".Block: " +
                                       _courses.days[dayNames[day]][block + ".Block"][i].name + ": " +
                                       _rooms.days[dayNames[day]][block + ".Block"][i].roomnumber);
                 }
             }
             //For-Schleife war noch nicht drinnen
             for (int j = 0; j < _wpvs.days[dayNames[day]][block + ".Block"].Count; j++)
             {
                 WPVs wpv = _wpvs.days[dayNames[day]][block + ".Block"][j];
                 if (wpv.professor == _professorName)
                 {
                     Console.WriteLine(dayNames[day] + ": " + block + ".Block: " +
                                       wpv.name + ": " + wpv.assignedRoom.roomnumber);
                 }
             }
         }
     }
 }
Example #8
0
        public TimetableRooms(List <Rooms> _listRooms, TimetableCourses _tableCourses, TimetableWPVs _tableWPVs)
        {
            fillDictionaries();

            days.Add("Monday", blocksOfMonday);
            days.Add("Thuesday", blocksOfThuesday);
            days.Add("Wednesday", blocksOfWednesday);
            days.Add("Thursday", blocksOfThursday);
            days.Add("Friday", blocksOfFriday);

            insertObjectsInTimetable(_listRooms, _tableCourses);
            assignRoomsToWPVs(_listRooms, _tableWPVs);
        }