Exemplo n.º 1
0
        public async Task <List <StaffSectionModel> > GetStaffSectionsAsync(int staffUsi)
        {
            var today = _dateProvider.Today();
            var data  = await _teacherRepository.GetStaffSectionsAsync(staffUsi, today);

            // Get the current sections by grouping to remove duplicates that are from a previous term.
            var model = (from d in data
                         group d by d.LocalCourseCode into g
                         select new StaffSectionModel
            {
                SchoolId = g.FirstOrDefault().SchoolId,
                ClassPeriodName = _classPeriodNameProvider.ParseClassPeriodName(g.FirstOrDefault().ClassPeriodName),
                ClassroomIdentificationCode = g.FirstOrDefault().ClassroomIdentificationCode,
                LocalCourseCode = g.FirstOrDefault().LocalCourseCode,
                TermDescriptorId = g.FirstOrDefault(x => x.BeginDate == g.Max(b => b.BeginDate)).TermDescriptorId,
                SchoolYear = g.FirstOrDefault().SchoolYear,
                UniqueSectionCode = g.FirstOrDefault(x => x.BeginDate == g.Max(b => b.BeginDate)).UniqueSectionCode,
                SequenceOfCourse = g.FirstOrDefault(x => x.BeginDate == g.Max(b => b.BeginDate)).SequenceOfCourse,
                BeginDate = g.Max(x => x.BeginDate),
                SessionName = g.FirstOrDefault().SessionName,
                CourseTitle = g.FirstOrDefault().CourseTitle
            }).ToList();

            return(model);
        }
        public async Task <PersonIdentityModel> GetIdentity(string email)
        {
            var staffRepo = _container.GetInstance <IStaffRepository>();

            var validCampusLeaderDescriptors = _customParametersProvider.GetParameters().descriptors.validCampusLeaderDescriptors;

            var staffIdentity = await staffRepo.GetStaffPrincipalIdentityByEmailAsync(email, validCampusLeaderDescriptors, _dateProvider.Today());

            if (staffIdentity == null || !staffIdentity.Any())
            {
                staffIdentity = await staffRepo.GetStaffPrincipalIdentityByProfileEmailAsync(email, validCampusLeaderDescriptors, _dateProvider.Today());
            }

            // If email doesnt exist on edfi emails or profile emails it isn't a staff, it can't handle so it returns null.
            if (staffIdentity == null || !staffIdentity.Any())
            {
                return(null);
            }

            // TODO: handle case where there are duplicates
            var personInfo = staffIdentity.FirstOrDefault();

            personInfo.PersonType = "CampusLeader";

            return(personInfo);
        }
        public async Task <StudentBehavior> GetStudentBehaviorAsync(int studentUsi)
        {
            var incidents = await _studentRepository.GetStudentDisciplineIncidentsAsync(studentUsi, _customParametersProvider.GetParameters().descriptors.disciplineIncidentDescriptor, _dateProvider.Today());

            var externalLink = _customParametersProvider.GetParameters().behavior.linkToSystemWithDetails;
            var behaviorLink = new LinkModel {
                Title = externalLink.title, LinkText = externalLink.linkText, Url = externalLink.url
            };

            var model = new StudentBehavior
            {
                DateAsOf = DateTime.Now,
                YearToDateDisciplineIncidentCount = incidents.Count,
                Interpretation      = InterpretIncidentCount(incidents.Count),
                DisciplineIncidents = incidents,
                ExternalLink        = behaviorLink
            };


            return(model);
        }
Exemplo n.º 4
0
 public void Init(DiaryItem diaryItem = null)
 {
     _diaryItem      = diaryItem == null ? new DiaryItem() : diaryItem;
     _diaryItem.Date = _dateProvider.Today();
 }
        public async Task <AllRecipients> GetAllParentRecipients(int?studentUsi, string recipientUniqueId, int recipientTypeId, int rowsToSkip, int rowsToRetrieve)
        {
            var validLeadersDescriptors = _customParametersProvider.GetParameters().descriptors.validCampusLeaderDescriptors;
            var model = await _communicationsRepository.GetAllParentRecipients(studentUsi, recipientUniqueId, recipientTypeId, rowsToSkip, rowsToRetrieve, validLeadersDescriptors, _dateProvider.Today());

            return(model);
        }
Exemplo n.º 6
0
 public int GetNumberOfPastDays(Budget budget)
 {
     return(_dateProvider.Today() > budget.Start
         ? (int)(_dateProvider.Today() - budget.Start).TotalDays
         : 0);
 }