Compare commits

..

No commits in common. "master" and "feature/Oscar" have entirely different histories.

11 changed files with 70 additions and 357 deletions

View File

@ -21,8 +21,5 @@
<Button Text="Gérer les Réservations"
Clicked="OnReservationsClicked"
Margin="0,10"/>
<Button Text="Gérer les départs et arrivées"
Clicked="OnGestionDepartClicked"
Margin="0,10"/>
</StackLayout>
</ContentPage>

View File

@ -2,7 +2,6 @@ using HegreHotel.Views;
using HegreHotel.Views.Chambre;
using HegreHotel.Views.Client;
using HegreHotel.Views.Reservation;
using HegreHotel.Views.GestionDepart;
using Microsoft.Maui.Controls;
namespace HegreHotel
@ -28,10 +27,5 @@ namespace HegreHotel
{
await Navigation.PushAsync(new ReservationsPage());
}
private async void OnGestionDepartClicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new GestionDepartPage());
}
}
}

View File

@ -18,6 +18,7 @@ public class Chambre
public int StatusId { get; set; }
// Propriété de navigation pour associer l'objet Status (non stockée en base)
[Ignore]
public Status Status { get; set; }
}

View File

@ -1,46 +0,0 @@
# HegreHotel
**Projet de gestion hôtelière développé avec MAUI pour les réceptionnistes.**
Permet la gestion des clients, des chambres, des réservations, et des réceptionnistes via une application mobile Android.
## 🔧 Installation
Cloner le projet :
```bash
git clone https://gitea.btssio-poitiers.fr/allavenavr/HegreHotel.git
cd HegreHotel
```
---
## 📱 Fonctionnalités principales
| Fonction | Description |
|------------------------|-----------------------------------------------------------------------------|
| Gestion des utilisateurs | Ajout, modification et suppression des clients et réceptionnistes |
| Gestion des chambres | Création, modification, suppression, visualisation, blocage/déblocage |
| Réservations | Création/modification avec dates, nombre d'invités, demandes spécifiques |
| Historique client | Accès à l'historique complet des séjours, y compris les réservations annulées |
| Affichage | Vue densemble des chambres disponibles/occupées, filtrage par période |
---
## ▶️ Lancement de lapplication
1. Sélectionner la plateforme cible : **Android**.
2. Brancher un appareil ou utiliser un émulateur.
3. Cliquer sur **Run** (ou `F5`) dans Visual Studio.
---
## 📦 Contraintes techniques
- Application mobile sous Android
- Développée avec .NET MAUI
- Utilisation d'une base de données SQLite
---
## 🕓 Deadline
- Livraison finale prévue : **9 mai 2025**

View File

@ -6,7 +6,7 @@ namespace HegreHotel
{
public class SingletonConnection : SQLiteAsyncConnection
{
private static SingletonConnection? _instance;
private static SingletonConnection instance;
private SingletonConnection(string dbPath) : base(dbPath)
{
@ -14,11 +14,11 @@ namespace HegreHotel
public static SingletonConnection GetInstance(string dbPath)
{
if (_instance == null)
if (instance == null)
{
_instance = new SingletonConnection(dbPath);
instance = new SingletonConnection(dbPath);
}
return _instance;
return instance;
}
}
}

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="HegreHotel.Views.Chambre.ModifierChambrePage"
@ -28,9 +27,6 @@
<Entry x:Name="EntryNbPersonne" Placeholder="Nombre de personnes" Keyboard="Numeric"/>
</Frame>
<Label Text="Modifier le Statut" Margin="10,0,0,0"/>
<Picker x:Name="PickerStatut" Title=""/>
<!-- Bouton Enregistrer -->
<Button Text="Enregistrer les modifications"
Clicked="OnEnregistrerClicked"
@ -44,4 +40,4 @@
</VerticalStackLayout>
</ScrollView>
</ContentPage>
</ContentPage>

View File

@ -8,8 +8,6 @@ namespace HegreHotel.Views.Chambre
public partial class ModifierChambrePage : ContentPage
{
Models.Chambre _chambre;
private List<Status> _statuts;
public ModifierChambrePage(Models.Chambre chambre)
{
InitializeComponent();
@ -19,40 +17,17 @@ namespace HegreHotel.Views.Chambre
EntryDescription.Text = _chambre.Description;
EntryTarif.Text = _chambre.Tarif.ToString();
EntryNbPersonne.Text = _chambre.NbPersonne.ToString();
LoadStatuts();
}
private async void LoadStatuts()
{
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
var db = SingletonConnection.GetInstance(dbPath);
_statuts = await db.Table<Status>().ToListAsync();
PickerStatut.ItemsSource = _statuts.Select(s => s.Libelle).ToList();
PickerStatut.SelectedIndex = _statuts.FindIndex(s => s.Id == _chambre.StatusId);
}
private async void OnEnregistrerClicked(object sender, EventArgs e)
{
if (PickerStatut.SelectedIndex == -1)
{
await DisplayAlert("Erreur", "Veuillez sélectionner un statut", "OK");
return;
}
_chambre.Nom = EntryNom.Text;
_chambre.Description = EntryDescription.Text;
_chambre.Tarif = decimal.TryParse(EntryTarif.Text, out decimal tarif) ? tarif : _chambre.Tarif;
_chambre.NbPersonne = int.TryParse(EntryNbPersonne.Text, out int nb) ? nb : _chambre.NbPersonne;
_chambre.StatusId = _statuts[PickerStatut.SelectedIndex].Id;
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
var db = SingletonConnection.GetInstance(dbPath);
Console.WriteLine(_chambre.StatusId);
await db.UpdateAsync(_chambre);
await Navigation.PopAsync();
}

View File

@ -1,69 +1,61 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="HegreHotel.Views.Client.ClientsPage"
Title="Gestion des Clients"
Appearing="ClientsPage_OnAppearing">
<StackLayout Padding="15" Spacing="10">
<Button Text="Ajouter Client"
Clicked="OnAjouterClientClicked"
<!-- Bouton Ajouter Client -->
<Button Text="Ajouter Client"
Clicked="OnAjouterClientClicked"
HorizontalOptions="Center"
BackgroundColor="#007AFF"
TextColor="White"
CornerRadius="10"
Padding="10"
FontAttributes="Bold"
WidthRequest="200" />
WidthRequest="200"/>
<CollectionView x:Name="ClientsCollectionView"
SelectionMode="None">
<CollectionView.ItemTemplate>
<!-- Liste des clients -->
<ListView x:Name="ClientsListView" HasUnevenRows="True" ItemTapped="OnClientTapped">
<ListView.ItemTemplate>
<DataTemplate>
<Frame Padding="10"
CornerRadius="10"
BackgroundColor="White"
BorderColor="#E5E7EB"
Margin="0,5"
BindingContext="{Binding .}">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="OnClientTapped" />
</Frame.GestureRecognizers>
<ViewCell>
<Frame Padding="10" CornerRadius="10" BackgroundColor="White" BorderColor="#E5E7EB" Margin="0,5">
<StackLayout Orientation="Horizontal" Spacing="15">
<!-- Icône ou Avatar -->
<Image Source="user_icon.png" WidthRequest="40" HeightRequest="40"/>
<StackLayout Orientation="Horizontal" Spacing="15">
<Image Source="user_icon.png"
WidthRequest="40"
HeightRequest="40" />
<!-- Infos du client -->
<VerticalStackLayout>
<Label Text="{Binding Nom}" FontAttributes="Bold" FontSize="16"/>
<Label Text="{Binding Prenom}" FontSize="14" TextColor="Gray"/>
</VerticalStackLayout>
<VerticalStackLayout>
<Label Text="{Binding Nom}"
FontAttributes="Bold"
FontSize="16" />
<Label Text="{Binding Prenom}"
FontSize="14"
TextColor="Gray" />
</VerticalStackLayout>
<StackLayout Orientation="Horizontal"
HorizontalOptions="EndAndExpand"
Spacing="5">
<ImageButton Source="edit_icon.png"
Clicked="OnModifierClientClicked"
CommandParameter="{Binding .}"
HeightRequest="30"
WidthRequest="30"
BackgroundColor="Transparent" />
<ImageButton Source="delete_icon.png"
Clicked="OnSupprimerClientClicked"
CommandParameter="{Binding .}"
HeightRequest="30"
WidthRequest="30"
BackgroundColor="Transparent" />
<!-- Actions Modifier / Supprimer -->
<StackLayout Orientation="Horizontal" HorizontalOptions="EndAndExpand" Spacing="5">
<ImageButton Source="edit_icon.png"
Clicked="OnModifierClientClicked"
CommandParameter="{Binding .}"
HeightRequest="30"
WidthRequest="30"
BackgroundColor="Transparent"/>
<ImageButton Source="delete_icon.png"
Clicked="OnSupprimerClientClicked"
CommandParameter="{Binding .}"
HeightRequest="30"
WidthRequest="30"
BackgroundColor="Transparent"/>
</StackLayout>
</StackLayout>
</StackLayout>
</Frame>
</Frame>
</ViewCell>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
</ContentPage>

View File

@ -15,28 +15,19 @@ namespace HegreHotel.Views.Client
InitializeComponent();
LoadClients();
}
private async void LoadClients()
{
try
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
var db = SingletonConnection.GetInstance(dbPath);
var clientsList = await db.Table<Models.Client>().ToListAsync();
Clients.Clear();
foreach (var client in clientsList)
{
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
var db = SingletonConnection.GetInstance(dbPath);
var clientsList = await db.Table<Models.Client>().ToListAsync();
MainThread.BeginInvokeOnMainThread(() =>
{
Clients.Clear();
foreach (var client in clientsList)
Clients.Add(client);
ClientsCollectionView.ItemsSource = Clients;
});
}
catch (Exception ex)
{
Console.WriteLine($"Erreur lors du chargement des clients : {ex.Message}");
Clients.Add(client);
}
ClientsListView.ItemsSource = Clients;
}
private async void OnAjouterClientClicked(object sender, EventArgs e)
@ -52,6 +43,7 @@ namespace HegreHotel.Views.Client
}
}
private async void OnSupprimerClientClicked(object sender, EventArgs e)
{
if (sender is ImageButton imageButton && imageButton.CommandParameter is Models.Client client)
@ -62,24 +54,28 @@ namespace HegreHotel.Views.Client
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
var db = SingletonConnection.GetInstance(dbPath);
await db.DeleteAsync(client);
MainThread.BeginInvokeOnMainThread(() =>
{
Clients.Remove(client);
});
LoadClients();
}
}
}
private void ClientsPage_OnAppearing(object sender, EventArgs e)
private void ClientsPage_OnAppearing(object? sender, EventArgs e)
{
LoadClients();
}
private async void OnClientTapped(object sender, EventArgs e)
private async void OnClientTapped(object sender, ItemTappedEventArgs e)
{
if (sender is Frame frame && frame.BindingContext is Models.Client client)
if (e.Item != null)
{
// Désélectionne l'élément tappé
((ListView)sender).SelectedItem = null;
// Récupère le client sélectionné
var client = e.Item as Models.Client;
// Navigue vers la page de détails du client
await Navigation.PushAsync(new DetailsClientPage(client));
}
}

View File

@ -1,136 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="HegreHotel.Views.GestionDepart.GestionDepartPage"
Title="Gestion des départs et arrivées"
Appearing="GestionPage_OnAppearing">
<ContentPage.Content>
<StackLayout>
<StackLayout>
<StackLayout Padding="20" Orientation="Vertical">
<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 Orientation="Vertical" Padding="5" HorizontalOptions="FillAndExpand">
<!-- Première ligne : ID chambre et Nombre de personnes -->
<StackLayout Orientation="Horizontal" Padding="5" HorizontalOptions="FillAndExpand">
<Label Text="ID chambre :"
VerticalOptions="Center"
WidthRequest="120"/>
<Label Text="{Binding ChambreId}"
VerticalOptions="Center"
WidthRequest="50"/>
<Label Text="Nombres de personnes :"
VerticalOptions="Center"
WidthRequest="160"/>
<Label Text="{Binding NbPersonnes}"
VerticalOptions="Center"
WidthRequest="50"/>
</StackLayout>
<!-- Deuxième ligne : Date d'arrivée -->
<StackLayout Orientation="Horizontal" Padding="5" HorizontalOptions="FillAndExpand">
<Label Text="Date d'arrivée :"
VerticalOptions="Center"
WidthRequest="150"/>
<Label Text="{Binding DateDebut, StringFormat='{0:dd/MM/yyyy}'}"
VerticalOptions="Center"
WidthRequest="100"/>
</StackLayout>
<!-- Troisième ligne : Date de départ -->
<StackLayout Orientation="Horizontal" Padding="5" HorizontalOptions="FillAndExpand">
<Label Text="Date de départ :"
VerticalOptions="Center"
WidthRequest="150"/>
<Label Text="Aujourd'hui"
VerticalOptions="Center"
WidthRequest="100"/>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</StackLayout>
<StackLayout Padding="20" Orientation="Vertical">
<StackLayout Padding="20" Orientation="Horizontal">
<BoxView HeightRequest="5" Color="MediumPurple"/>
<Label Text="Départ(s)"
FontSize="24"
FontAttributes="Bold"
HorizontalOptions="Center" />
</StackLayout>
<ListView x:Name="GestionDepartListView" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<!-- StackLayout principal avec orientation verticale -->
<StackLayout Orientation="Vertical" Padding="5" HorizontalOptions="FillAndExpand">
<!-- Première ligne : ID chambre et Nombre de personnes -->
<StackLayout Orientation="Horizontal" Padding="5" HorizontalOptions="FillAndExpand">
<Label Text="ID chambre :"
VerticalOptions="Center"
WidthRequest="120"/>
<Label Text="{Binding ChambreId}"
VerticalOptions="Center"
WidthRequest="50"/>
<Label Text="Nombres de personnes :"
VerticalOptions="Center"
WidthRequest="160"/>
<Label Text="{Binding NbPersonnes}"
VerticalOptions="Center"
WidthRequest="50"/>
</StackLayout>
<!-- Deuxième ligne : Date d'arrivée -->
<StackLayout Orientation="Horizontal" Padding="5" HorizontalOptions="FillAndExpand">
<Label Text="Date d'arrivée :"
VerticalOptions="Center"
WidthRequest="150"/>
<Label Text="{Binding DateDebut, StringFormat='{0:dd/MM/yyyy}'}"
VerticalOptions="Center"
WidthRequest="100"/>
</StackLayout>
<!-- Troisième ligne : Date de départ -->
<StackLayout Orientation="Horizontal" Padding="5" HorizontalOptions="FillAndExpand">
<Label Text="Date de départ :"
VerticalOptions="Center"
WidthRequest="150"/>
<Label Text="Aujourd'hui"
VerticalOptions="Center"
WidthRequest="100"/>
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>

View File

@ -1,56 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using HegreHotel.Models;
using Microsoft.Maui.Controls;
using System.Collections.ObjectModel;
using System.IO;
using Microsoft.Maui.Storage;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HegreHotel.Views.GestionDepart;
public partial class GestionDepartPage : ContentPage
{
public ObservableCollection<Models.Reservation> ReservationsDeb { get; set; } = new ObservableCollection<Models.Reservation>();
public ObservableCollection<Models.Reservation> ReservationsFin { get; set; } = new ObservableCollection<Models.Reservation>();
public GestionDepartPage()
{
InitializeComponent();
LoadReservations();
}
private async void LoadReservations()
{
string dbPath = Path.Combine(FileSystem.AppDataDirectory, "HegreHotel.db3");
var db = SingletonConnection.GetInstance(dbPath);
var reservationList = await db.Table<Models.Reservation>().ToListAsync();
ReservationsDeb.Clear();
ReservationsFin.Clear();
foreach (var reservation in reservationList)
{
if (reservation.DateDebut == DateTime.Now.Date)
{
ReservationsDeb.Add(reservation);
} else if (reservation.DateFin == DateTime.Now.Date)
{
ReservationsFin.Add(reservation);
}
}
GestionArriveListView.ItemsSource = ReservationsDeb;
GestionDepartListView.ItemsSource = ReservationsFin;
}
private void GestionPage_OnAppearing(object? sender, EventArgs e)
{
LoadReservations();
}
}