Beispiel #1
0
 private void Start()
 {
     audioClipDictionary = new Dictionary <PassengerController.Emotion, AudioClip>();
     foreach (EmotionalAudioClip e in audioClips)
     {
         if (audioClipDictionary.ContainsKey(e.emotion))
         {
             Debug.LogWarning("Duplicate emotion ignored");
             continue;
         }
         if (e.audioClip == null)
         {
             Debug.LogWarning("Missing audio clip ignored");
             continue;
         }
         audioClipDictionary.Add(e.emotion, e.audioClip);
     }
     if (audioClipDictionary.Count == 0)
     {
         Debug.LogWarning("No audio clips");
     }
     passenger = GetPassenger(transform.parent);
     if (passenger == null)
     {
         Debug.LogWarning("No associated passenger");
     }
     audioClips = null;
 }
Beispiel #2
0
    /*
     *	When the airplane has arrived at parking spot, start disembarking
     *  which means opening the door and starting the Disembarking() procedure
     */
    public void AddPassengers()
    {
        passengers         = PassengerController.GetOutgoingPassengers(this);
        incomingPassengers = PassengerController.GetIncomingPassengers(this);

        outgoingPassengers = passengers;         // because they are currently in the airplane, until they exit
    }
Beispiel #3
0
    void IncomingPassengerBehavior()
    {
        if (state == STATE_AIRPLANE_WAITING)
        {
            ;             // do nothing, waiting to get exit path from flight
        }
        else if (state == STATE_AIRPLANE_EXITING)
        {
            if (HasArrived(GridHelper.GetGridCellSize() / 5f))
            {
                steering.Visit(gate.GetEnterPath());
                finalDestination = steering.GetFinalDestination();
                state            = STATE_GATE_EXITING;
            }
        }
        else if (state == STATE_GATE_EXITING)
        {
            if (HasArrived())
            {
                state = STATE_CUSTOMS;
                //print("exiting complete!");
            }
        }
        else if (state == STATE_CUSTOMS)
        {
            //if (VisitPassengerBuilding("Customs", STATE_CUSTOMS_COMPLETE))
            if (VisitBuilding("Customs", STATE_EXIT))
            {
                state = STATE_BUILDING;
            }
            else
            {
                Wandering(STATE_SPAWNED);
                speechBubbleController.SendMessageContinuous(speechBubble_NoCustomns, this,
                                                             SpeechBubbleController.PASSSENGER_NO_CUSTOMNS);
            }

            /*} else if (state == STATE_CUSTOMS_COMPLETE) {
             *      state = STATE_EXIT;*/
        }
        else if (state == STATE_EXIT)
        {
            finalDestination = PassengerController.GetExitPosition(this);
            steering.Visit(finalDestination);

            state = STATE_EXIT_GOTO;
        }
        else if (state == STATE_EXIT_GOTO)
        {
            if (HasArrived())
            {
                PassengerController.RemovePassengers(this);
                Object.Destroy(this.gameObject);
            }
        }
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="PassengerControllerTests"/> class.
 /// </summary>
 public PassengerControllerTests()
 {
     Business.Dependencies.Register();
     this.alertManager = new Mock<IAlertManager>();
     this.personManager = new Mock<IPersonManager>();
     this.passengerController = new PassengerController(this.personManager.Object, this.alertManager.Object);
     CommonHelper.MockHttpRequestContext();
     SessionData.Instance.MasterData = CommonHelper.SetupMasterDataForUIControllers();
     DIContainer.Instance.Resolve<IComponentSettingsEntities>().MaxPageSize = 2;
 }
        public void GetBookingDetail_ReturnNotNullList()
        {
            var mock = new Mock <passenger>(sysdb);

            PassengerController obj = new PassengerController(mock.Object);

            var data = obj.GetBookingDetail(2224);

            var res = data as ObjectResult;

            Assert.IsNotNull(data);
        }
        public void GetTicketType_ReturnNotNullList()
        {
            var mock = new Mock <passenger>(sysdb);

            PassengerController obj = new PassengerController(mock.Object);

            var data = obj.GetTicketType();

            var res = data as ObjectResult;

            Assert.IsNotNull(data);
        }
        public void GetTicketType_ValidInput_OkRequest()
        {
            var mock = new Mock <passenger>(sysdb);

            PassengerController obj = new PassengerController(mock.Object);

            var data = obj.GetTicketType();

            var res = data as ObjectResult;

            Assert.AreEqual(200, res.StatusCode);
        }
Beispiel #8
0
        public static void refreshApplicationData()
        {
            Application app           = null;
            int         applicationid = getCurrentApplication();

            if (applicationid != -1)
            {
                app = ApplicationController.GetApplication(applicationid);
            }
            //Get application and passengers
            if (app != null)
            {
                app.submission_datetime = Convert.ToDateTime(app.submission_datetime).ToString();
                app.cab_required_time   = Convert.ToDateTime(app.cab_required_time).ToString();
                List <Passenger> passengerList = PassengerController.GetPassengers(applicationid);
                HomePage.viewModel.DisplayAppList.Clear();
                HomePage.viewModel.DisplayAppList.Add(new HomePageApplication
                {
                    applicationid       = applicationid.ToString(),
                    application_status  = app.application_status,
                    cab_required_time   = app.cab_required_time,
                    submission_datetime = app.submission_datetime
                });
                foreach (Passenger pass in passengerList)
                {
                    HomePage.viewModel.DisplayPassengerList.Add(new HomePagePassenger
                    {
                        employeeid  = pass.employeeid,
                        destination = pass.destination,
                        in_time     = Convert.ToDateTime(pass.in_time).ToString(),
                        pickup      = pass.pickup
                    });
                }
                Cab cab = CabController.GetCab(applicationid);
                if (cab == null)
                {
                    HomePage.viewModel.UpdateHomePageUI_OnAppSubmit();
                }
                else
                {
                    if (cab.cab_status == "ARRIVED")
                    {
                        HomePage.viewModel.UpdateHomePageUI_OnCabArrived();
                    }
                    else
                    {
                        HomePage.viewModel.UpdateHomePageUI_OnCabBooked();
                    }
                }
            }
        }
Beispiel #9
0
        public static void refreshManagerData(Employee employee)
        {
            List <int> rAppList = getCurrentReviewApplications();

            if (rAppList != null)
            {
                ApplicationReviewPage.viewModel.ReviewAppList.Clear();
                foreach (int appid in rAppList)
                {
                    Application      app      = ApplicationController.GetApplication(appid);
                    List <Passenger> passList = PassengerController.GetPassengers(appid);
                    AddReviewApplication(appid, app, passList);
                }
            }
        }
Beispiel #10
0
        public void Initialize()
        {
            BizContext = new LuggageTrackerBizContext(new InMemDAL());

            luggage = new Luggage(luggageId, name)
            {
                Weight           = weight,
                Measurement      = measurement,
                Description      = description,
                Status           = luggageStatus,
                LastStatusChange = lastStatusChange,
            };

            luggageController   = new LuggageController(BizContext);
            passengerController = new PassengerController(BizContext);
        }
        public void GetTicketType_InvalidInput_ReturnsBadRequest()
        {
            try
            {
                var mock = new Mock <passenger>(sysdb);

                PassengerController obj = new PassengerController(mock.Object);

                var data = obj.GetTicketType();

                var res = data as BadRequestResult;

                Assert.AreEqual(400, res.StatusCode);
            }
            catch (Exception e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }
        }
Beispiel #12
0
        public void Initialize()
        {
            BizContext = new LuggageTrackerBizContext(new InMemDAL());

            passenger = new Passenger(passengerId, pnr, passengerFirstName, passengerLastName)
            {
                PassengerMiddleName = passengerMiddleName,
                FlightNumber        = flightNo,
                SeatNumber          = seatNo,
                Address             = address,
                Phone      = phone,
                EMail      = email,
                Remarks    = remarks,
                Subscribed = subscribed,
                Luggages   = luggages,
            };

            passengerController = new PassengerController(BizContext);
        }
Beispiel #13
0
 public PassengerUnitTest()
 {
     _passengerController = new PassengerController(mockDtaRepository.Object);
 }
Beispiel #14
0
 public PassengerControllerTest()
 {
     _passenger  = new PassengerServices();
     _controller = new PassengerController(_passenger);
 }
 public UnitTest1()
 {
     _passengerController = new PassengerController(mockData.Object);
 }
Beispiel #16
0
        //Not yet implemented : Form Validation. All fields except Escort Name are required.
        //A Single Passenger has the following related information to be entered for them : EmployeeID, Pickup location, Destination location, In-Time
        //User is allowed to take anywhere between 1-3 passengers. If any detail of a passenger is filled, ALL remaining details are REQUIRED.
        //If NO details are filled DO NOT add that passenger to passengerlist.
        private async void SubmitButton_OnClick(object sender, EventArgs e)
        {
            List <Passenger> passengerlist = new List <Passenger>();

            //Applicant gets added as passenger with related details as well
            passengerlist.Add(new Passenger
            {
                employeeid  = Data.DataHandler.getEmployeeData().employeeid,
                in_time     = DateTime.Today + PassengerInTimePicker0.Time,
                pickup      = PassengerPickupEntry0.Text,
                destination = PassengerDestinationEntry0.Text
            });
            //Currently only EmployeeID field is checked to be not null . If not null, add all related detailes to passenger list.
            //To be done : Add to passengerlist only if ALL details of that passenger are not null.
            if (!string.IsNullOrEmpty(PassengerEmpIDEntry1.Text))
            {
                passengerlist.Add(new Passenger
                {
                    employeeid  = PassengerEmpIDEntry1.Text,
                    in_time     = DateTime.Today + PassengerInTimePicker1.Time,
                    pickup      = PassengerPickupEntry1.Text,
                    destination = PassengerDestinationEntry1.Text
                });
            }
            if (!string.IsNullOrEmpty(PassengerEmpIDEntry2.Text))
            {
                passengerlist.Add(new Passenger
                {
                    employeeid  = PassengerEmpIDEntry2.Text,
                    in_time     = DateTime.Today + PassengerInTimePicker2.Time,
                    pickup      = PassengerPickupEntry2.Text,
                    destination = PassengerDestinationEntry2.Text
                });
            }
            if (!string.IsNullOrEmpty(PassengerEmpIDEntry3.Text))
            {
                passengerlist.Add(new Passenger
                {
                    employeeid  = PassengerEmpIDEntry3.Text,
                    in_time     = DateTime.Today + PassengerInTimePicker2.Time,
                    pickup      = PassengerPickupEntry3.Text,
                    destination = PassengerDestinationEntry3.Text
                });
            }
            //Implement form validation. Do not send null data to server.
            Models.Application application = new Models.Application();
            application.travel_purpose      = TravelPurposeEntry.Text;
            application.roundtrip           = RoundtripSwitch.IsToggled;
            application.escort_name         = EscortNameEntry.Text;
            application.employeeid          = DataHandler.getEmployeeData().employeeid;
            application.managerid           = ManagerIDEntry.Text;
            application.manager_name        = ManagerNameEntry.Text;
            application.application_status  = "PENDING";
            application.project_bpcode      = ProjectBPCodeEntry.Text;
            application.submission_datetime = DateTime.UtcNow.ToString("s");
            application.cab_required_time   = (DateTime.Today + CabRequiredTimePicker.Time).ToString("s");

            int applicationid = await ApplicationController.AddApplicationAsync(application, passengerlist);

            if (applicationid != -1)
            {
                PassengerController.AddPassengerAsync(passengerlist, applicationid);
                DataHandler.AddHomePageApplication(applicationid, application, passengerlist);
                await Navigation.PopAsync();
            }
        }
Beispiel #17
0
 /*
  *	Passengers coming to flight will be spawned by passengerController
  */
 public void SpawnIncomingPassengers()
 {
     PassengerController.SpawnPassengersAtEntrance(incomingPassengers);
 }
        public override void OnMessageReceived(RemoteMessage message)
        {
            int    applicationId = -1;
            string header        = "";

            if (message.Data.Keys.Contains("applicationid"))
            {
                foreach (var item in message.Data.Values)
                {
                    try
                    {
                        applicationId = int.Parse(item);
                    }
                    catch (Exception e)
                    {
                        header = item;
                    }
                }
                CMSapp.Models.Application app  = ApplicationController.GetApplication(applicationId);
                List <Passenger>          pass = PassengerController.GetPassengers(applicationId);

                if (header == "SECURITY")
                {
                    Console.WriteLine("Got application for security to book cab for");
                    DataHandler.AddSecurityApplication(applicationId, app, pass);
                    //Security calls company and books cab
                    //Enters cab details and presses submit
                }
                else if (header == "MANAGER")
                {
                    Console.WriteLine("Got application for manager to review");
                    //Update unread application count
                    DataHandler.unreadApplications++;
                    if (Xamarin.Forms.Application.Current.Properties.ContainsKey(Constants.unreadApplications))
                    {
                        Xamarin.Forms.Application.Current.Properties[Constants.unreadApplications] = DataHandler.unreadApplications;
                    }
                    SendNotification("You have " + DataHandler.unreadApplications + " new application(s) to review.");

                    //Update the reviewpassengers ui
                    DataHandler.AddReviewApplication(applicationId, app, pass);
                    HomePage.viewModel.UpdateHomePageUI_OnReceivingReviewApplication();
                    DataHandler.saveCurrentReviewApplications(ApplicationReviewPage.viewModel.ReviewAppList.ToList());
                }
                else if (header == "EMPLOYEE")
                {
                    Console.WriteLine("Application approved by manager");
                    CMSapp.Models.Application application = ApplicationController.GetApplication(applicationId);

                    HomePage.viewModel.DisplayAppList.Clear();
                    HomePage.viewModel.DisplayAppList.Add(new CMSapp.ViewModels.HomePageApplication
                    {
                        applicationid       = applicationId.ToString(),
                        application_status  = application.application_status,
                        cab_required_time   = application.cab_required_time,
                        submission_datetime = Convert.ToDateTime(application.submission_datetime).ToString()
                    });
                }
                else if (header == "CAB_BOOKED")
                {
                    Cab cab = CabController.GetCab(applicationId);
                    //Update cab details
                    HomePage.viewModel.DisplayCabList.Clear();
                    HomePage.viewModel.DisplayCabList.Add(new CMSapp.ViewModels.HomePageCab
                    {
                        applicationid         = cab.applicationid,
                        expected_arrival_time = cab.expected_arrival_time,
                        booking_time          = cab.booking_time,
                        cab_no            = cab.cab_no,
                        cab_status        = cab.cab_status,
                        driver_contact_no = cab.driver_contact_no,
                        driver_name       = cab.driver_name
                    });
                    HomePage.viewModel.UpdateHomePageUI_OnCabBooked();
                }
                else if (header == "CAB_ARRIVED")
                {
                    Cab cab = CabController.GetCab(applicationId);
                    //Update cab details
                    HomePage.viewModel.DisplayCabList.Clear();
                    HomePage.viewModel.DisplayCabList.Add(new CMSapp.ViewModels.HomePageCab
                    {
                        applicationid         = cab.applicationid,
                        expected_arrival_time = cab.expected_arrival_time,
                        booking_time          = cab.booking_time,
                        cab_no            = cab.cab_no,
                        cab_status        = cab.cab_status,
                        driver_contact_no = cab.driver_contact_no,
                        driver_name       = cab.driver_name
                    });
                    HomePage.viewModel.UpdateHomePageUI_OnCabArrived();
                }
                else
                {
                    Console.WriteLine("Invalid header");
                }
            }
        }
Beispiel #19
0
 /*
  *	Called by a passenger when finished boarding
  */
 public void FinishedBoarding(Passenger passenger)
 {
     passengers.Add(passenger);
     PassengerController.RemovePassengers(passenger);
 }
 public TestingController()
 {
     _passengerController = new PassengerController(mockDataRepository.Object);
 }