public MyCovoitAffichageDemandeTrajet() { InitializeComponent(); Title = "Demandes de trajets :"; List <Models.Reservation> lesReservations = new List <Models.Reservation>(); lesReservations = Database.MyCovoit.getLesReservations(); ScrollView scroll = new ScrollView(); StackLayout stackLayout = new StackLayout(); for (int i = 0; i < lesReservations.Count; i++) { Models.Reservation uneReservation = lesReservations[i]; Frame Card = new Frame { Margin = new Thickness(40, 20, 40, 0), BackgroundColor = Color.FromHex("#27ae60"), CornerRadius = 10, HasShadow = true }; StackLayout stackCard = new StackLayout(); StackLayout stakLabel = new StackLayout { Padding = new Thickness(15, 15, 15, -10), HeightRequest = 140, WidthRequest = 100 }; Label labelTest = new Label { TextColor = Color.White, Text = "Montée : " + uneReservation.getMonte().ToString() + "\n" + "Descente : " + uneReservation.getDescente() + "\n" + "Prix : " + uneReservation.getPrix().ToString() + "€" + "\n" + "Conducteur : " + uneReservation.getConducteur(), FontSize = 25 }; scroll.Content = stackLayout; Content = scroll; } }
public annulerReservation() { InitializeComponent(); StackLayout stackPrincipal = new StackLayout() { Margin = new Thickness(30, 20, 30, 0) }; Title = "Annuler la réservation"; StackLayout stackTrajet = new StackLayout(); Label titreTrajet = new Label() { Text = "Voulez vous annuler la réservation du trajet suivant ? ", FontSize = 25 }; Label descTrajet = new Label() { Text = "🚘 Départ : " + laReservation.getTrajet().getLieuDepart().getLibelle() + "\n" + "🚩 Arrivée : " + laReservation.getTrajet().getLieuArrive().getLibelle() + "\n" + "💰 Prix : " + laReservation.getPrix() + "€", FontSize = 20 }; stackTrajet.Children.Add(titreTrajet); stackTrajet.Children.Add(descTrajet); StackLayout stackBouton = new StackLayout() { Margin = new Thickness(0, 10, 0, 0) }; Button boutonConfirmer = new Button() { Text = "Annuler", BackgroundColor = Color.FromHex("#27ae60"), CornerRadius = 10, HeightRequest = 40 }; boutonConfirmer.Clicked += confirmerAnnulation; stackBouton.Children.Add(boutonConfirmer); stackPrincipal.Children.Add(stackTrajet); stackPrincipal.Children.Add(stackBouton); Content = stackPrincipal; }
public MesReservations() { InitializeComponent(); Title = "MES RESERVATIONS"; List <Models.Reservation> lesReservations = new List <Models.Reservation>(); lesReservations = Database.MyCovoit.getLesReservations(); ScrollView scroll = new ScrollView(); StackLayout stackLayout = new StackLayout(); for (int i = 0; i < lesReservations.Count; i++) { Models.Reservation uneReservation = lesReservations[i]; StackLayout stackCard = new StackLayout(); Frame Card = new Frame { Margin = new Thickness(40, 20, 40, 0), BackgroundColor = Color.FromHex("#27ae60"), CornerRadius = 10, HasShadow = true }; StackLayout stakLabel = new StackLayout { Padding = new Thickness(15, 0, 15, 0), }; Label labelTest = new Label { TextColor = Color.White, Text = "🚘 Montée : " + uneReservation.getMonte().ToString() + "\n" + "🚩 Descente : " + uneReservation.getDescente() + "\n" + "💰 Prix : " + uneReservation.getPrix().ToString() + "€" + "\n" + "🧑 Conducteur : " + uneReservation.getConducteur().getPrenom() + " " + uneReservation.getConducteur().getNom(), FontSize = 20 }; // Your label tap event var tapInfos = new TapGestureRecognizer(); tapInfos.Tapped += (s, e) => { //ACTION A EFFECTUER QUAND ON CLIQUE SUR LES INFOS DU TRAJET detailReservation = uneReservation; Navigation.PushAsync(new DetailReservation()); }; labelTest.GestureRecognizers.Add(tapInfos); stakLabel.Children.Add(labelTest); stackCard.Children.Add(stakLabel); //stackCard.Children.Add(boutonStakLayout); Card.Content = stackCard; stackLayout.Children.Add(Card); } scroll.Content = stackLayout; Content = scroll; }
public DetailReservation() { InitializeComponent(); Trajet leTrajet = laReservation.getTrajet(); var dateTrajet = leTrajet.getDate().Date.ToString("dd/MM/yyyy"); Title = "Détail de la réservation"; StackLayout stackPrincipal = new StackLayout() { Margin = new Thickness(30, 20, 30, 0) }; ScrollView scroll = new ScrollView(); Label reservationSelectionne = new Label() { Text = "Lieu de départ : " + laReservation.getMonte() + "\n" + " " + "\n" + "Lieu d'arrivée : " + laReservation.getDescente() + "\n" + " " + "\n" + "Prix : " + laReservation.getPrix() + "€" + "\n", FontSize = 20 }; StackLayout stackCardTrajet = new StackLayout(); Frame frameTrajet = new Frame() { CornerRadius = 10, BorderColor = Color.FromHex("#27ae60"), Padding = new Thickness(0, 0, 0, 0) }; StackLayout titreTrajet = new StackLayout() { HorizontalOptions = LayoutOptions.Fill, BackgroundColor = Color.FromHex("#27ae60"), HeightRequest = 50, Padding = new Thickness(0, 15, 0, 0) }; Label titre = new Label() { HorizontalTextAlignment = TextAlignment.Center, Text = "Trajet", FontSize = 20, TextColor = Color.White }; StackLayout descTrajet = new StackLayout() { Padding = new Thickness(10, 0, 10, 20) }; Label description = new Label() { Text = "Description : " + leTrajet.getDescTrajet() + "\n" + " " + "\n" + "Lieu de départ : " + leTrajet.getLieuDepart().getLibelle() + "\n" + " " + "\n" + "Lieu d'arrivée : " + leTrajet.getLieuArrive().getLibelle() + "\n" + " " + "\n" + "Date : " + dateTrajet + " de " + leTrajet.getHeureDepart() + " à " + leTrajet.getHeureArrive() + "\n" + " " + "\n" + "Nombre de places disponibles : " + leTrajet.getNbPlaces(), FontSize = 20 }; StackLayout stackCardConducteur = new StackLayout(); Frame frameConducteur = new Frame() { CornerRadius = 10, BorderColor = Color.FromHex("#27ae60"), Padding = new Thickness(0, 0, 0, 0), Margin = new Thickness(0, 20, 0, 20) }; StackLayout titreConducteur = new StackLayout() { HorizontalOptions = LayoutOptions.Fill, BackgroundColor = Color.FromHex("#27ae60"), HeightRequest = 50, Padding = new Thickness(0, 15, 0, 0) }; Label titreConducteurr = new Label() { HorizontalTextAlignment = TextAlignment.Center, Text = "Conducteur", FontSize = 20, TextColor = Color.White }; StackLayout descConducteur = new StackLayout() { Padding = new Thickness(10, 0, 10, 20) }; Label descriptionConducteur = new Label() { Text = "Nom : " + leTrajet.getConducteur().getNom() + "\n" + "Prénom : " + leTrajet.getConducteur().getPrenom() + "\n" + " " + "\n" + "Date de naissance : " + leTrajet.getConducteur().getDateNaissance().ToString("dd/MM/yyyy") + " " + "\n" + "Contacter " + leTrajet.getConducteur().getPrenom(), FontSize = 20 }; titreConducteur.Children.Add(titreConducteurr); stackCardConducteur.Children.Add(titreConducteur); descConducteur.Children.Add(descriptionConducteur); stackCardConducteur.Children.Add(descConducteur); frameConducteur.Content = stackCardConducteur; StackLayout boutonStakLayout = new StackLayout() { Margin = new Thickness(0, 0, 0, 20) }; Button boutonAnnuler = new Button { WidthRequest = 20, HeightRequest = 40, BackgroundColor = Color.FromHex("#27ae60"), CornerRadius = 10, Text = "Annuler", FontSize = 18, TextColor = Color.White }; boutonAnnuler.Clicked += annulerReservation; boutonStakLayout.Children.Add(boutonAnnuler); descTrajet.Children.Add(description); titreTrajet.Children.Add(titre); stackCardTrajet.Children.Add(titreTrajet); stackCardTrajet.Children.Add(descTrajet); frameTrajet.Content = stackCardTrajet; stackPrincipal.Children.Add(reservationSelectionne); stackPrincipal.Children.Add(frameTrajet); stackPrincipal.Children.Add(frameConducteur); stackPrincipal.Children.Add(boutonStakLayout); scroll.Content = stackPrincipal; Content = scroll; }