public HonorRollsViewModel()
 {
     if (!quarters.Any())
     {
         quarters = MarkingPeriods.Singleton.Select(p => p.Key)
                    .OrderByDescending(p => p.EndingSchoolYear)
                    .ThenBy(p => p.Quarter)
                    .ToList();
         CurrentQuarter = quarters.FirstOrDefault();
     }
     if (!students.Any())
     {
         students    = GradebookViewModel.Load().Students.ToArray();
         allStudents = students;
     }
 }
        public GradebookViewModel LoadGradebook()
        {
            Gradebook = GradebookViewModel.Load();

            chkMyStudents.IsChecked = UserViewModel.CurrentUser.HasStudents;
            chkMyStudents.IsEnabled = UserViewModel.CurrentUser.HasStudents;

            MarkingPeriods.Singleton.OrderByDescending(q => q.EndDate).ToList().ForEach(q => cmbQuarter.Items.Add(q));
            cmbQuarter.Text = cmbQuarter.Items[1].ToString();

            Maintenance.GradeLevelShorts.ToList().ForEach(g => cmbGradeLevel.Items.Add(g));
            cmbGradeLevel.Text = cmbGradeLevel.Items[0].ToString();

            FillCourses(MarkingPeriodKey.Current, cmbGradeLevel.Text);
            FillStudents(entStudent.Text, cmbQuarter.SelectedItem as MarkingPeriod, cmbGradeLevel.Text, cmbCourse.SelectedItem as CourseViewModel);
            return Gradebook;
        }
        private void OnLogin(object sender, System.EventArgs e)
        {
            Title = "Highlands School";
            loginOverlay.Visibility = System.Windows.Visibility.Hidden;
            _gradebook = studentsControl.LoadGradebook();
            ctrlClasses.Refresh(_gradebook);
            ctrlAttendees.Refresh();
            //ctrlClasses.Visibility = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanEditAttendance);
            //tabAttendance.Visibility = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanEditAttendance);
            tabClasses.Visibility = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanViewGrades);
            tabStudents.Visibility = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanViewGrades);
            btnExport.Visibility = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanImportExport);
            btnImport.Visibility = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanImportExport);
            btnHonorRoll.Visibility = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanViewHonorRoll);
            tabClasses.Visibility = ViewUtils.IsVisible(UserViewModel.CurrentUser.HasStudents);

            staUser.Content = "Welcome, " + UserViewModel.CurrentUser;
        }