Gestion depart arrivées qui fonctionne
This commit is contained in:
parent
a6f04a142a
commit
c53896f8bd
@ -8,8 +8,40 @@
|
|||||||
|
|
||||||
<ContentPage.Content>
|
<ContentPage.Content>
|
||||||
|
|
||||||
|
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
|
<StackLayout>
|
||||||
|
<StackLayout Padding="20" Orientation="Horizontal">
|
||||||
|
<BoxView HeightRequest="5" Color="MediumPurple"/>
|
||||||
|
<Label Text="Arrivée(s)"
|
||||||
|
FontSize="24"
|
||||||
|
FontAttributes="Bold"
|
||||||
|
HorizontalOptions="Center"/>
|
||||||
|
|
||||||
|
</StackLayout>
|
||||||
|
<ListView x:Name="GestionArriveListView" HasUnevenRows="True">
|
||||||
|
<ListView.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ViewCell>
|
||||||
|
<StackLayout>
|
||||||
|
<Label Text="{Binding Id}"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
WidthRequest="50"/>
|
||||||
|
<Label Text="{Binding NbPersonnes}"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
WidthRequest="50"/>
|
||||||
|
<Label Text="{Binding DateDebut, StringFormat='{0:dd/MM/yyyy}'}"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
WidthRequest="100"/>
|
||||||
|
<Label Text="{Binding DateFin, StringFormat='{0:dd/MM/yyyy}'}"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
WidthRequest="100"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ViewCell>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.ItemTemplate>
|
||||||
|
</ListView>
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<StackLayout Padding="20" Orientation="Horizontal">
|
<StackLayout Padding="20" Orientation="Horizontal">
|
||||||
|
|
||||||
@ -44,38 +76,6 @@
|
|||||||
</ListView>
|
</ListView>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
||||||
<StackLayout>
|
|
||||||
<StackLayout Padding="20" Orientation="Horizontal">
|
|
||||||
<BoxView HeightRequest="5" Color="MediumPurple"/>
|
|
||||||
<Label Text="Arrivée(s)"
|
|
||||||
FontSize="24"
|
|
||||||
FontAttributes="Bold"
|
|
||||||
HorizontalOptions="Center"/>
|
|
||||||
|
|
||||||
</StackLayout>
|
|
||||||
<ListView x:Name="GestionArriveListView" HasUnevenRows="True">
|
|
||||||
<ListView.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<ViewCell>
|
|
||||||
<StackLayout>
|
|
||||||
<Label Text="{Binding Id}"
|
|
||||||
VerticalOptions="Center"
|
|
||||||
WidthRequest="50"/>
|
|
||||||
<Label Text="{Binding NbPersonnes}"
|
|
||||||
VerticalOptions="Center"
|
|
||||||
WidthRequest="50"/>
|
|
||||||
<Label Text="{Binding DateDebut, StringFormat='{0:dd/MM/yyyy}'}"
|
|
||||||
VerticalOptions="Center"
|
|
||||||
WidthRequest="100"/>
|
|
||||||
<Label Text="{Binding DateFin, StringFormat='{0:dd/MM/yyyy}'}"
|
|
||||||
VerticalOptions="Center"
|
|
||||||
WidthRequest="100"/>
|
|
||||||
</StackLayout>
|
|
||||||
</ViewCell>
|
|
||||||
</DataTemplate>
|
|
||||||
</ListView.ItemTemplate>
|
|
||||||
</ListView>
|
|
||||||
</StackLayout>
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ContentPage.Content>
|
</ContentPage.Content>
|
||||||
</ContentPage>
|
</ContentPage>
|
@ -14,7 +14,9 @@ namespace HegreHotel.Views.GestionDepart;
|
|||||||
|
|
||||||
public partial class GestionDepartPage : ContentPage
|
public partial class GestionDepartPage : ContentPage
|
||||||
{
|
{
|
||||||
public ObservableCollection<Models.Reservation> Reservations { get; set; } = new ObservableCollection<Models.Reservation>();
|
public ObservableCollection<Models.Reservation> ReservationsDeb { get; set; } = new ObservableCollection<Models.Reservation>();
|
||||||
|
public ObservableCollection<Models.Reservation> ReservationsFin { get; set; } = new ObservableCollection<Models.Reservation>();
|
||||||
|
|
||||||
public GestionDepartPage()
|
public GestionDepartPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -26,14 +28,25 @@ public partial class GestionDepartPage : ContentPage
|
|||||||
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
|
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
|
||||||
var db = SingletonConnection.GetInstance(dbPath);
|
var db = SingletonConnection.GetInstance(dbPath);
|
||||||
var reservationList = await db.Table<Models.Reservation>().ToListAsync();
|
var reservationList = await db.Table<Models.Reservation>().ToListAsync();
|
||||||
Reservations.Clear();
|
ReservationsDeb.Clear();
|
||||||
|
ReservationsFin.Clear();
|
||||||
foreach (var reservation in reservationList)
|
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)
|
private void GestionPage_OnAppearing(object? sender, EventArgs e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user