Beispiel #1
0
        public async Task <PagedViewModelResult <BookedPassInformationViewModel> > GetBookingInformation(SearchParams searchParams)
        {
            _logger.LogInfo("Trying to get booking information");
            try
            {
                PagedViewModelResult <BookedPassInformationViewModel> activeBookingInfo = _mapper.Map <PaginatedList <BookedPassInformation>, PagedViewModelResult <BookedPassInformationViewModel> >(await _configurationRepo.GetBookingInformation(_mapper.Map <PassInfoSearchParams>(searchParams)));

                //Get all booking information based on language
                var activeInfo = new List <BookedPassInformationViewModel>();
                foreach (var item in activeBookingInfo.Items)
                {
                    //Filter based on language from the paginated result.
                    if (item.PassInformation != null)
                    {
                        item.PassInformation.PassDescription = item?.PassInformation?.PassDescription.Where(p => p.SelectedLanguage == searchParams.Lang);
                    }
                }
                _logger.LogInfo("Retrieved booking information");
                return(activeBookingInfo);
            }
            catch (Exception ex)
            {
                _logger.LogInfo(ex.Message);
                return(null);
            }
        }
Beispiel #2
0
        public async Task <PagedViewModelResult <PTOInformationViewModel> > GetAllActivePTOs(SearchParams searchParams)
        {
            _logger.LogInfo("Trying to get all active PTOs on language " + searchParams.Lang);
            try
            {
                PagedViewModelResult <PTOInformationViewModel> ptoInformation = _mapper.Map <PaginatedList <PTOInformation>, PagedViewModelResult <PTOInformationViewModel> >(await _ptoRepository.GetActivePTOs(_mapper.Map <PassInfoSearchParams>(searchParams)));

                //Get all PTOs which PTO descriptions are available
                var activePTOs = new List <PTOInformationViewModel>();
                foreach (var item in ptoInformation.Items)
                {
                    //Filter based on language from the paginated result.
                    item.PTODescription = item?.PTODescription?.Where(p => p.SelectedLanguage == searchParams.Lang);
                    if (item.PTODescription.Count() > 0)
                    {
                        activePTOs.Add(item);
                    }
                }
                ptoInformation.Items = activePTOs;
                _logger.LogInfo("Retrieved all active PTOs on language " + searchParams.Lang);
                return(ptoInformation);
            }
            catch (Exception ex)
            {
                _logger.LogInfo(ex.Message);
                return(null);
            }
        }
Beispiel #3
0
 public async Task <PagedViewModelResult <CurrencyViewModel> > GetActiveCurriencies(SearchParams searchParams)
 {
     _logger.LogInfo("Trying to get active curriencies");
     try
     {
         PagedViewModelResult <CurrencyViewModel> activeCurriencies = _mapper.Map <PaginatedList <CurrencyConfiguration>, PagedViewModelResult <CurrencyViewModel> >(await _configurationRepo.GetActiveCurriencies(_mapper.Map <PassInfoSearchParams>(searchParams)));
         _logger.LogInfo("Retrieved active curriencies");
         return(activeCurriencies);
     }
     catch (Exception ex)
     {
         _logger.LogInfo(ex.Message);
         return(null);
     }
 }
Beispiel #4
0
 public async Task <PagedViewModelResult <TravellerFeedbackViewModel> > GetTravellerFeedback(SearchParams searchParams)
 {
     _logger.LogInfo("Trying to get active feedback information");
     try
     {
         PagedViewModelResult <TravellerFeedbackViewModel> activeFeedback = _mapper.Map <PaginatedList <TravellerFeedback>, PagedViewModelResult <TravellerFeedbackViewModel> >(await _configurationRepo.GetTravellerFeedback(_mapper.Map <PassInfoSearchParams>(searchParams)));
         _logger.LogInfo("Retrieved feedback information");
         return(activeFeedback);
     }
     catch (Exception ex)
     {
         _logger.LogInfo(ex.Message);
         return(null);
     }
 }
Beispiel #5
0
        public async Task <PagedViewModelResult <BookedPassInformationViewModel> > GetAvailablePasses(SearchParams searchParams)
        {
            _logger.LogInfo("Trying to get all available passes for " + searchParams.DeviceId);
            try
            {
                //Get active user based on device id
                Traveller travellerInfo = _travellerRepository.GetTravellerByDeviceId(searchParams.DeviceId);
                if (travellerInfo == null)
                {
                    throw new Exception(string.Format(_messageHandler.GetMessage(ErrorMessagesEnum.InValidTravellerInformation)));
                }

                //Get all active booking informations
                searchParams.TravellerId      = travellerInfo.Id;
                searchParams.StartDateAndTime = DateTime.Now;
                PagedViewModelResult <BookedPassInformationViewModel> passInformation = _mapper.Map <PaginatedList <BookedPassInformation>, PagedViewModelResult <BookedPassInformationViewModel> >(await _travellerRepository.GetAvailablePasses(_mapper.Map <PassInfoSearchParams>(searchParams)));

                //Get all passes which pass descriptions are available
                var activePass = new List <BookedPassInformationViewModel>();
                _logger.LogInfo("Retrieved " + passInformation.Items.Count() + " number of booking information");
                foreach (var item in passInformation.Items)
                {
                    //Get all QR code based on booking id and filter only available booking information
                    if (item.PassInformation != null && item.PassInformation.PassExpiredDate >= searchParams.StartDateAndTime)
                    {
                        //Filter based on language from the paginated result.
                        item.PassInformation.PassDescription = item.PassInformation?.PassDescription?.Where(p => p.SelectedLanguage == searchParams.Lang);
                        if (item.PassInformation.PassDescription.Count() > 0)
                        {
                            activePass.Add(item);
                        }
                    }
                }
                passInformation.Items = activePass;
                _logger.LogInfo("Retrieved " + activePass.Count() + " available passes for " + searchParams.DeviceId);
                return(passInformation);
            }
            catch (Exception ex)
            {
                _logger.LogInfo(ex.Message);
                return(null);
            }
        }