Пример #1
0
 private void ResetGrades()
 {
     ListColorConverter.Reset();
     studentDetails.DataContext = null;
     studentDetails.DataContext = SessionContext.CurrentGrades;
     RefreshGradeVisibility();
 }
Пример #2
0
        private void FilterGrades(DateTime?startDate, DateTime?endDate, string subject)
        {
            if (SessionContext.CurrentGrades == null || SessionContext.CurrentGrades.Count == 0)
            {
                return;
            }

            if (!startDate.HasValue && !endDate.HasValue && subject == String.Empty)
            {
                ResetGrades();
            }
            else
            {
                List <LocalGrade> grades = null;

                if (startDate.HasValue && subject != String.Empty)
                {
                    // Both filters
                    grades = SessionContext.CurrentGrades.Where(g => g.AssessmentDate >= startDate && g.AssessmentDate < endDate && g.SubjectName == subject).ToList();
                }
                else if (startDate.HasValue && subject == String.Empty)
                {
                    // Date only
                    grades = SessionContext.CurrentGrades.Where(g => g.AssessmentDate >= startDate && g.AssessmentDate < endDate).ToList();
                }
                else if (!startDate.HasValue && subject != String.Empty)
                {
                    // subject only
                    grades = SessionContext.CurrentGrades.Where(g => g.SubjectName == subject).ToList();
                }

                if (grades != null)
                {
                    ListColorConverter.Reset();
                    studentDetails.DataContext = grades;
                    RefreshGradeVisibility();
                }
            }
        }