Пример #1
0
        public IList <Standard> GetStandards(StandardQuery query)
        {
            var standards = StandardStorage.GetData().Select(x => x.Value);

            if (query.StandardSubjectId.HasValue)
            {
                standards = standards.Where(x => x.StandardSubjectRef == query.StandardSubjectId);
            }
            if (query.GradeLavelId.HasValue)
            {
                standards =
                    standards.Where(
                        x => query.GradeLavelId <= x.LowerGradeLevelRef && query.GradeLavelId >= x.UpperGradeLevelRef);
            }
            if (!query.AllStandards || query.ParentStandardId.HasValue)
            {
                standards = standards.Where(x => x.ParentStandardRef == query.ParentStandardId);
            }

            if (query.ClassId.HasValue)
            {
                var classStandarts = ClassStandardStorage.GetAll(query.ClassId).Select(x => x.StandardRef);
                standards = standards.Where(x => classStandarts.Contains(x.Id));
            }
            //if (query.CourseId.HasValue)
            //{
            //    var classStandarts = Storage.ClasStandardStorage.GetAll(query.CourseId).Select(x => x.StandardRef);
            //    standards = standards.Where(x => classStandarts.Contains(x.Id));
            //}

            return(standards.ToList());
        }
Пример #2
0
        private void InsertDefaultClassStandards()
        {
            var standardsIds   = StandardStorage.GetData().Keys.ToList();
            var classStandards = ClassStandardStorage.GetAll();

            standardsIds = standardsIds.Where(x => classStandards.All(y => y.StandardRef != x)).ToList();
            var classes           = ServiceLocator.ClassService.GetAll();
            var newClassStandards = new List <ClassStandard>();

            foreach (var c in classes)
            {
                newClassStandards.AddRange(standardsIds.Select(id => new ClassStandard
                {
                    ClassRef    = c.Id,
                    StandardRef = id
                }).ToList());
            }
            ClassStandardStorage.Add(newClassStandards);
        }
Пример #3
0
 public bool ClassStandardsExist(ClassDetails cls)
 {
     return(ClassStandardStorage.GetAll().Count(x => x.ClassRef == cls.Id || x.ClassRef == cls.CourseRef) > 0);
 }
Пример #4
0
 public IList <ClassStandard> GetClassStandards(int standardId)
 {
     return(ClassStandardStorage.GetAll().Where(x => x.StandardRef == standardId).ToList());
 }
Пример #5
0
 private void ClearStandardsData()
 {
     ClassStandardStorage.Delete(ClassStandardStorage.GetAll());
     StandardStorage.Delete(StandardStorage.GetAll());
     StandardSubjectStorage.Delete(StandardSubjectStorage.GetAll());
 }