Ejemplo n.º 1
0
        public IList <CourseDetails> GetAdminCourses(int schoolYearId, int gradeLevelId)
        {
            var classes = ClassStorage.GetAll()
                          .Where(c => c.SchoolYearRef == schoolYearId &&
                                 c.MinGradeLevelRef <= gradeLevelId && c.MaxGradeLevelRef >= gradeLevelId)
                          .Select(c => GetClassDetailsById(c.Id)).ToList();

            return(ClassStorage.GetAll().Where(c => !c.CourseRef.HasValue && classes.Any(y => y.CourseRef == c.Id))
                   .Select(c => new CourseDetails
            {
                Id = c.Id,
                Name = c.Name,
                ClassNumber = c.ClassNumber,
                CourseRef = c.CourseRef,
                CourseTypeRef = c.CourseTypeRef,
                Description = c.Description,
                GradingScaleRef = c.GradingScaleRef,
                MinGradeLevelRef = c.MinGradeLevelRef,
                MaxGradeLevelRef = c.MaxGradeLevelRef,
                ChalkableDepartmentRef = c.ChalkableDepartmentRef,
                PrimaryTeacherRef = c.PrimaryTeacherRef,
                RoomRef = c.RoomRef,
                SchoolYearRef = c.SchoolYearRef,
                Classes = classes.Where(x => x.CourseRef == c.Id).ToList()
            }).ToList());
        }
Ejemplo n.º 2
0
        public IList <ClassDetails> SearchClasses(string filter)
        {
            var res     = new List <ClassDetails>();
            var classes = ClassStorage.GetAll();
            var words   = filter.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var @class in classes)
            {
                if (words.Any(x => @class.Name.Contains(x) || @class.ClassNumber.Contains(x)))
                {
                    res.Add(GetClassDetailsById(@class.Id));
                }
            }
            return(res);
        }
Ejemplo n.º 3
0
        public IList <ClassDetails> GetStudentClasses(int schoolYearId, int studentId, int?markingPeriodId = null)
        {
            var res          = new List <ClassDetails>();
            var classes      = ClassStorage.GetAll();
            var classPersons = ClassPersonStorage.GetAll();

            foreach (var @class in classes)
            {
                if (@class.SchoolYearRef != schoolYearId)
                {
                    continue;
                }
                if (classPersons.Any(x => x.ClassRef == @class.Id && x.PersonRef == studentId))
                {
                    var cd = GetClassDetailsById(@class.Id);
                    if (!markingPeriodId.HasValue || cd.MarkingPeriodClasses.Any(x => x.MarkingPeriodRef == markingPeriodId.Value))
                    {
                        res.Add(cd);
                    }
                }
            }
            return(res);
        }
Ejemplo n.º 4
0
 public IList <Class> GetAll()
 {
     return(ClassStorage.GetAll());
 }