/// <summary> /// Retrieves the crew lists. /// </summary> /// <param name="personSearchParameter">The person search parameter.</param> /// <param name="isAlertCount">if set to <c>true</c> [is alert count].</param> /// <param name="crewIds">The crew ids.</param> /// <returns>The Crew list.</returns> private async Task<ListResult<Person>> RetrieveCrewLists(PersonSearchParameter personSearchParameter, bool isAlertCount, List<string> crewIds) { ListResult<Person> personList = new ListResult<Person>(); if (crewIds.Count == 0 || !string.IsNullOrWhiteSpace(personSearchParameter.Birthdate) || !string.IsNullOrWhiteSpace(personSearchParameter.ReservationNo)) { return personList; } ListResult<Stateroom> staterooms = new ListResult<Stateroom>(); var crews = await this.crewClientRepository.RetrieveCrewmembersList(crewIds.RetrieveIds(id => id), personSearchParameter.LastNameContains, null, personSearchParameter.Citizenship, personSearchParameter.PassportNo, 1, int.MaxValue, CrewDepths.Crew); if (string.IsNullOrWhiteSpace(personSearchParameter.Stateroom)) { var crewStateroomIds = crews.Items.RetrieveIds(a => a.StateroomId); if (!string.IsNullOrWhiteSpace(crewStateroomIds)) { staterooms = await this.RetrieveStaterooms(crewStateroomIds.TrimEnd(','), null); } } PersonMapper.MapPersonsByCrews(crews, staterooms, personList); var alerts = await this.RetrievePersonAlerts(personSearchParameter, personList.Items.RetrieveIds(p => p.PersonId)); PersonMapper.MapPersonAlerts(alerts, personList); personList.AssignItems(personList.Items.Where(item => isAlertCount ? item.AlertCount > 0 : item.MessageCount > 0).ToList()); personList.TotalResults = personList.Items.Count; personList.CrewTotalResults = personList.Items.Count; return personList; }
/// <summary> /// Retrieves the guests list. /// </summary> /// <param name="personSearchParameter">The person search parameter.</param> /// <param name="isAlertCount">if set to <c>true</c> [is alert count].</param> /// <param name="guestIds">The guest ids.</param> /// <returns>The guest list.</returns> private async Task<ListResult<Person>> RetrieveGuestsList(PersonSearchParameter personSearchParameter, bool isAlertCount, List<string> guestIds) { ListResult<Person> personList = new ListResult<Person>(); if (guestIds.Count == 0 || !string.IsNullOrWhiteSpace(personSearchParameter.Birthdate)) { return personList; } ListResult<Stateroom> staterooms = new ListResult<Stateroom>(); var guests = await this.guestRepository.RetrieveGuests(personSearchParameter.LastNameContains, null, personSearchParameter.VoyageId, personSearchParameter.ReservationNo, personSearchParameter.PassportNo, personSearchParameter.Citizenship, guestIds.RetrieveIds(id => id), 1, int.MaxValue); if (string.IsNullOrWhiteSpace(personSearchParameter.Stateroom)) { var guestStateroomIds = guests.Items.RetrieveIds(a => a.ReservationDetail.StateroomId); if (!string.IsNullOrWhiteSpace(guestStateroomIds)) { staterooms = await this.RetrieveStaterooms(guestStateroomIds.TrimEnd(','), null); } } PersonMapper.MapPersonsByGuests(guests, staterooms, personList); var alerts = await this.RetrievePersonAlerts(personSearchParameter, personList.Items.RetrieveIds(p => p.PersonId)); PersonMapper.MapPersonAlerts(alerts, personList); personList.AssignItems(personList.Items.Where(item => isAlertCount ? item.AlertCount > 0 : item.MessageCount > 0).ToList()); personList.TotalResults = personList.Items.Count; personList.GuestTotalResults = personList.Items.Count; return personList; }
/// <summary> /// Retrieves the visitor lists. /// </summary> /// <param name="personSearchParameter">The person search parameter.</param> /// <param name="visitorIds">The visitor ids.</param> /// <param name="isAlertCount">if set to <c>true</c> [is alert count].</param> /// <returns>The visitors list.</returns> private async Task<ListResult<Person>> RetrieveVisitorLists(PersonSearchParameter personSearchParameter, List<string> visitorIds, bool isAlertCount) { ListResult<Person> personList = new ListResult<Person>(); if (visitorIds.Count == 0 || !string.IsNullOrWhiteSpace(personSearchParameter.Stateroom) || !string.IsNullOrWhiteSpace(personSearchParameter.ReservationNo)) { return personList; } var visitor = await this.visitorClientRepository.RetrieveVisitors(visitorIds.RetrieveIds(id => id), personSearchParameter.LastNameContains, personSearchParameter.Citizenship, personSearchParameter.Birthdate, personSearchParameter.PassportNo, null, null, null, null, null, 1, int.MaxValue, VisitorDepths.Visitor, null); PersonMapper.MapPersonsByVisitors(visitor, personList); var alerts = await this.RetrievePersonAlerts(personSearchParameter, personList.Items.RetrieveIds(p => p.PersonId)); PersonMapper.MapPersonAlerts(alerts, personList); personList.AssignItems(personList.Items.Where(item => isAlertCount ? item.AlertCount > 0 : item.MessageCount > 0).ToList()); personList.TotalResults = personList.Items.Count; personList.VisitorTotalResults = personList.Items.Count; return personList; }