Exemplo n.º 1
0
        }//end Constructor

        #region Methods
        //Adding methods
        public List<ScheduleEvent> AddNewLesson(Lesson.LessonType type, DateTime startTime,
                                                DateTime endTime, Semester semester, string location)
        {
            List<ScheduleEvent> lessons;

            //change lesson type to hebrew string
            string lessonType = type == Lesson.LessonType.Exercise ? "תרגול" : "הרצאה";

            //create weekly schedule event until the end of the semester
            new ScheduleEvent(startTime, endTime, this.name, location, lessonType,
                              ScheduleEvent.Period.Weekly, semester.EndTime, out lessons);

            //create new lesson instance
            Lesson lesson = new Lesson(startTime.DayOfWeek, startTime.TimeOfDay, endTime.TimeOfDay, this, location, lessons, type);

            //assign the schedule events to lesson list in Lesson class
            lesson.Lessons = lessons;

            foreach (ScheduleEvent s in lessons)
            {
                s.Lesson = lesson;
            }

            AddLesson(lesson);

            return lessons;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets timetable by Id
        /// </summary>
        /// <param name="id">id of timetable</param>
        /// <returns>timetable</returns>
        public static Timetable GetTimetableById(int id, SchoolTimetable st)
        {
            int idOfTimeTable;

            var numOfClassesTimeTables = st.TimetablesOfClasses.Count;

            var type = Lesson.LessonType.Class;

            //we want to translate absolute id to id of Class or id of Teachers
            if (id < numOfClassesTimeTables)
            {
                idOfTimeTable = id;
            }
            else
            {
                idOfTimeTable = id - numOfClassesTimeTables;
                type          = Lesson.LessonType.Teacher;
            }

            return(type == Lesson.LessonType.Class ? st.TimetablesOfClasses[idOfTimeTable] : st.TimetableOfTeachers[idOfTimeTable]);
        }