Exemplo n.º 1
0
        private void fillCourseGridView(int course_Serial, int course_type)
        {
            Lecture_Course selected =
                (from sc in selectedCourse
                 from oc in openCourses where oc.Course_id == sc.Course_ID
                 from ol in openLectures where ol.Course_ID == oc.Course_id && ol.Course_Serial == course_Serial && ol.Course_type == course_type
                 select ol).FirstOrDefault();

            string type    = "";
            Person teacher = teachers.FirstOrDefault(t => t.ID.Trim() == selected.Teacher.Trim());

            switch (course_type)
            {
            case 1:
                type = "Lecture";
                break;

            case 2:
                type = "Practice";
                break;

            case 3:
                type = "Lab";
                break;

            default:
                Debug.WriteLine("Wrong course_type parameter check Data Base");
                break;
            }

            lectureGridView.Rows[0].Cells["Fact"].Value = course_Serial;
            lectureGridView.Rows[1].Cells["Fact"].Value = type;
            lectureGridView.Rows[2].Cells["Fact"].Value = teacher.F_name + " " + teacher.L_name;
            lectureGridView.Rows[3].Cells["Fact"].Value = selected.Date + " " + selected.Start_time + " - " + selected.End_time;
        }
Exemplo n.º 2
0
        //Get name of overlapping Course. Returns "" if don't exists
        private string checkForOverlappingCourse(Lecture_Course check, int time)
        {
            string overlappingCourse = "";

            foreach (Lecture_Course course in enrolledLectures)
            {
                if ((course.Date == check.Date) && !enrolledLectures.Contains(check))
                {
                    if (time >= course.Start_time && time < course.End_time)
                    {
                        overlappingCourse = (openCourses.First(c => c.Course_id == course.Course_ID)).Course_name.Trim();
                        //Debug.WriteLine(course.Date + ": " + course.Start_time + " " + course.End_time + " : " + time + " " + overlappingCourse);
                        switch (check.Course_type)
                        {
                        case 1:
                            lectureOverlapp = true;
                            break;

                        case 2:
                            practiceOverlap = true;
                            break;

                        case 3:
                            labOverlap = true;
                            break;

                        default:
                            Debug.WriteLine("No such Course Type! Check Data Base!");
                            break;
                        }
                        return(overlappingCourse);
                    }
                }
            }
            switch (check.Course_type)
            {
            case 1:
                lectureOverlapp = false;
                break;

            case 2:
                practiceOverlap = false;
                break;

            case 3:
                labOverlap = false;
                break;

            default:
                Debug.WriteLine("No such Course Type! Check Data Base!");
                break;
            }
            return(overlappingCourse);
        }