From c53896f8bd6d0294abc0fb96fc9a3d30af34ee3e Mon Sep 17 00:00:00 2001 From: leroyv Date: Thu, 27 Mar 2025 15:39:42 +0100 Subject: [PATCH] =?UTF-8?q?Gestion=20depart=20arriv=C3=A9es=20qui=20foncti?= =?UTF-8?q?onne?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Views/GestionDepart/GestionDepartPage.xaml | 66 +++++++++---------- Views/GestionDepart/GestionDepartPage.xaml.cs | 23 +++++-- 2 files changed, 51 insertions(+), 38 deletions(-) diff --git a/Views/GestionDepart/GestionDepartPage.xaml b/Views/GestionDepart/GestionDepartPage.xaml index dd43ff7..a16a286 100644 --- a/Views/GestionDepart/GestionDepartPage.xaml +++ b/Views/GestionDepart/GestionDepartPage.xaml @@ -8,8 +8,40 @@ - + + + + + + + + + + + + + + + + @@ -44,38 +76,6 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Views/GestionDepart/GestionDepartPage.xaml.cs b/Views/GestionDepart/GestionDepartPage.xaml.cs index 6e1351a..78d9697 100644 --- a/Views/GestionDepart/GestionDepartPage.xaml.cs +++ b/Views/GestionDepart/GestionDepartPage.xaml.cs @@ -14,7 +14,9 @@ namespace HegreHotel.Views.GestionDepart; public partial class GestionDepartPage : ContentPage { - public ObservableCollection Reservations { get; set; } = new ObservableCollection(); + public ObservableCollection ReservationsDeb { get; set; } = new ObservableCollection(); + public ObservableCollection ReservationsFin { get; set; } = new ObservableCollection(); + public GestionDepartPage() { InitializeComponent(); @@ -26,14 +28,25 @@ public partial class GestionDepartPage : ContentPage string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3"); var db = SingletonConnection.GetInstance(dbPath); var reservationList = await db.Table().ToListAsync(); - Reservations.Clear(); + ReservationsDeb.Clear(); + ReservationsFin.Clear(); foreach (var reservation in reservationList) { - Reservations.Add(reservation); + if (reservation.DateDebut == DateTime.Now.Date) + { + ReservationsDeb.Add(reservation); + } else if (reservation.DateFin == DateTime.Now.Date) + { + ReservationsFin.Add(reservation); + } + } - GestionDepartListView.ItemsSource = Reservations; - GestionArriveListView.ItemsSource = Reservations; + + GestionArriveListView.ItemsSource = ReservationsDeb; + + GestionDepartListView.ItemsSource = ReservationsFin; + } private void GestionPage_OnAppearing(object? sender, EventArgs e)