private void cancelBtn_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; ModelBooking dataObject = button.DataContext as ModelBooking; if (dataObject.status.Equals("ongoing")) { MessageBoxResult result = MessageBox.Show("Can't cancel on going booking.", "Cancel Booking", MessageBoxButton.OK, MessageBoxImage.Error); } else if (dataObject.status.Equals("finished")) { MessageBoxResult result = MessageBox.Show("This booking has already been finished.", "Cancel Booking", MessageBoxButton.OK, MessageBoxImage.Information); } else if (dataObject.status.Equals("canceled")) { MessageBoxResult result = MessageBox.Show("This booking has already been canceled.", "Cancel Booking", MessageBoxButton.OK, MessageBoxImage.Information); } else { String token = File.ReadAllText(@"userToken.txt"); MessageBoxResult result = MessageBox.Show("Please contact the customer before canceling, or make sure the service is done. Proceed ?", "Cancel Booking", MessageBoxButton.YesNo, MessageBoxImage.Warning); switch (result) { case MessageBoxResult.Yes: getController().callMethod("statusBooking", dataObject.booking_id, "canceled", token); break; } } }
private void finishBtn_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; ModelBooking dataObject = button.DataContext as ModelBooking; if (dataObject.status.Equals("upcoming")) { MessageBoxResult result = MessageBox.Show("Please process this booking first before finishing it.", "Finish Booking", MessageBoxButton.OK, MessageBoxImage.Warning); } else if (dataObject.status.Equals("finished")) { MessageBoxResult result = MessageBox.Show("This booking has already been finished.", "Finish Booking", MessageBoxButton.OK, MessageBoxImage.Information); } else if (dataObject.status.Equals("canceled")) { MessageBoxResult result = MessageBox.Show("This booking has already been canceled.", "Finish Booking", MessageBoxButton.OK, MessageBoxImage.Information); } else { String token = File.ReadAllText(@"userToken.txt"); MessageBoxResult result = MessageBox.Show("Finish this booking ?", "Finish Booking", MessageBoxButton.YesNo, MessageBoxImage.Warning); switch (result) { case MessageBoxResult.Yes: getController().callMethod("statusBooking", dataObject.booking_id, "finished", token); break; } } }
public ObservableCollection <HotelsSet> getAllHotels() { try { using (var db = new ModelBooking()) { HashSet <HotelsSet> hotelHashSet = db.GetAllHotels(); return(new ObservableCollection <HotelsSet>(hotelHashSet)); } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void progressBtn_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; ModelBooking dataObject = button.DataContext as ModelBooking; MessageBoxResult result; if (dataObject.status.Equals("finished")) { result = MessageBox.Show("This booking has already been finished.", "Set Service Time", MessageBoxButton.OK, MessageBoxImage.Information); } else if (dataObject.status.Equals("canceled")) { result = MessageBox.Show("This booking has been canceled.", "Set Service Time", MessageBoxButton.OK, MessageBoxImage.Information); } else { this.NavigationService.Navigate(new ProgressPage(dataObject.booking_id, dataObject.start_time, dataObject.end_time)); } }