Exemplo n.º 1
0
        public RoomTypeFactory(Esynctraining.AdobeConnect.IAdobeConnectProxy provider, LmsMeetingType roomType, ISeminarService seminarService)
        {
            // TODO: null check

            this.provider       = provider;
            this.roomType       = roomType;
            this.seminarService = seminarService;
        }
Exemplo n.º 2
0
        public PagedResult <IRecordingDto> GetRecordings(ILmsLicense lmsCompany, Esynctraining.AdobeConnect.IAdobeConnectProxy provider,
                                                         string courseId,
                                                         int id,
                                                         Func <IRoomTypeFactory> getRoomTypeFactory,
                                                         string sortBy,
                                                         string sortOrder,
                                                         string search,
                                                         long?dateFrom,
                                                         long?dateTo,
                                                         Func <IEnumerable <IRecordingDto>, IEnumerable <IRecordingDto> > applyAdditionalFilter,
                                                         int skip,
                                                         int take)
        {
            LmsCourseMeeting meeting = lmsCourseMeetingModel.GetOneByCourseAndId(lmsCompany.Id, courseId, id);

            if (meeting == null)
            {
                return(new PagedResult <IRecordingDto> {
                    Data = Enumerable.Empty <RecordingDto>(), Total = 0, Skip = skip, Take = take
                });
            }

            TimeZoneInfo timeZone = TimeZoneInfo.Utc; // acAccountService.GetAccountDetails(provider, IoC.Resolve<ICache>()).TimeZoneInfo;

            IEnumerable <IRecordingDto> result;
            var meetingSco = meeting.GetMeetingScoId();
            var commonInfo = provider.GetCommonInfo().CommonInfo;
            //if (commonInfo.MajorVersion <= 9 && commonInfo.MinorVersion < 1)
            //{
            //    result = GetRecordingsLegacy(meetingSco, commonInfo.AccountUrl, timeZone, provider);
            //}

            var factory             = getRoomTypeFactory();
            var recordingsExtractor = factory.GetRecordingExtractor();

            result = recordingsExtractor.GetRecordings(factory.GetRecordingDtoBuilder(), meetingSco, commonInfo.AccountUrl, timeZone);

            result = ApplyFilter(search, dateFrom, dateTo, result);
            result = ApplySort(sortBy, sortOrder, result);

            ProcessPublishedFlag(lmsCompany, meeting, result);

            //ACLTI-2101 possible solution
            //if (meeting.LmsMeetingType != (int)LmsMeetingType.StudyGroup)
            //{
            result = applyAdditionalFilter(result);
            //}

            var total = result.Count();

            result = result
                     .Skip(skip)
                     .Take(take)
                     .ToList();

            var acProxy = this.acAccountService.GetProvider(lmsCompany);

            Parallel.ForEach(result, (recording) =>
            {
                recording.IsPublic = IsPublicRecording(recording.Id, acProxy);
            });

            var pagedResult = new PagedResult <IRecordingDto> {
                Data = result, Total = total, Skip = skip, Take = take
            };

            return(pagedResult);
        }