示例#1
0
        public bool Exists(ClassPersonQuery classPersonQuery)
        {
            var classPersons     = GetClassPersons(classPersonQuery);
            var classPersonsList = classPersons as IList <ClassPerson> ?? classPersons.ToList();

            return((classPersonQuery.ClassId.HasValue || classPersonQuery.MarkingPeriodId.HasValue ||
                    classPersonQuery.PersonId.HasValue) && classPersonsList.Count > 0);
        }
示例#2
0
        public void Delete(ClassPersonQuery classPersonQuery)
        {
            var classPersons = GetClassPersons(classPersonQuery);

            foreach (var classPerson in classPersons)
            {
                var item = data.First(x => x.Value == classPerson);
                data.Remove(item.Key);
            }
        }
示例#3
0
        public IList <ClassPerson> GetClassPersons(int?personId, int?classId, bool?isEnrolled, int?markingPeriodId)
        {
            var query = new ClassPersonQuery
            {
                ClassId         = classId,
                IsEnrolled      = isEnrolled,
                PersonId        = personId,
                MarkingPeriodId = markingPeriodId
            };

            return(DoRead(u => new ClassPersonDataAccess(u).GetClassPersons(query)));
        }
示例#4
0
        public IEnumerable <ClassPerson> GetClassPersons(ClassPersonQuery classPersonQuery)
        {
            var classPersons = data.Select(x => x.Value);

            if (classPersonQuery.ClassId.HasValue)
            {
                classPersons = classPersons.Where(x => x.ClassRef == classPersonQuery.ClassId);
            }
            if (classPersonQuery.MarkingPeriodId.HasValue)
            {
                classPersons = classPersons.Where(x => x.MarkingPeriodRef == classPersonQuery.MarkingPeriodId);
            }
            if (classPersonQuery.PersonId.HasValue)
            {
                classPersons = classPersons.Where(x => x.PersonRef == classPersonQuery.PersonId);
            }

            if (classPersonQuery.IsEnrolled.HasValue)
            {
                classPersons = classPersons.Where(x => x.IsEnrolled);
            }

            return(classPersons);
        }
示例#5
0
        public ClassPerson GetClassPerson(ClassPersonQuery classPersonQuery)
        {
            var classPersons = GetClassPersons(classPersonQuery);

            return(classPersons.First());
        }