private void Update_Button_Click(object sender, EventArgs e)
        {
            var temp1       = StudentName_textbox.Text;
            var temp        = Convert.ToInt32(StudentID_textbox.Text);
            var Updatequery = from Student student in studentRegistration.Students
                              where student.Id == temp
                              select student;

            foreach (var element in Updatequery)
            {
                if (StudentName_textbox.Text != String.Empty)
                {
                    element.Name = temp1;
                }
                if (Majors_List.SelectedItem != null)
                {
                    element.Major = Majors_List.SelectedItem as Major;
                }
            }

            studentRegistration.SaveChanges();
            updateTable();
            clear_textbox();
        }
        private void addSection(int courseID, int facID, string times, string days, string semester)
        {
            var courseCheck  = sectionEntities.Courses.Where(c => c.Id == courseID);
            var facultyCheck = sectionEntities.Faculties.Where(f => f.Id == facID);

            if (courseCheck.Any() && facultyCheck.Any())
            {
                Section newSection = new Section()
                {
                    CourseID  = courseID,
                    FacultyID = facID,
                    Time      = times,
                    Day       = days,
                    Semester  = semester
                };

                sectionEntities.Sections.Add(newSection);
                sectionEntities.SaveChanges();
                errorLabel.Text = "Section Added.";
            }

            else if (courseCheck.Any() && (facultyCheck.Any() == false))
            {
                errorLabel.Text = "No faculty with that ID exists, please put in a new faculty.";
            }

            else if ((courseCheck.Any() == false) && facultyCheck.Any())
            {
                errorLabel.Text = "No course with that ID exists, please put in a new course.";
            }

            else
            {
                errorLabel.Text = "Neither the course nor the faculty you submitted exist, please enter valid data.";
            }
        }
        public EnrollmentForm()
        {
            InitializeComponent();
            EnrollmentEntities = new RegistrationEntities();
            EnrollmentEntities.Enrollments.Load();
            UpdateTable();
            HideComponents();


            //******************************************* START OF INITILIZATION TEST. PLEASE DELETE BEFORE FINAL TURN IN****************************************************//
            //Section newSection = new Section
            //{
            //    Id = 1,
            //    CourseID = 1,
            //    FacultyID = 1,
            //    Day = "Wednesday",
            //    Time = "9:00AM",
            //    Semester = "Fall"
            //};
            //Section newSection1 = new Section
            //{
            //    Id = 1,
            //    CourseID = 1,
            //    FacultyID = 1,
            //    Day = "Wednesday",
            //    Time = "9:00AM",
            //    Semester = "Summer"
            //};

            //Student newStudent = new Student
            //{
            //    Id = 1,
            //    Name = "Avian",
            //    MajorID = 1
            //};

            //Faculty newFaculty = new Faculty
            //{
            //    Id = 1,
            //    Name = "Eric",
            //    PhoneNumber = "248-880-2020"
            //};

            //Course newCourse = new Course
            //{
            //    Id = 1,
            //    Name = "Intro C#",
            //    Number = "297",
            //    Credits = 4,
            //    Department = "CECS"
            //};

            //EnrollmentEntities.Sections.Add(newSection);
            //EnrollmentEntities.Sections.Add(newSection1);
            //EnrollmentEntities.Students.Add(newStudent);
            //EnrollmentEntities.Faculties.Add(newFaculty);
            //EnrollmentEntities.Courses.Add(newCourse);

            //************************************** END OF INITILIZATION TESTS***********************************//

            EnrollmentEntities.SaveChanges();
        }