Esempio n. 1
0
        /// <summary>
        /// Lists the asynchronous.
        /// </summary>
        /// <param name="guestSearchParameters">The guest search parameters.</param>
        /// <returns>
        /// Return List Result of person
        /// </returns>
        public async Task<ICollection<Guest>> RetrieveTravelWithAsync(GuestSearchParameters guestSearchParameters)
        {
            if (guestSearchParameters != null && (!string.IsNullOrWhiteSpace(guestSearchParameters.GuestIds) || !string.IsNullOrWhiteSpace(guestSearchParameters.ReservationNumbers)))
            {
                var searchParameters = new PersonSearchParameter { GuestIds = guestSearchParameters.GuestIds, PageNumber = guestSearchParameters.PageNumber, MaxResults = guestSearchParameters.MaxResults };
                if (!string.IsNullOrWhiteSpace(guestSearchParameters.ReservationNumbers))
                {
                    searchParameters.ReservationIds = await this.GetTravelWithGuest(guestSearchParameters);
                }

                return !string.IsNullOrEmpty(searchParameters.ReservationIds) ? await this.MapGuestAlerts(await this.RetrieveGuest(searchParameters), guestSearchParameters) : new Collection<Guest>();
            }

            return new Collection<Guest>();
        }
Esempio n. 2
0
        /// <summary>
        /// Retrieves the travel with guest.
        /// </summary>
        /// <param name="guestSearchParameters">The guest search parameters.</param>
        /// <returns>
        /// The response
        /// </returns>
        private async Task<string> GetTravelWithGuest(GuestSearchParameters guestSearchParameters)
        {
            var reservations = await this.guestRepository.GetTravelWithPartyAsync(guestSearchParameters);

            if (reservations.Items.Count > 0)
            {
                var reservationIdsParameter = string.Empty;
                foreach (var reservation in reservations.Items)
                {
                    var reservationIdList = reservation.TravelPartyReservationIds.ToList();
                    reservationIdsParameter += string.Join(CommaSeparator, reservationIdList);
                    reservationIdsParameter = reservationIdsParameter + CommaSeparator;
                }

                return reservationIdsParameter.TrimEnd(CommaSeparatorCharacter);
            }

            return null;
        }
Esempio n. 3
0
        /// <summary>
        /// Maps the guests alerts.
        /// </summary>
        /// <param name="guests">The guests.</param>
        /// <param name="searchParameters">The search parameters.</param>
        /// <returns>
        /// Task instance
        /// </returns>
        private async Task<ICollection<Guest>> MapGuestAlerts(ICollection<Guest> guests, GuestSearchParameters searchParameters)
        {
            if (guests != null && guests.Count > 0)
            {
                var personSearchParameter = new PersonSearchParameter { ReservationNumbers = searchParameters.ReservationNumbers, VoyageIds = searchParameters.VoyageIds, MaxResults = searchParameters.MaxResults, PageNumber = searchParameters.PageNumber, OrderBy = searchParameters.OrderBy };
                var personTypeList = await this.referenceDataRepository.RetrievePersonTypeListAsync();
                var guestPersonType = personTypeList.Items.FirstOrDefault(a => a.Name.Equals(PersonTypes.Guest.ToString(), StringComparison.OrdinalIgnoreCase));
                var personStatus = guestPersonType != null ? await this.RetrievePersonStatus(guests.RetrieveIds(a => a.GuestId), PersonStatusConstant, guestPersonType.PersonTypeId, personSearchParameter) : null;
                searchParameters.GuestIds = guests.RetrieveIds(a => a.GuestId);
                var staterooms = DIContainer.Instance.Resolve<ShipClientRepository>().RetrieveStateroomListAsync(searchParameters.ShipId);
                var guestReservationDetails = this.guestCruiseDetailManager.RetrieveReservation(personSearchParameter);
                await Task.WhenAll(staterooms, guestReservationDetails);
                var guestCollection = await this.guestCruiseDetailManager.MapGuestDetails(guests, personStatus, searchParameters.ShipId, guestPersonType != null ? guestPersonType.PersonTypeId : string.Empty, guestReservationDetails.Result, staterooms.Result);
                var personAlertClientRepository = DIContainer.Instance.Resolve<PersonAlertClientRepository>();
                await personAlertClientRepository.RetrieveAlertTypes();
                if (GlobalCachingProvider.Instance.FindKey(DataAccess.Entities.CacheKey.AlertTypes.ToString()))
                {
                    var list = GlobalCachingProvider.Instance.GetItem(DataAccess.Entities.CacheKey.AlertTypes.ToString()) as ListResult<DataAccess.Entities.AlertType>;
                    var messageList = await personAlertClientRepository.RetrieveMessageTypes(searchParameters.AlertMessageStartDate, searchParameters.AlertMessageEndDate);
                    if (list != null || messageList != null)
                    {
                        var result = await GuestCruiseDetailManager.RetrievePersonAlertDetails(list, messageList, searchParameters.GuestIds, searchParameters.AlertMessageStartDate, searchParameters.AlertMessageEndDate);

                        if (result.Item1.Items.Count > 0 || result.Item3.Items.Count > 0)
                        {
                            if (guestCollection != null && guestCollection.Count > 0)
                            {
                                lock (this.syncLock)
                                {
                                    guestCollection.ForEach(guest => { PersonAlertMapper.MapGuests(guest, result.Item2, result.Item1, list); PersonMessagesMapper.MapGuests(guest, result.Item3, messageList); });
                                }
                            }
                        }
                    }
                }
            }

            return guests;
        }
Esempio n. 4
0
 /// <summary>
 /// Retrieves the travel with guest.
 /// </summary>
 /// <param name="guestSearchParameters">The guest search parameters.</param>
 /// <returns>
 /// The response
 /// </returns>
 public async Task<ListResult<Reservation>> GetTravelWithPartyAsync(GuestSearchParameters guestSearchParameters)
 {
     return await this.reservationClientRepository.RetrieveTravelWithParty(guestSearchParameters);
 }
        public async Task RetrieveTravelWithPartyAsync()
        {
            try
            {
                var searchFilter = new GuestSearchParameters
                {
                    ReservationNumbers = "ADER34",
                    GuestIds = string.Empty,
                    VoyageIds = string.Empty,
                    PageNumber = 1,
                    MaxResults = 50
                };

                Common.Dependencies.Register();
                DIContainer.Instance.RegisterType<PersonAlertClientRepository>(new ContainerControlledLifetimeManager());
                DIContainer.Instance.RegisterType<IAlertClient, AlertClient>();
                DIContainer.Instance.RegisterType<IAlertTypeClient, AlertTypeClient>();
                DIContainer.Instance.RegisterType<IMessageClient, MessageClient>();
                DIContainer.Instance.RegisterType<IPersonAlertsClient, PersonAlertsClient>();
                DIContainer.Instance.RegisterType<IPersonMessageClient, PersonMessageClient>();
                DIContainer.Instance.RegisterType<ILocationClient, LocationClient>();
                DIContainer.Instance.RegisterType<IStateroomCategoriesClient, StateroomCategoriesClient>();
                DIContainer.Instance.RegisterType<IStateroomCategoryTypesClient, StateroomCategoryTypesClient>();
                DIContainer.Instance.RegisterType<IStateroomClient, StateroomClient>();
                DIContainer.Instance.RegisterType<IReservationClient, ReservationClient>();
                DIContainer.Instance.RegisterType<IShipClient, ShipClient>();
                DIContainer.Instance.RegisterType<ISafetyRoleClient, SafetyRoleClient>();
                DIContainer.Instance.Resolve<IApplicationSetting>().PersonNotificationServiceBaseAddress = "http://Localhost/";
                DIContainer.Instance.Resolve<IApplicationSetting>().ReservationServiceBaseAddress = "http://Localhost/";
                DIContainer.Instance.Resolve<IApplicationSetting>().ShipServiceBaseAddress = "http://Localhost/";
                this.SetupDataForPersonTypeList();
                this.SetTravelData();
                this.SetupDataForStatusTypeList();
                this.SetupRetrievePersonStatusListAsync();
                var result = await this.manager.RetrieveTravelWithAsync(searchFilter);
                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);
            }
            finally
            {
                this.Dispose();
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Retrieves the guests.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <returns>
        /// Guest task
        /// </returns>
        public async Task<ListResult<Guest>> ListAsync(GuestSearchParameters filter)
        {
            string stateRoomIds = null;
            if (!string.IsNullOrWhiteSpace(filter.Staterooms))
            {
                var stateRooms = await this.shipRepository.GetStateroomListAsync(this.applicationSettings.ShipId, null, filter.Staterooms, null, null);
                stateRoomIds = stateRooms.Items.RetrieveIds(item => item.StateroomId);
            }

            return await this.guestRepository.RetrieveGuests(filter.LastNameContains, stateRoomIds, null, filter.ReservationIds, filter.Passports, filter.Citizenship, filter.GuestIds, filter.PageNumber, filter.MaxResults);
        }
Esempio n. 7
0
 /// <summary>
 /// Retrieves the guests.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <returns>
 /// Guest task
 /// </returns>
 public async Task<ListResult<Guest>> ListAsync(GuestSearchParameters filter)
 {
     return await this.guestData.ListAsync(filter);
 }
Esempio n. 8
0
        public async Task RetrieveGuestListAsyncTest()
        {
            var guestSearchParameters = new GuestSearchParameters
            {
                Citizenship = "IND",
                FirstNameContains = "A",
                GuestIds = "3",
                LastNameContains = "G",
                Passports = "33",
                ReservationEndDate = "2015-07-10 12:12:12:120",
                ReservationIds = "2",
                ReservationStartDate = "2015-07-10 12:12:12:120",
                ShipId = "3",
                Staterooms = "3",
                ModifiedParts = "visitor",
                MaxResults = 50,
                OrderBy = "GuestIds",
                PageNumber = 2,
                Parts = "$all",
            };

            this.guest.Items.Add(new Guest { AddedDate = DateTime.Now, LastModifiedDate = DateTime.Now, GuestId = "2", SecurityPhotoAddress = "http://devweb03.decurtis.com/ImagingMediaService/MediaItems/200092", PersonalDetail = new PersonalDetail { Birthdate = DateTime.Now, CitizenshipCountryId = "2", DepartmentId = "2", DepartmentPOC = "2", Email = "*****@*****.**", FirstName = "bryan", Gender = "M", LastName = "Finch", MaritalStatus = "Single", MiddleName = "trot", Note = "agree", Occupation = "eng", PassportNo = "3432", Title = "Mr", VisitorCardId = "3" }, ReservationDetail = new Reservation { DocumentNumber = "43", DocumentTypeId = "4", LoyaltyLevelTypeId = "4", ReservationId = "4", ReservationNumber = "4423", StateroomId = "2" } });

            this.guestRepository.Setup(mockItem => mockItem.RetrieveGuests(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int?>(), It.IsAny<int?>())).Returns(Task.FromResult(this.guest));

            var stateRooms = new ListResult<Stateroom>();
            stateRooms.Items.Add(new Stateroom { StateroomId = "1", Capacity = 2, StateroomCategoryId = "2", StateroomNumber = "2" });
            this.shipRepository.Setup(mockItem => mockItem.GetStateroomListAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int?>(), It.IsAny<int?>())).Returns(Task.FromResult(stateRooms));

            var alert = await this.guestData.ListAsync(guestSearchParameters);
            var searchQueryString = guestSearchParameters.ToQueryString();
            Assert.IsNotNull(alert);
            Assert.IsTrue(searchQueryString.Contains("GuestIds"));
            Assert.IsNotNull(alert);
        }
        public async Task RetrieveGuestControllerTravelWithTest()
        {
            try
            {
                var searchFilter = new GuestSearchParameters
                {
                    ReservationNumbers = "1ART8",
                    GuestIds = string.Empty,
                    VoyageIds = string.Empty,
                    PageNumber = 1,
                    MaxResults = 20,
                    AlertMessageEndDate = string.Empty,
                    AlertMessageStartDate = string.Empty,
                    ShipId = string.Empty
                };

                Dependencies.Register();
                this.SetTravelWiths();
                ////SetupController(this.controller);
                var response = await this.controller.TravelWiths(searchFilter);
                var result = await response.ExecuteAsync(new CancellationToken(false));
                Assert.IsTrue(result.IsSuccessStatusCode);
                Assert.IsTrue(result.StatusCode == HttpStatusCode.OK);
            }
            finally
            {
                this.Dispose();
            }
        }
 /// <summary>
 /// Retrieves the travel with party.
 /// </summary>
 /// <param name="searchParameters">The guest search parameters.</param>
 /// <returns>
 /// The response.
 /// </returns>
 public async Task<ListResult<Reservation>> RetrieveTravelWithParty(GuestSearchParameters searchParameters)
 {
     var task = await this.reservationClient.RetrieveReservationListAsync(reservationIds: null, fareTypeIds: null, packageIds: null, folioNumber: null, isFullReservation: null, stateroomIds: null, accessCardNumber: null, reservationNumbers: searchParameters.ReservationNumbers, voyageIds: searchParameters.VoyageIds, guestIds: searchParameters.GuestIds, parts: !string.IsNullOrWhiteSpace(searchParameters.Parts) ? searchParameters.Parts : TravelWithParts, pageNumber: searchParameters.PageNumber.HasValue ? searchParameters.PageNumber.Value : default(int?), maxResults: searchParameters.MaxResults.HasValue ? searchParameters.MaxResults.Value : 0, orderBy: searchParameters.OrderBy);
     return task != null ? JsonConvert.DeserializeObject<ListResult<Reservation>>(task) : default(ListResult<Reservation>);
 }