/// <summary>
        /// Function to retrieve audible alert to play.
        /// </summary>
        /// <param name="person">Person information</param>
        /// <param name="boardingStatusChangeState">Boarding status change information</param>
        /// <returns>Audible alert information</returns>
        private static AudibleAlert RetrieveAudibleAlert(PersonBase person, BoardingStatusChangeState boardingStatusChangeState)
        {
            switch (boardingStatusChangeState)
            {
                case BoardingStatusChangeState.AlreadyAshore:
                    return AudibleAlert.Rejected;
                case BoardingStatusChangeState.AlreadyOnboard:
                    return AudibleAlert.Rejected;
                case BoardingStatusChangeState.DeniedAshore:
                    return AudibleAlert.DeniedAshore;
                case BoardingStatusChangeState.DeniedAshoreWithoutAuthorizedPerson:
                    return AudibleAlert.DeniedAshore;
                case BoardingStatusChangeState.DeniedBoard:
                    return AudibleAlert.DeniedBoarding;
                case BoardingStatusChangeState.NotCheckedIn:
                    return AudibleAlert.DeniedBoarding;
                case BoardingStatusChangeState.PersonIsOnHold:
                    return AudibleAlert.PersonOnHold;
                case BoardingStatusChangeState.Rejected:
                    return AudibleAlert.Rejected;
                default:
                    if (person.IsOnboard)
                    {
                        return AudibleAlert.OnboardPerson;
                    }

                    return AudibleAlert.OffboardPerson;
            }
        }
Пример #2
0
        /// <summary>
        /// Function to execute rules.
        /// </summary>
        /// <returns>Boarding status change state</returns>
        public BoardingStatusChangeState Execute()
        {
            this.CheckParentalAuthorization();

            // Checks all alerts.
            if (this.person.Alerts.RetrieveAshoreAlerts().Count > 0)
            {
                CreateEventService.CreateEvent(this.person, GangwayEventType.DeniedAshore, null, null, null);
                Messenger.Instance.Notify(MessengerMessage.OpenPersonAlert, Tuple.Create<PersonBase, bool?, bool, bool>(this.person, false, this.person.Alerts.Any(s => s.IsSoundEnable), true));

                AlertCollection ashoreAlerts = this.person.Alerts.RetrieveAshoreAlerts();

                if (ashoreAlerts.Count > 0 && this.person.Alerts.Any(a => a.IsParentalAuthorizationAlert))
                {
                    this.boardingStatusChangeState = BoardingStatusChangeState.DeniedAshoreWithoutAuthorizedPerson;
                }
                else if (ashoreAlerts.Count > 0)
                {
                    this.boardingStatusChangeState = BoardingStatusChangeState.Rejected;
                }

                this.RemoveCustomAlerts();
            }

            return this.boardingStatusChangeState;
        }
Пример #3
0
        /// <summary>
        /// Function to execute rules.
        /// </summary>
        /// <returns>Boarding status change state</returns>
        public BoardingStatusChangeState Execute()
        {
            // Checks all alerts.
            if (this.person.Alerts.RetrieveOnboardAlerts().Count > 0)
            {
                CreateEventService.CreateEvent(this.person, GangwayEventType.DeniedBoard, null, null, null);
                Messenger.Instance.Notify(MessengerMessage.OpenPersonAlert, Tuple.Create<PersonBase, bool?, bool, bool>(this.person, true, this.person.Alerts.Any(s => s.IsSoundEnable), true));

                AlertCollection onboardAlerts = this.person.Alerts.RetrieveOnboardAlerts();
                if (onboardAlerts.Count > 0)
                {
                    this.boardingStatusChangeState = BoardingStatusChangeState.Rejected;
                }
            }

            return this.boardingStatusChangeState;
        }
        /// <summary>
        /// Function to handle boarding status change state.
        /// </summary>
        /// <param name="person">Instance of Person</param>
        /// <param name="boardingStatusChangeState">Boarding status change state information</param>
        private static void HandleBoardingStatusChange(PersonBase person, BoardingStatusChangeState boardingStatusChangeState)
        {
            AudibleAlertManager.PlayBell(person, boardingStatusChangeState);

            // Todo: remove following fix. This is for UI notification.
            person.IsOnboard = !person.IsOnboard;
            person.IsOnboard = !person.IsOnboard;

            person.NotifyPropertyChange(IsOnboardPropertyName);
            person.NotifyPropertyChange(LastEventPropertyName);
            person.NotifyPropertyChange(LastDateTimePropertyName);

            person.HasAlert = person.Alerts.Count > 0;
            person.NotifyPropertyChange(HasAlertProperty);
        }
 /// <summary>
 /// Function to play bell.
 /// </summary>
 /// <param name="person">Person information</param>
 /// <param name="boardingStatusChangeState">Boarding status change information</param>
 public static void PlayBell(PersonBase person, BoardingStatusChangeState boardingStatusChangeState)
 {
     Messenger.Instance.Notify(MessengerMessage.PlaySound, RetrieveAudibleAlert(person, boardingStatusChangeState));
 }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the PersonOnboardRules class.
 /// </summary>
 /// <param name="person">Instance of PersonBase</param>
 public PersonOnboardRules(PersonBase person)
 {
     this.person = person;
     this.boardingStatusChangeState = BoardingStatusChangeState.Successful;
 }
        /// <summary>
        /// Function to process after change boarding status.
        /// </summary>
        /// <param name="person">Instance of PersonBase</param>
        /// <param name="boardingStatusChangeState">BoardingStatusChange State</param>
        private void OnChangeBoardingStatus(PersonBase person, BoardingStatusChangeState boardingStatusChangeState)
        {
            ApplicationDispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => this.NotifyUI(person)));

            if (this.IsHistoryTabClicked)
            {
                ApplicationDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => Messenger.Instance.Notify(MessengerMessage.UpdateHistory)));
            }

            if (boardingStatusChangeState != BoardingStatusChangeState.Successful)
            {
                Messenger.Instance.Notify(MessengerMessage.ShowSpinWheel, false);
            }

            AudibleAlertManager.PlayBell(person, boardingStatusChangeState);
        }