public static EnrollmentSemesterHelper createViewFacultySemesterHelper()
        {
            List <String> semesters = new List <string>();

            semesters.Add(SemesterDataHelper.getSemesterSeason() + " " + SemesterDataHelper.getSemesterYear());
            semesters.Add(SemesterDataHelper.getNextSemesterSeason() + " " + SemesterDataHelper.getNextSemesterYear());

            return(new EnrollmentSemesterHelper(semesters));
        }
Пример #2
0
        public static EnrollmentSemesterHelper createViewScheduleHelper()
        {
            String        cString     = System.Configuration.ConfigurationManager.ConnectionStrings["DBConnect"].ConnectionString;
            String        deptString  = "SELECT [department_full_name] FROM [HarborViewUniversity].[dbo].[department] WHERE department_id != 11";
            String        dayString   = "SELECT DISTINCT [days] FROM [HarborViewUniversity].[dbo].[section_view]";
            String        timeString  = "SELECT DISTINCT FORMAT(CAST([start_time] AS datetime), 'h:mm tt') AS start_time, FORMAT(CAST([end_time] AS datetime), 'h:mm tt') AS end_time, CAST([end_time] AS datetime) AS order_time FROM [HarborViewUniversity].[dbo].[time_slot] ORDER BY order_time";
            List <String> departments = new List <string>();
            List <String> days        = new List <string>();
            List <String> times       = new List <string>();
            List <String> semesters   = new List <string>();

            //Grab semester and year selector data
            semesters.Add(SemesterDataHelper.getSemesterSeason() + " " + SemesterDataHelper.getSemesterYear());
            semesters.Add(SemesterDataHelper.getNextSemesterSeason() + " " + SemesterDataHelper.getNextSemesterYear());

            using (SqlConnection connection = new SqlConnection(cString))
            {
                SqlCommand command1 = new SqlCommand(deptString, connection);
                connection.Open();
                using (var reader = command1.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        departments.Add(reader.GetString(0));
                    }
                }

                SqlCommand command2 = new SqlCommand(dayString, connection);
                using (var reader = command2.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        days.Add(reader.GetString(0));
                    }
                }

                SqlCommand command3 = new SqlCommand(timeString, connection);
                using (var reader = command3.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        times.Add(reader.GetString(0));
                    }
                }

                connection.Close();
            }

            return(new EnrollmentSemesterHelper(departments, times, days, semesters));
        }