private void registerStudentButton_Click(object sender, RoutedEventArgs e)
        {
            CourseRecordInformation information = MainHandlers.WindowManager.ClassRecords.SelectedClass;

            if (information != null)
            {
                string content = string.Empty;
                try
                {
                    if (MainHandlers.WindowManager.IsAdmin)
                    {
                        StudentRecordHandler student = ((AdminRecordHandler)MainHandlers.WindowManager.ViewHandler).SelectedStudent;
                        student.RegisterStudent(information);
                        content = string.Format("Student: {0} {1} was registered for: {2}", student.PersonalInformation.FirstName, student.PersonalInformation.LastName, information.CourseName);
                    }
                    else
                    {
                        StudentRecordHandler student = ((StudentRecordHandler)MainHandlers.WindowManager.ViewHandler);
                        student.RegisterStudent(information);
                        content = string.Format("Student: {0} {1} was registered for: {2}", student.PersonalInformation.FirstName, student.PersonalInformation.LastName, information.CourseName);
                    }
                }catch (Exception em)
                {
                    content = em.Message;
                }

                MessageBox.Show(content, "Ok");
            }
        }
示例#2
0
        private void LoadLayout()
        {
            StudentRecordHandler handler = ((AdminRecordHandler)MainHandlers.WindowManager.ViewHandler).SelectedStudent;

            studentInformationGrid.DataContext  = handler.PersonalInformation;
            academicInformationGrid.DataContext = handler.AcademicInformation;
            studentClassesDockPanel.Children.Clear();
            studentClassesDockPanel.Children.Add(new StudentRecordTreeView());
            InitialMajorsDropBox();
        }
 private void CourseRecordLayout_Loaded(object sender, RoutedEventArgs e)
 {
     if (!MainHandlers.WindowManager.IsAdmin)
     {
         editInformationToggleButton.Visibility = Visibility.Collapsed;
         registerStudentButton.DataContext      = MainHandlers.WindowManager.ViewHandler.PersonalInformation;
     }
     else
     {
         StudentRecordHandler handler = ((AdminRecordHandler)MainHandlers.WindowManager.ViewHandler).SelectedStudent;
         if (handler != null)
         {
             registerStudentButton.DataContext = handler.PersonalInformation;
         }
         else
         {
             registerStudentButton.Visibility = Visibility.Hidden;
         }
     }
 }