示例#1
0
        public async Task <IEnumerable <TranscriptRequestResponseModel> > GetTranscriptRequestByPortfolioIdAsync(int portfolioId, int userAccountId)
        {
            var requestsDtos = await _transcriptRequestRepo.GetTranscriptRequestByPortfolioIdAsync(portfolioId);

            var timeZoneId = await _timeZoneRepository.GeTimeZoneIdByPortfolioIdAsync(portfolioId);

            var timeZoneDetail = await _timeZoneRepository.GeTimeZoneDetailByIdAsync(timeZoneId);

            var transcriptRequests = new List <TranscriptRequestResponseModel>();

            foreach (var requestDto in requestsDtos)
            {
                var transcriptRequest = new TranscriptRequestResponseModel {
                    Id     = requestDto.Id,
                    InunId = requestDto.InunId,
                    ReceivingInstitutionCode = requestDto.ReceivingInstitutionCode,
                };

                transcriptRequest.LatestHistory = new TranscriptRequestHistoryEvent {
                    IsCreatedByStudent = requestDto.LatestHistory.ModifiedById == userAccountId,
                    Status             = (TranscriptRequestStatus)requestDto.LatestHistory.TranscriptStatusId,
                    StatusDate         = requestDto.LatestHistory.StatusDateUTC == null ?
                                         requestDto.LatestHistory.StatusDateUTC :
                                         DateTimeHelper.GetLocalTime(requestDto.LatestHistory.StatusDateUTC ?? default(DateTime), timeZoneDetail),
                    TranscriptRequestType = (TranscriptRequestType)requestDto.LatestHistory.TranscriptRequestTypeId
                };

                transcriptRequests.Add(transcriptRequest);
            }

            return(transcriptRequests);
        }
        public async Task <StudentTranscriptResponseModel> GetStudentTranscriptResponseModelAsync(StudentTranscriptViewModel studentTranscript, int portfolioId)
        {
            var timeZoneId = await _timeZoneRepository.GeTimeZoneIdByPortfolioIdAsync(portfolioId);

            var timeZoneDetail = await _timeZoneRepository.GeTimeZoneDetailByIdAsync(timeZoneId);

            return(new StudentTranscriptResponseModel()
            {
                Id = studentTranscript.Id,
                AvatarUrl = string.IsNullOrWhiteSpace(studentTranscript.AvatarFileName) ? _avatarService.GetStudentAvatarDefaultUrl() : _avatarService.GetStudentAvatarUrl(studentTranscript),
                StudentName = studentTranscript.StudentName,
                DateOfBirth = studentTranscript.DateOfBirth,
                GradeId = studentTranscript.GradeId,
                GradeKey = studentTranscript.GradeKey,
                StudentId = studentTranscript.StudentId,
                TranscriptId = studentTranscript.TranscriptId,
                ReceivedDateUtc = studentTranscript.ReceivedDateUtc == null
                    ? studentTranscript.ReceivedDateUtc
                    : DateTimeHelper.GetLocalTime(studentTranscript.ReceivedDateUtc ?? default(DateTime), timeZoneDetail)
            });
        }