public StudentWindow(StudentViewModel student)
     : this()
 {
     LoadStudent(student);
 }
        public void LoadStudent(StudentViewModel student)
        {
            _student = student;

            nameHeader.Text = student.Name;
            noStudentOverlay.Visibility = System.Windows.Visibility.Hidden;
            var currentUser = UserViewModel.CurrentUser;

            chkMyClasses.IsChecked = currentUser.HasStudents;
            chkMyClasses.IsEnabled = currentUser.HasStudents;
            gridStudentInfo.IsEnabled = currentUser.CanEditStudentInfo;

            _sdScores = new ObservableCollection<SDScoreViewModel>();
            _grades = new ObservableCollection<GradeViewModel>();
            RefreshMarks();

            entName.Text = _student.Name;
            dtpDob.SelectedDate = _student.DOB;
            entAddress.Text = _student.AddressLine1 + "," + student.AddressLine2;
            dtpEnrolled.SelectedDate = _student.DateEnrolled;
            if (_student.DateWithdrawn.HasValue)
                dtpWithdrawn.SelectedDate = _student.DateWithdrawn.Value;
            chkWithdrawn.IsChecked = _student.DateWithdrawn.HasValue;

            Maintenance.GradeLevelShorts.ForEach(o => cmbGradeLevel.Items.Add(o));
            cmbGradeLevel.Text = _student.GradeLevel;

            dgvGrades.ItemsSource = Grades;
            dgvSelfDevelopment.ItemsSource = SDScores;

            grdStudentReport.ItemsSource = _student.StudentReports();

            genReport.Visibility = ViewUtils.IsVisible(UserViewModel.CurrentUser.CanExportReportCards);

            /*
               cmbMarkingPeriod.ItemsSource =
                MarkingPeriods.Singleton.OrderByDescending(q => q.EndDate).Where(q => student.AttendedDuring(q));

            var periods = new HashSet<string>();
            cmbMarkingPeriod.ItemsSource = student.Grades.Select(g => MarkingPeriodKey.Parse(g.Quarter))
                .Where(period =>
                {
                    var hadItem = periods.Contains(period.ToString());
                    if (!hadItem) periods.Add(period.ToString());
                    return !hadItem;
                })
                .OrderByDescending(period => period.ToString())
                .ThenBy(period => period.Quarter);
            if (cmbMarkingPeriod.Items.Count > 0)
               {
               cmbMarkingPeriod.SelectedIndex = 0;
               genReport.IsEnabled = true;
               }
               else
               {
               genReport.IsEnabled = false;
               }
            */
        }
Ejemplo n.º 3
0
 public ReportCard(StudentViewModel student)
 {
     _student = student;
 }