Esempio n. 1
0
        public async Task <ActionResult> VerifyStudentHealthForm(int studentId, int healthFormId)
        {
            var currentSchoolYear = SchoolLocator.SchoolYearService.GetCurrentSchoolYearByStudent(studentId);
            await SchoolLocator.StudentService.VerifyStudentHealthForm(studentId, currentSchoolYear.Id, healthFormId);

            var res = await SchoolLocator.StudentService.GetStudentHealthForms(studentId, currentSchoolYear.Id);

            return(Json(StudentHealthFormViewData.Create(res)));
        }
Esempio n. 2
0
        public async Task <ActionResult> Info(int personId)
        {
            var currentSchoolYear = SchoolLocator.SchoolYearService.GetCurrentSchoolYearByStudent(personId);
            var syId  = currentSchoolYear.Id;
            var today = Context.NowSchoolTime;


            var studentSummaryInfoTask  = SchoolLocator.StudentService.GetStudentSummaryInfo(personId, syId);
            var stHealsConditionsTask   = SchoolLocator.StudentService.GetStudentHealthConditions(personId);
            var healthFormsTask         = SchoolLocator.StudentService.GetStudentHealthForms(personId, syId);
            var verifyHealthFormsAccess = SchoolLocator.StudentService.CanVerifyHealthForm(personId, syId);

            var studentDetailsInfo = SchoolLocator.StudentService.GetStudentDetailsInfo(personId, syId);

            var          studentClasses     = SchoolLocator.ClassService.GetStudentClasses(syId, personId);
            Room         currentRoom        = null;
            ClassDetails currentClass       = null;
            var          studentSummaryInfo = await studentSummaryInfoTask;

            if (studentSummaryInfo.CurrentSectionId.HasValue)
            {
                currentClass = studentClasses.FirstOrDefault(x => x.Id == studentSummaryInfo.CurrentSectionId.Value);
                if (currentClass?.RoomRef != null)
                {
                    currentRoom = SchoolLocator.RoomService.GetRoomById(currentClass.RoomRef.Value);
                }
            }
            var res = GetInfo(personId, currentSchoolYear.SchoolRef, personInfo => StudentInfoViewData.Create(personInfo, studentDetailsInfo,
                                                                                                              studentSummaryInfo, studentClasses, currentClass, currentRoom, syId));

            var studentContacts = SchoolLocator.ContactService.GetStudentContactDetails(personId);

            res.StudentContacts = StudentContactViewData.Create(studentContacts);

            var customAlerts = SchoolLocator.StudentCustomAlertDetailService.GetList(personId);

            res.StudentCustomAlertDetails = StudentCustomAlertDetailViewData.Create(customAlerts);

            res.HealthConditions         = StudentHealthConditionViewData.Create(await stHealsConditionsTask);
            res.HealthForms              = StudentHealthFormViewData.Create(await healthFormsTask);
            res.IsAbleVerifyHealthForms  = await verifyHealthFormsAccess;
            res.HasNotVerifiedHealthForm = res.HealthForms.Count > 0 &&
                                           res.HealthForms.Any(x => !x.VerifiedDate.HasValue);

            var homeroom = SchoolLocator.RoomService.GetStudentHomeroomOrNull(personId, syId);

            if (homeroom != null)
            {
                res.Homeroom = HomeroomViewData.Create(homeroom);
            }

            return(Json(res));
        }