Beispiel #1
0
        public static bool reportCourseDetail(string course_designation)
        {
            // check if student_id is valid
            Course course = new Course(course_designation);

            if (course.GetCourseInformation(GLOBALS.current_semester))
            {
                List <Student> student_list = Registration.getStudentsFromCourseCurrentSemester(course.course_id);
                List <string>  lines        = new List <string>();

                lines.Add(String.Format("Report for course ID: {0}", course.course_id));
                lines.Add(course.ToString());
                lines.Add("===============================" + Environment.NewLine);
                lines.Add("Students who are in this course: " + Environment.NewLine);
                lines.Add(String.Format("Student ID\t\t First name\t\t Last name" + Environment.NewLine));

                foreach (var student in student_list)
                {
                    lines.Add(String.Format("{0}\t\t\t {1}\t\t\t {2}", student.student_id, student.first_name, student.last_name));
                    lines.Add(Environment.NewLine);
                }

                //string file_name = AppDomain.CurrentDomain.BaseDirectory + String.Format("Report: Student ID {0}.txt", student_id);
                string file_path = @".\..\..\Reports\Report_Course_Detail.txt";
                System.IO.File.WriteAllLines(file_path, lines);
                System.Diagnostics.Process.Start("notepad.exe", @".\..\..\Reports\Report_Course_Detail.txt");
                return(true);
            }
            return(false);
        }
        public static bool reportCourseDetail(string course_designation)
        {
            // check if student_id is valid
            Course course = new Course(course_designation);

            if (course.GetCourseInformation(GLOBALS.current_semester))
            {
                List<Student> student_list = Registration.getStudentsFromCourseCurrentSemester(course.course_id);
                List<string> lines = new List<string>();

                lines.Add(String.Format("Report for course ID: {0}", course.course_id));
                lines.Add(course.ToString());
                lines.Add("===============================" + Environment.NewLine);
                lines.Add("Students who are in this course: " + Environment.NewLine);
                lines.Add(String.Format("Student ID\t\t First name\t\t Last name" + Environment.NewLine));

                foreach (var student in student_list)
                {
                    lines.Add(String.Format("{0}\t\t\t {1}\t\t\t {2}", student.student_id, student.first_name, student.last_name));
                    lines.Add(Environment.NewLine);
                }

                //string file_name = AppDomain.CurrentDomain.BaseDirectory + String.Format("Report: Student ID {0}.txt", student_id);
                string file_path = @".\..\..\Reports\Report_Course_Detail.txt";
                System.IO.File.WriteAllLines(file_path, lines);
                System.Diagnostics.Process.Start("notepad.exe", @".\..\..\Reports\Report_Course_Detail.txt");
                return true;
            }
            return false;
        }
        public string searchCourse(string course_designation)
        {
            Course course = new Course(course_designation);
            string result = "No course found in this semester";
            if (course.GetCourseInformation(GLOBALS.current_semester))
            {
                result = course.ToString();
            }

            return result;
        }
        public string searchCourse(string course_designation)
        {
            Course course = new Course(course_designation);
            string result = "No course found in this semester";

            if (course.GetCourseInformation(GLOBALS.current_semester))
            {
                result = course.ToString();
            }

            return(result);
        }