/// <summary> /// Selects the person by search text. /// </summary> /// <param name="personsParty">The persons party.</param> /// <param name="searchText">The search text.</param> /// <param name="searchType">Type of the search.</param> /// <param name="visitorSearchType">Type of the visitor search.</param> /// <returns>Instance of PersonsParty</returns> internal static PersonsParty SelectPersonBySearchText(PersonsParty personsParty, string searchText, SearchType searchType, VisitorSearchType visitorSearchType) { if (visitorSearchType != VisitorSearchType.None) { AssignSelectedPerson(personsParty, personsParty.RetrievePersons().FirstOrDefault(), null); } else if (searchType == SearchType.LastName) { AssignSelectedPerson(personsParty, RetrievePersonByName(personsParty.RetrievePersons(), searchText).FirstOrDefault(), null); } else if (searchType == SearchType.Stateroom) { AssignSelectedPerson(personsParty, personsParty.RetrievePersons().FirstOrDefault(), null); } else if (searchType == SearchType.Reservation) { AssignSelectedPerson(personsParty, RetrievePersonByReservationNumber(personsParty.RetrievePersons(), searchText).FirstOrDefault(), null); } else if (searchType == SearchType.PassportNumber) { AssignSelectedPerson(personsParty, personsParty.RetrievePersons().FirstOrDefault(), null); } else if (searchType == SearchType.EmployeeNumber) { AssignSelectedPerson(personsParty, personsParty.RetrievePersons().FirstOrDefault(), null); } else if (searchType == SearchType.BarcodeScanning || searchType == SearchType.MagneticStripe || searchType == SearchType.RFID) { AssignSelectedPerson(personsParty, personsParty.RetrievePersons().FirstOrDefault(), null); } return personsParty; }
/// <summary> /// Function to retrieve persons party. /// </summary> /// <param name="persons">Instance of Persons</param> /// <param name="isFullStateroom">if set to <c>true</c> [is full stateroom].</param> /// <param name="isFromSearchFilter">if it is called from search filter.</param> /// <param name="searchType">Type of search</param> /// <returns>Instance of PersonsParty</returns> public async Task<PersonsParty> RetrieveParty(Person persons, bool isFullStateroom, bool isFromSearchFilter, SearchType searchType) { if (persons.CanCreateParty(searchType) && !isFromSearchFilter) { await this.CreateParty(persons, isFullStateroom); this.CurrentParty.IsPartyCreated = true; } else { this.CurrentParty = this.CurrentParty == null ? DIContainer.Instance.Resolve<PersonsParty>().AssignSearchedPersons(persons) : this.CurrentParty.AssignSearchedPersons(persons); this.CurrentParty.IsPartyCreated = false; DIContainer.Instance.Resolve<PhotoService>().RetrievePhotos(persons); } this.CurrentParty.IsAnyAdultAshore = false; this.CurrentParty.SearchType = searchType; return this.CurrentParty; }
/// <summary> /// Function to create persons party. /// </summary> /// <param name="persons">Instance of Persons</param> /// <param name="isFullStateroom">if set to <c>true</c> [is full stateroom].</param> /// <returns>Instance of PersonsParty</returns> public async Task<PersonsParty> CreateParty(Person persons, bool isFullStateroom) { this.CurrentParty = await DIContainer.Instance.Resolve<PersonsParty>().CreateParty(persons, isFullStateroom); ScreenKeyboardNativeMethods.HideKeyboard(); this.CurrentParty.IsPartyCreated = true; return this.CurrentParty; }
/// <summary> /// Selects the person. /// </summary> /// <param name="searchText">The search text.</param> /// <param name="searchType">Type of the search.</param> /// <param name="visitorSearchType">Type of the visitor search.</param> /// <param name="selectedPersonId">The selected person identifier.</param> /// <param name="personsParty">The persons party.</param> private static void SelectPerson(string searchText, SearchType searchType, VisitorSearchType visitorSearchType, string selectedPersonId, PersonsParty personsParty) { if (string.IsNullOrEmpty(selectedPersonId)) { SelectPersonInParty(() => PersonSelectionService.SelectPersonBySearchText(personsParty, searchText, searchType, visitorSearchType)); } else { SelectPersonInParty(() => PersonSelectionService.SelectPersonByPersonIdentity(personsParty, new PersonIdentity { PersonId = selectedPersonId })); } }
/// <summary> /// Function to select person by person identity. /// </summary> /// <param name="personsParty">PersonsParty information</param> /// <param name="personIdentity">Person identity information</param> /// <returns>Instance of PersonsParty</returns> internal static PersonsParty SelectPersonByPersonIdentity(PersonsParty personsParty, PersonIdentity personIdentity) { AssignSelectedPerson(personsParty, RetrievePersonByPersonIdentity(personsParty.RetrievePersons(), personIdentity).FirstOrDefault(), null); return personsParty; }
/// <summary> /// Function to select first person in the party. /// </summary> /// <param name="personsParty">PersonsParty information</param> /// <returns>Instance of PersonsParty</returns> internal static PersonsParty SelectFirstPerson(PersonsParty personsParty) { AssignSelectedPerson(personsParty, personsParty.RetrievePersons().FirstOrDefault(), null); return personsParty; }
/// <summary> /// Function to assign selected person. /// </summary> /// <param name="personsParty">Instance of PersonsParty</param> /// <param name="person">Instance of Person</param> /// <param name="gangwayEventProcessType">Gangway event process type</param> internal static void AssignSelectedPerson(PersonsParty personsParty, PersonBase person, GangwayEventProcessType? gangwayEventProcessType) { if (person == null) { return; } if (personsParty.SelectedPerson != null) { personsParty.Guests.Iterate(g => { g.IsSelected = false; g.NotifyPropertyChange("IsSelected"); }); personsParty.Crew.Iterate(c => { c.IsSelected = false; c.NotifyPropertyChange("IsSelected"); }); personsParty.Visitors.Iterate(v => { v.IsSelected = false; v.NotifyPropertyChange("IsSelected"); }); personsParty.SelectedPerson.IsSelected = false; } if (person.PersonType == PersonType.Guest) { personsParty.Guests.Where(guest => guest.GuestId.Equals(person.PersonId)).Iterate(guest => guest.IsSelected = true); } else if (person.PersonType == PersonType.Crewmember) { personsParty.Crew.Where(crew => crew.CrewmemberId.Equals(person.PersonId)).Iterate(crew => crew.IsSelected = true); } else if (person.PersonType == PersonType.Visitor) { personsParty.Visitors.Where(visitor => visitor.VisitorId.Equals(person.PersonId)).Iterate(visitor => visitor.IsSelected = true); } person.GangwayEventProcessType = gangwayEventProcessType.HasValue ? gangwayEventProcessType.Value : person.GangwayEventProcessType; var selectedPerson = RetriveSelectedPersonFromParty(person, personsParty); if (selectedPerson != null) { personsParty.SelectedPerson = selectedPerson; personsParty.NotifyPropertyChange("SelectedPerson"); } }
/// <summary> /// Function to retrieve selected person from party. /// </summary> /// <param name="person">Instance of PersonBase</param> /// <param name="personsParty">Instance of PersonsParty</param> /// <returns>Selected Person</returns> private static PersonBase RetriveSelectedPersonFromParty(PersonBase person, PersonsParty personsParty) { PersonBase selectedPerson = null; if (person.PersonType == PersonType.Guest) { if (personsParty.Guests != null && personsParty.Guests.Count > 0) { var guest = personsParty.Guests.FirstOrDefault(g => g.GuestId.Equals(person.PersonId, StringComparison.OrdinalIgnoreCase)); if (guest != null) { selectedPerson = guest.MapToPersonBase(); } } } else if (person.PersonType == PersonType.Crewmember) { if (personsParty.Crew != null && personsParty.Crew.Count > 0) { var crewmember = personsParty.Crew.FirstOrDefault(c => c.CrewmemberId.Equals(person.PersonId, StringComparison.OrdinalIgnoreCase)); if (crewmember != null) { selectedPerson = crewmember.MapToPersonBase(); } } } else if (person.PersonType == PersonType.Visitor) { if (personsParty.Visitors != null && personsParty.Visitors.Count > 0) { var visitor = personsParty.Visitors.FirstOrDefault(v => v.VisitorId.Equals(person.PersonId, StringComparison.OrdinalIgnoreCase)); if (visitor != null) { selectedPerson = visitor.MapToPersonBase(); } } } return selectedPerson; }
/// <summary> /// Manages the party. /// </summary> /// <param name="personsParty">The persons party.</param> private void ManageParty(PersonsParty personsParty) { Messenger.Instance.Notify(MessengerMessage.ShowSpinWheel, false); Messenger.Instance.Notify(MessengerMessage.ShowViewOnShell, ViewType.PartyDetails); if (this.workstation.FlowDirection == FlowDirection.AgeVerification) { Messenger.Instance.Notify(MessengerMessage.ShowAgeVerificationPopup, null); } if (personsParty != null) { this.PersonList.Where(p => p.IsSelected && p.PersonId != personsParty.SelectedPerson.PersonId).Iterate(p => p.IsSelected = false); } }
/// <summary> /// Users the control loaded. /// </summary> private void UserControlLoaded() { this.CurrentParty = DIContainer.Instance.Resolve<PersonsPartyManager>().CurrentParty; }
/// <summary> /// Manages the party. /// </summary> /// <param name="personsParty">The persons party</param> private void ManageParty(PersonsParty personsParty) { Messenger.Instance.Notify(MessengerMessage.ShowSpinWheel, false); Messenger.Instance.Notify(MessengerMessage.ShowViewOnShell, ViewType.PartyDetails); if (personsParty != null) { this.PersonList.Where(p => p.IsSelected && p.PersonId != personsParty.SelectedPerson.PersonId).Iterate(p => p.IsSelected = false); } }
/// <summary> /// Shows the disabled card message. /// </summary> /// <param name="currentParty">The current party.</param> /// <param name="isGuestFromExistingParty">if set to <c>true</c> [is guest from existing party].</param> private void ShowDisabledCardMessage(PersonsParty currentParty, bool isGuestFromExistingParty) { this.IsStopLoadParty = false; if (currentParty.IsPartyCreated && currentParty.Guests.Any(g => g.IsDisabledCard)) { if (!isGuestFromExistingParty && this.CurrentViewType == ViewType.PartyDetails) { Messenger.Instance.Notify(MessengerMessage.ResetCurrentParty); Messenger.Instance.Notify(MessengerMessage.ShowViewOnShell, ViewType.Home); } Messenger.Instance.Notify(MessengerMessage.ShowSpinWheel, false); Messenger.Instance.Notify(MessengerMessage.ShowDisabledCard, Properties.Resources.DisabledCardMessage); this.IsStopLoadParty = true; if (this.CurrentViewType != ViewType.PartyDetails) { Messenger.Instance.Notify(MessengerMessage.ResetCurrentParty); } if (!isGuestFromExistingParty) { currentParty.IsPartyCreated = false; } Messenger.Instance.Notify(MessengerMessage.PlaySound, AudibleAlert.Alert); } else { Messenger.Instance.Notify(MessengerMessage.CloseDisabledCard); } }
/// <summary> /// Sets the error text message. /// </summary> /// <param name="cardDetail">The card detail.</param> /// <param name="currentParty">The current party.</param> private void SetErrorTextMessage(CardInformation cardDetail, PersonsParty currentParty) { this.SearchErrorText = string.Empty; if (this.CurrentViewType == ViewType.PartyDetails && !string.IsNullOrEmpty(currentParty.PartyDetailSelectedTab) && currentParty.PartyDetailSelectedTab.Equals(AssignCard) && cardDetail.RetrieveCardPersonType().FirstOrDefault() != PersonType.Visitor) { this.SearchErrorText = Properties.Resources.VisitorCardErrorMessage; } else { this.SearchErrorText = Properties.Resources.NoResultForBarcode; } }
/// <summary> /// Assigns the visitor access card. /// </summary> /// <param name="cardDetail">The card detail.</param> /// <param name="currentParty">The current party.</param> private void AssignVisitorAccessCard(CardInformation cardDetail, PersonsParty currentParty) { this.IsPopupOpen = false; if (!string.IsNullOrEmpty(currentParty.SelectedPerson.CardNumber) && currentParty.SelectedPerson.CardNumber.Equals(cardDetail.Id) && currentParty.SelectedPerson.IsAccessCardAssigned) { Messenger.Instance.Notify(MessengerMessage.ShowSelectedPartyDetailTab, SelectedIndex); currentParty.PartyDetailSelectedTab = Stateroom; this.ChangeBoardingStatusForSearchByBarcodeScanning(cardDetail); } else if (!string.IsNullOrEmpty(currentParty.SelectedPerson.CardNumber) && !currentParty.SelectedPerson.CardNumber.Equals(cardDetail.Id) && currentParty.SelectedPerson.IsAccessCardAssigned) { this.SearchErrorText = string.Empty; ApplicationDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => { this.PlaySound(AudibleAlert.PersonNotFound); this.IsPopupOpen = true; })); this.SearchErrorText = Properties.Resources.VisitorAlreadyCardAssignedMessage; } else { Messenger.Instance.Notify(MessengerMessage.ShowSelectedPartyDetailTab, SelectedIndex); ShowSpinWheel(); currentParty.PartyDetailSelectedTab = Stateroom; Messenger.Instance.Notify(MessengerMessage.AssignCard, cardDetail); this.IsPopupOpen = false; } this.IsBusy = false; }
/// <summary> /// Function to manage received party. /// </summary> /// <param name="personsParty">Instance of Persons Party</param> /// <param name="callbackAction">Callback action</param> /// <param name="externalDeviceInfo">Instance of ExternalDeviceInfo</param> private static void ManageReceivedParty(PersonsParty personsParty, Action callbackAction, ExternalDeviceInfo externalDeviceInfo) { if (personsParty != null && externalDeviceInfo != null) { } RunCallbackAction(callbackAction); }