private async void BookCabButton_Clicked(object sender, EventArgs e) { bool confirm = await DisplayAlert("Confirm", "Are you sure you want to approve this application?", "Yes", "No"); if (confirm) { Cab cab = new Cab { cab_no = CabNoEntry.Text, applicationid = int.Parse(applicationid), expected_arrival_time = (DateTime.Today + ExpectedArrivalTimePicker.Time).ToString("o"), driver_name = DriverNameEntry.Text, driver_contact_no = DriverContactEntry.Text, cab_status = "BOOKED", booking_time = DateTime.UtcNow.ToString("s") }; //Send Cab Details here, this cab is being created in database for the first time CabController.AddCab(cab); //Pop back to Security HomePage Navigation.PopAsync(); Navigation.PopAsync(); } }
private async void SecurityCabOptions_Button_Clicked(object sender, EventArgs e) { //get cab and check against cab_status. Cab cab = CabController.GetCab(int.Parse(applicationid)); if (cab == null) { await Navigation.PushAsync(new NavigationPage(new FillCabDetailsPage(applicationid))); } else if (cab.cab_status == "ARRIVED") { await DisplayAlert("Error", "Ride is already in transit", "OK"); } else if (cab.cab_status == "CANCELLED") { await DisplayAlert("Error", "Cab has been Cancelled", "OK"); } else { cab.cab_status = "ARRIVED"; cab.arrival_time = DateTime.UtcNow.ToString(); CabController.UpdateCab(cab); await DisplayAlert("Cab has arrived.", "Employee has been notified.", "OK"); } }
// Use this for initialization void Start() { m_target = GameObject.FindGameObjectWithTag("Player"); m_cab = this.GetComponent<CabController> (); m_stage = GameObject.FindGameObjectWithTag(m_StageTag).GetComponent<StageBuilder>(); m_audio = gameObject.GetComponent<AudioSource>(); m_horn_pitch = (Random.Range(0, 2) == 0) ? 1.0f : 1.1f; m_vertman = Random.Range(0, 2) == 0; }
public void StartDriveSimulation() { if (CabManager.instance.GetCabOnNode(curretPath[0]) != null) { CabController controller = CabManager.instance.GetCabOnNode(curretPath[0]).cabController; controller.GoTo(curretPath, 2.0f); } else { Debug.LogError("Couldn't find any cab on that node!!!!"); } }
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(); } } } }
private void StartTripButton_Clicked(object sender, EventArgs e) { DateTime departuretime = DateTime.Today; int appid = int.Parse(viewModel.DisplayAppList[0].applicationid); Cab cab = CabController.GetCab(appid); cab.departure_time = departuretime.ToString(); CabController.UpdateCab(cab); HomePage.viewModel.DisplayCabList[0].departure_time = departuretime.ToString();; viewModel.IsCabArrived = false; EndTripButton.IsVisible = true; }
private async void CancelCabButton_Clicked(object sender, EventArgs e) { //SEND NOTIFICATION TO SECURITY ABOUT CANCELLATION bool confirm = await DisplayAlert("Confirm", "Are you sure you want to cancel this application?", "Yes", "No"); if (confirm) { int appid = int.Parse(viewModel.DisplayAppList[0].applicationid); Cab cab = CabController.GetCab(appid); cab.cab_status = "CANCELLED"; CabController.UpdateCab(cab); //Update HomePage UI HomePage.viewModel.DisplayCabList[0].cab_status = "CANCELLED"; } }
private void EndTripButton_Clicked(object sender, EventArgs e) { DateTime tripendtime = DateTime.UtcNow; int appid = int.Parse(viewModel.DisplayAppList[0].applicationid); Cab cab = CabController.GetCab(appid); cab.trip_end_time = tripendtime.ToString(); cab.cab_status = "REACHED"; CabController.UpdateCab(cab); HomePage.viewModel.DisplayCabList[0].trip_end_time = tripendtime.ToString();; DisplayAlert("", "Your trip has ended.", "OK"); viewModel.ResetHomePageUI_OnCabReached(); EndTripButton.IsVisible = false; }
public SecurityApplicationReviewPage(string appid) { InitializeComponent(); applicationid = appid; Cab cab = CabController.GetCab(int.Parse(applicationid)); if (cab == null) { SecurityCabOptions_Button.Text = "Book Cab"; } else if (cab.cab_status == "BOOKED") { SecurityCabOptions_Button.Text = "Cab Arrived"; } else { SecurityCabOptions_Button.IsEnabled = false; } }
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"); } } }