diff --git a/ParionsCuite/ParionsCuite/MainPage.xaml b/ParionsCuite/ParionsCuite/MainPage.xaml
index 102d226..eecdcc7 100644
--- a/ParionsCuite/ParionsCuite/MainPage.xaml
+++ b/ParionsCuite/ParionsCuite/MainPage.xaml
@@ -13,64 +13,41 @@
xmlns:autre="clr-namespace:ParionsCuite.Views.Participations.Autre"
>
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/ParionsCuite/ParionsCuite/Modeles/Evenement.cs b/ParionsCuite/ParionsCuite/Modeles/Evenement.cs
index 1109526..7fd7afa 100644
--- a/ParionsCuite/ParionsCuite/Modeles/Evenement.cs
+++ b/ParionsCuite/ParionsCuite/Modeles/Evenement.cs
@@ -44,6 +44,7 @@ namespace ParionsCuite.Modeles
Heure = heure;
ListInviter = new List();
ListParier = new List();
+ Participation = new Participation();
}
public Evenement(string nom, string date, string lieu, string heure, Participation participation)
{
diff --git a/ParionsCuite/ParionsCuite/Modeles/Manageur.cs b/ParionsCuite/ParionsCuite/Modeles/Manageur.cs
index 02a9ee9..a3285e0 100644
--- a/ParionsCuite/ParionsCuite/Modeles/Manageur.cs
+++ b/ParionsCuite/ParionsCuite/Modeles/Manageur.cs
@@ -103,7 +103,7 @@ namespace ParionsCuite.Modeles
}
public void Charge_Donnee()
- {
+ {
var donnees = Persistance.chargeDonnees();
foreach (var donnee in donnees)
{
diff --git a/ParionsCuite/ParionsCuite/Modeles/Participation.cs b/ParionsCuite/ParionsCuite/Modeles/Participation.cs
index 10a456e..7d35446 100644
--- a/ParionsCuite/ParionsCuite/Modeles/Participation.cs
+++ b/ParionsCuite/ParionsCuite/Modeles/Participation.cs
@@ -17,7 +17,7 @@ namespace ParionsCuite.Modeles
[DataMember]
public List Boissons { get; private set; }
[DataMember]
- public List Nourriture { get; private set; }
+ public List Nourriture { get; private set; }
[DataMember]
public List Autre { get; private set; }
@@ -27,6 +27,13 @@ namespace ParionsCuite.Modeles
Nourriture = nourriture;
Autre = autre;
}
+
+ public Participation()
+ {
+ Boissons = new List();
+ Nourriture = new List();
+ Autre = new List();
+ }
/* Boisson */
diff --git a/ParionsCuite/ParionsCuite/ParionsCuite.csproj b/ParionsCuite/ParionsCuite/ParionsCuite.csproj
index 202f7a8..04d67ef 100644
--- a/ParionsCuite/ParionsCuite/ParionsCuite.csproj
+++ b/ParionsCuite/ParionsCuite/ParionsCuite.csproj
@@ -71,6 +71,9 @@
MSBuild:Compile
+
+ MSBuild:Compile
+
MSBuild:Compile
@@ -94,7 +97,6 @@
-
diff --git a/ParionsCuite/ParionsCuite/Views/Pari/Parier.xaml.cs b/ParionsCuite/ParionsCuite/Views/Pari/Parier.xaml.cs
index f7d9b00..b199a57 100644
--- a/ParionsCuite/ParionsCuite/Views/Pari/Parier.xaml.cs
+++ b/ParionsCuite/ParionsCuite/Views/Pari/Parier.xaml.cs
@@ -18,5 +18,6 @@ public partial class Parier : ContentView
private void AjoutPariView(object sender, EventArgs e)
{
+
}
}
\ No newline at end of file
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/Autre/Autres.xaml b/ParionsCuite/ParionsCuite/Views/Participations/Autre/Autres.xaml
index 0aeb6c3..ba43890 100644
--- a/ParionsCuite/ParionsCuite/Views/Participations/Autre/Autres.xaml
+++ b/ParionsCuite/ParionsCuite/Views/Participations/Autre/Autres.xaml
@@ -2,53 +2,35 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
+
-
-
-
+
+
+
-
-
-
-
+
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/Autre/Autres.xaml.cs b/ParionsCuite/ParionsCuite/Views/Participations/Autre/Autres.xaml.cs
index 50c1080..2717630 100644
--- a/ParionsCuite/ParionsCuite/Views/Participations/Autre/Autres.xaml.cs
+++ b/ParionsCuite/ParionsCuite/Views/Participations/Autre/Autres.xaml.cs
@@ -1,9 +1,173 @@
-namespace ParionsCuite.Views.Participations.Autre;
+using ParionsCuite.Modeles;
+using ParionsCuite.Views.Participations;
+using System.Diagnostics;
+
+namespace ParionsCuite.Views.Participations.Autre;
public partial class Autres : ContentView
{
- public Autres()
+
+ readonly Evenement EventSelect;
+
+ public Manageur mgr => (App.Current as App).MyManager;
+
+ public Autres(Evenement EventSelect)
{
- InitializeComponent();
- }
+ this.EventSelect = EventSelect;
+ InitializeComponent();
+ restoreListAutre(EventSelect);
+ BindingContext = this;
+ }
+
+ public void restoreListAutre(Evenement EventSelect)
+ {
+
+ List listAutre = EventSelect.Participation.Autre;
+ Debug.WriteLine("TEst " + listAutre.Count());
+ int len = 1;
+ foreach (Modeles.Autre food in listAutre)
+ {
+ RowDefinition row = new RowDefinition();
+ row.Height = new GridLength(45);
+ GridAutre.RowDefinitions.Add(row);
+
+ // AJout Nourriture
+ Label AutreLabel = new Label();
+ AutreLabel.Text = food.Nom.ToString();
+ Debug.WriteLine(AutreLabel);
+ Grid.SetRow(AutreLabel, len);
+ Grid.SetColumn(AutreLabel, 0);
+ GridAutre.Children.Add(AutreLabel);
+
+
+ // Ajout Quantite
+ Label qteLabel = new Label();
+ qteLabel.Text = food.Quantite.ToString();
+ Grid.SetRow(qteLabel, len);
+ Grid.SetColumn(qteLabel, 1);
+ GridAutre.Children.Add(qteLabel);
+
+ // Ajout Bouton
+
+ Button buttonMoins = new Button();
+ buttonMoins.Text = "-";
+ buttonMoins.Clicked += BoutonSupprimer_Clicked;
+ Grid.SetRow(buttonMoins, len);
+ Grid.SetColumn(buttonMoins, 2);
+ GridAutre.Children.Add(buttonMoins);
+
+ len++;
+ Debug.WriteLine("Test test");
+
+ }
+
+ }
+
+ private async void AddAutrelist(object sender, EventArgs e)
+ {
+ //restoreListInvite();
+ string autre = AutreInput.Text;
+ string qte = QteInput.Text;
+ if (int.TryParse(qte, out int value))
+ {
+ if (autre == null || qte == null) { return; }
+ Modeles.Autre autre1 = new Modeles.Autre(autre, Int32.Parse(qte));
+ EventSelect.Participation.Autre.Add(autre1);
+ int len = 1;
+ //if (len == 0 ) { len = 1; }
+ foreach (Modeles.Autre autre2 in EventSelect.Participation.Autre)
+ {
+ RowDefinition row = new RowDefinition();
+ row.Height = new GridLength(45);
+ GridAutre.RowDefinitions.Add(row);
+
+ // AJout Nourriture
+ Label AutreLabel = new Label();
+ AutreLabel.Text = autre2.Nom;
+ Grid.SetRow(AutreLabel, len);
+ Grid.SetColumn(AutreLabel, 0);
+ GridAutre.Children.Add(AutreLabel);
+
+
+ // Ajout Quantite
+ Label qteLabel = new Label();
+ qteLabel.Text = autre2.Quantite.ToString();
+ Grid.SetRow(qteLabel, len);
+ Grid.SetColumn(qteLabel, 1);
+ GridAutre.Children.Add(qteLabel);
+
+ // Ajout Bouton
+
+ Button buttonMoins = new Button();
+ buttonMoins.Text = "-";
+ buttonMoins.Clicked += BoutonSupprimer_Clicked;
+ Grid.SetRow(buttonMoins, len);
+ Grid.SetColumn(buttonMoins, 2);
+ GridAutre.Children.Add(buttonMoins);
+
+ len++;
+ Debug.WriteLine("Test test");
+ }
+ }
+ else
+ {
+ //await DisplayAlert("esv", "efds", "OK");
+ return;
+ }
+
+
+ }
+
+ private void BoutonSupprimer_Clicked(object sender, EventArgs e)
+ {
+ // Récupérer le bouton cliqué
+ Button button = (Button)sender;
+
+ // Récupérer la grille parente du bouton
+ Grid parentGrid = (Grid)button.Parent;
+
+ // Récupérer la ligne parente du bouton
+ int rowIndex = Grid.GetRow(button);
+
+ // Vérifier que l'indice rowIndex est valide
+
+ Label AutreLabel = null;
+ Label qteLabel = null;
+
+ // Parcourir les enfants de la grille pour trouver les labels de la ligne
+ foreach (View child in parentGrid.Children)
+ {
+ int childRowIndex = Grid.GetRow(child);
+
+ if (childRowIndex == rowIndex)
+ {
+ if (Grid.GetColumn(child) == 0)
+ AutreLabel = (Label)child;
+ else if (Grid.GetColumn(child) == 1)
+ qteLabel = (Label)child;
+ }
+ }
+
+ if (AutreLabel != null && qteLabel != null)
+ {
+ // Récupérer le prénom et le nom de l'invité à supprimer
+ string nom = AutreLabel.Text;
+ string qte = qteLabel.Text;
+
+ // Rechercher l'invité correspondant dans la liste
+ Modeles.Autre autre = EventSelect.Participation.Autre.FirstOrDefault(i => i.Nom == nom && i.Quantite.ToString() == qte);
+
+ if (autre != null)
+ {
+ // Supprimer l'invité de la liste
+ EventSelect.Participation.Autre.Remove(autre);
+
+ // Supprimer les éléments de la ligne de la grille
+ parentGrid.Children.Remove(AutreLabel);
+ parentGrid.Children.Remove(qteLabel);
+ parentGrid.Children.Remove(button);
+ parentGrid.RowDefinitions.RemoveAt(rowIndex);
+ }
+ }
+ }
}
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/Boisson/Boissons.xaml b/ParionsCuite/ParionsCuite/Views/Participations/Boisson/Boissons.xaml
deleted file mode 100644
index ed8398a..0000000
--- a/ParionsCuite/ParionsCuite/Views/Participations/Boisson/Boissons.xaml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/Boisson/Boissons.xaml.cs b/ParionsCuite/ParionsCuite/Views/Participations/Boisson/Boissons.xaml.cs
deleted file mode 100644
index 183d1b2..0000000
--- a/ParionsCuite/ParionsCuite/Views/Participations/Boisson/Boissons.xaml.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace ParionsCuite.Views.Participations.Boisson;
-
-public partial class Boissons : ContentView
-{
- public Boissons()
- {
- InitializeComponent();
- }
-}
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/Boisson/Drink.xaml b/ParionsCuite/ParionsCuite/Views/Participations/Boisson/Drink.xaml
new file mode 100644
index 0000000..1a2a95a
--- /dev/null
+++ b/ParionsCuite/ParionsCuite/Views/Participations/Boisson/Drink.xaml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/Boisson/Drink.xaml.cs b/ParionsCuite/ParionsCuite/Views/Participations/Boisson/Drink.xaml.cs
new file mode 100644
index 0000000..4b05360
--- /dev/null
+++ b/ParionsCuite/ParionsCuite/Views/Participations/Boisson/Drink.xaml.cs
@@ -0,0 +1,173 @@
+using ParionsCuite.Modeles;
+using ParionsCuite.Views.Participations;
+using System.Diagnostics;
+
+namespace ParionsCuite.Views.Participations.Boisson;
+
+public partial class Drink : ContentView
+{
+
+ readonly Evenement EventSelect;
+
+ public Manageur mgr => (App.Current as App).MyManager;
+
+ public Drink(Evenement EventSelect)
+ {
+ this.EventSelect = EventSelect;
+ InitializeComponent();
+ restoreListBoisson(EventSelect);
+ BindingContext = this;
+ }
+
+ public void restoreListBoisson(Evenement EventSelect)
+ {
+
+ List listDrink = EventSelect.Participation.Boissons;
+ Debug.WriteLine("TEst " + listDrink.Count());
+ int len = 1;
+ foreach (Modeles.Boisson food in listDrink)
+ {
+ RowDefinition row = new RowDefinition();
+ row.Height = new GridLength(45);
+ GridDrink.RowDefinitions.Add(row);
+
+ // AJout Nourriture
+ Label DrinkLabel = new Label();
+ DrinkLabel.Text = food.Nom.ToString();
+ Debug.WriteLine(DrinkLabel);
+ Grid.SetRow(DrinkLabel, len);
+ Grid.SetColumn(DrinkLabel, 0);
+ GridDrink.Children.Add(DrinkLabel);
+
+
+ // Ajout Quantite
+ Label qteLabel = new Label();
+ qteLabel.Text = food.Quantite.ToString();
+ Grid.SetRow(qteLabel, len);
+ Grid.SetColumn(qteLabel, 1);
+ GridDrink.Children.Add(qteLabel);
+
+ // Ajout Bouton
+
+ Button buttonMoins = new Button();
+ buttonMoins.Text = "-";
+ buttonMoins.Clicked += BoutonSupprimer_Clicked;
+ Grid.SetRow(buttonMoins, len);
+ Grid.SetColumn(buttonMoins, 2);
+ GridDrink.Children.Add(buttonMoins);
+
+ len++;
+ Debug.WriteLine("Test test");
+
+ }
+
+ }
+
+ private async void AddDrinklist(object sender, EventArgs e)
+ {
+ //restoreListInvite();
+ string drink = DrinkInput.Text;
+ string qte = QteInput.Text;
+ if (int.TryParse(qte, out int value))
+ {
+ if (drink == null || qte == null) { return; }
+ Modeles.Boisson drink1 = new Modeles.Boisson(drink, Int32.Parse(qte));
+ EventSelect.Participation.Boissons.Add(drink1);
+ int len = 1;
+ //if (len == 0 ) { len = 1; }
+ foreach (Modeles.Nourriture food2 in EventSelect.Participation.Nourriture)
+ {
+ RowDefinition row = new RowDefinition();
+ row.Height = new GridLength(45);
+ GridDrink.RowDefinitions.Add(row);
+
+ // AJout Nourriture
+ Label DrinkLabel = new Label();
+ DrinkLabel.Text = food2.Nom;
+ Grid.SetRow(DrinkLabel, len);
+ Grid.SetColumn(DrinkLabel, 0);
+ GridDrink.Children.Add(DrinkLabel);
+
+
+ // Ajout Quantite
+ Label qteLabel = new Label();
+ qteLabel.Text = food2.Quantite.ToString();
+ Grid.SetRow(qteLabel, len);
+ Grid.SetColumn(qteLabel, 1);
+ GridDrink.Children.Add(qteLabel);
+
+ // Ajout Bouton
+
+ Button buttonMoins = new Button();
+ buttonMoins.Text = "-";
+ buttonMoins.Clicked += BoutonSupprimer_Clicked;
+ Grid.SetRow(buttonMoins, len);
+ Grid.SetColumn(buttonMoins, 2);
+ GridDrink.Children.Add(buttonMoins);
+
+ len++;
+ Debug.WriteLine("Test test");
+ }
+ }
+ else
+ {
+ //await DisplayAlert("esv", "efds", "OK");
+ return;
+ }
+
+
+ }
+
+ private void BoutonSupprimer_Clicked(object sender, EventArgs e)
+ {
+ // Récupérer le bouton cliqué
+ Button button = (Button)sender;
+
+ // Récupérer la grille parente du bouton
+ Grid parentGrid = (Grid)button.Parent;
+
+ // Récupérer la ligne parente du bouton
+ int rowIndex = Grid.GetRow(button);
+
+ // Vérifier que l'indice rowIndex est valide
+
+ Label DrinkLabel = null;
+ Label qteLabel = null;
+
+ // Parcourir les enfants de la grille pour trouver les labels de la ligne
+ foreach (View child in parentGrid.Children)
+ {
+ int childRowIndex = Grid.GetRow(child);
+
+ if (childRowIndex == rowIndex)
+ {
+ if (Grid.GetColumn(child) == 0)
+ DrinkLabel = (Label)child;
+ else if (Grid.GetColumn(child) == 1)
+ qteLabel = (Label)child;
+ }
+ }
+
+ if (DrinkLabel != null && qteLabel != null)
+ {
+ // Récupérer le prénom et le nom de l'invité à supprimer
+ string nom = DrinkLabel.Text;
+ string qte = qteLabel.Text;
+
+ // Rechercher l'invité correspondant dans la liste
+ Modeles.Boisson drink = EventSelect.Participation.Boissons.FirstOrDefault(i => i.Nom == nom && i.Quantite.ToString() == qte);
+
+ if (drink != null)
+ {
+ // Supprimer l'invité de la liste
+ EventSelect.Participation.Boissons.Remove(drink);
+
+ // Supprimer les éléments de la ligne de la grille
+ parentGrid.Children.Remove(DrinkLabel);
+ parentGrid.Children.Remove(qteLabel);
+ parentGrid.Children.Remove(button);
+ parentGrid.RowDefinitions.RemoveAt(rowIndex);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml b/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml
index 152e888..a8a8319 100644
--- a/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml
+++ b/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml
@@ -2,32 +2,35 @@
+
-
+
-
+
-
+
-
+
-
-
+
+
+
+
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml.cs b/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml.cs
index fda0f40..7242c95 100644
--- a/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml.cs
+++ b/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml.cs
@@ -14,16 +14,16 @@ public partial class Nourri : ContentView
{
this.EventSelect = EventSelect;
InitializeComponent();
- //restoreListInvite(EventSelect);
+ restoreListFood(EventSelect);
BindingContext = this;
}
- public void restoreListInvite(Evenement EventSelect)
+ public void restoreListFood(Evenement EventSelect)
{
- var listFood = EventSelect.Participation.Nourriture;
- Debug.WriteLine(listFood);
+ List listFood = EventSelect.Participation.Nourriture;
+ Debug.WriteLine("TEst " + listFood.Count());
int len = 1;
foreach (Modeles.Nourriture food in listFood)
{
@@ -31,17 +31,18 @@ public partial class Nourri : ContentView
row.Height = new GridLength(45);
GridFood.RowDefinitions.Add(row);
- // AJout Prenom
+ // AJout Nourriture
Label foodLabel = new Label();
- foodLabel.Text = food.Nom;
+ foodLabel.Text = food.Nom.ToString();
+ Debug.WriteLine(foodLabel);
Grid.SetRow(foodLabel, len);
Grid.SetColumn(foodLabel, 0);
GridFood.Children.Add(foodLabel);
- // Ajout Nom
+ // Ajout Quantite
Label qteLabel = new Label();
- food.Nom = food.Quantite.ToString();
+ qteLabel.Text = food.Quantite.ToString();
Grid.SetRow(qteLabel, len);
Grid.SetColumn(qteLabel, 1);
GridFood.Children.Add(qteLabel);
@@ -62,49 +63,57 @@ public partial class Nourri : ContentView
}
- private void AddFoodlist(object sender, EventArgs e)
+ private async void AddFoodlist(object sender, EventArgs e)
{
//restoreListInvite();
string food = FoodInput.Text;
string qte = QteInput.Text;
- if (food == null || qte == null) { return; }
- Modeles.Nourriture food1 = new Modeles.Nourriture(food, Int32.Parse(qte));
- EventSelect.Participation.Nourriture.Add(food1);
- int len = 1;
- //if (len == 0 ) { len = 1; }
- foreach (Modeles.Nourriture food2 in EventSelect.Participation.Nourriture)
+ if (int.TryParse(qte, out int value))
{
- RowDefinition row = new RowDefinition();
- row.Height = new GridLength(45);
- GridFood.RowDefinitions.Add(row);
-
- // AJout Prenom
- Label foodLabel = new Label();
- foodLabel.Text = food2.Nom;
- Grid.SetRow(foodLabel, len);
- Grid.SetColumn(foodLabel, 0);
- GridFood.Children.Add(foodLabel);
-
-
- // Ajout Nom
- Label qteLabel = new Label();
- food2.Nom = food2.Quantite.ToString();
- Grid.SetRow(qteLabel, len);
- Grid.SetColumn(qteLabel, 1);
- GridFood.Children.Add(qteLabel);
-
- // Ajout Bouton
-
- Button buttonMoins = new Button();
- buttonMoins.Text = "-";
- buttonMoins.Clicked += BoutonSupprimer_Clicked;
- Grid.SetRow(buttonMoins, len);
- Grid.SetColumn(buttonMoins, 2);
- GridFood.Children.Add(buttonMoins);
-
- len++;
- Debug.WriteLine("Test test");
+ if (food == null || qte == null) { return; }
+ Modeles.Nourriture food1 = new Modeles.Nourriture(food, Int32.Parse(qte));
+ EventSelect.Participation.Nourriture.Add(food1);
+ int len = 1;
+ //if (len == 0 ) { len = 1; }
+ foreach (Modeles.Nourriture food2 in EventSelect.Participation.Nourriture)
+ {
+ RowDefinition row = new RowDefinition();
+ row.Height = new GridLength(45);
+ GridFood.RowDefinitions.Add(row);
+
+ // AJout Nourriture
+ Label foodLabel = new Label();
+ foodLabel.Text = food2.Nom;
+ Grid.SetRow(foodLabel, len);
+ Grid.SetColumn(foodLabel, 0);
+ GridFood.Children.Add(foodLabel);
+
+
+ // Ajout Quantite
+ Label qteLabel = new Label();
+ qteLabel.Text = food2.Quantite.ToString();
+ Grid.SetRow(qteLabel, len);
+ Grid.SetColumn(qteLabel, 1);
+ GridFood.Children.Add(qteLabel);
+
+ // Ajout Bouton
+
+ Button buttonMoins = new Button();
+ buttonMoins.Text = "-";
+ buttonMoins.Clicked += BoutonSupprimer_Clicked;
+ Grid.SetRow(buttonMoins, len);
+ Grid.SetColumn(buttonMoins, 2);
+ GridFood.Children.Add(buttonMoins);
+
+ len++;
+ Debug.WriteLine("Test test");
+ }
+ }
+ else {
+ //await DisplayAlert("esv", "efds", "OK");
+ return;
}
+
}
@@ -121,8 +130,8 @@ public partial class Nourri : ContentView
// Vérifier que l'indice rowIndex est valide
- Label prenomLabel = null;
- Label nomLabel = null;
+ Label foodLabel = null;
+ Label qteLabel = null;
// Parcourir les enfants de la grille pour trouver les labels de la ligne
foreach (View child in parentGrid.Children)
@@ -132,29 +141,29 @@ public partial class Nourri : ContentView
if (childRowIndex == rowIndex)
{
if (Grid.GetColumn(child) == 0)
- prenomLabel = (Label)child;
+ foodLabel = (Label)child;
else if (Grid.GetColumn(child) == 1)
- nomLabel = (Label)child;
+ qteLabel = (Label)child;
}
}
- if (prenomLabel != null && nomLabel != null)
+ if (foodLabel != null && qteLabel != null)
{
// Récupérer le prénom et le nom de l'invité à supprimer
- string prenom = prenomLabel.Text;
- string nom = nomLabel.Text;
+ string nom = foodLabel.Text;
+ string qte = qteLabel.Text;
// Rechercher l'invité correspondant dans la liste
- Modeles.Inviter inviter = EventSelect.ListInviter.FirstOrDefault(i => i.Prenom == prenom && i.Nom == nom);
+ Modeles.Nourriture nourriture = EventSelect.Participation.Nourriture.FirstOrDefault(i => i.Nom == nom && i.Quantite.ToString() == qte);
- if (inviter != null)
+ if (nourriture != null)
{
// Supprimer l'invité de la liste
- EventSelect.ListInviter.Remove(inviter);
+ EventSelect.Participation.Nourriture.Remove(nourriture);
// Supprimer les éléments de la ligne de la grille
- parentGrid.Children.Remove(prenomLabel);
- parentGrid.Children.Remove(nomLabel);
+ parentGrid.Children.Remove(foodLabel);
+ parentGrid.Children.Remove(qteLabel);
parentGrid.Children.Remove(button);
parentGrid.RowDefinitions.RemoveAt(rowIndex);
}
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml b/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml
index ce72971..3c34504 100644
--- a/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml
+++ b/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml
@@ -8,20 +8,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml.cs b/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml.cs
index bd80c6b..5ec7c92 100644
--- a/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml.cs
+++ b/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml.cs
@@ -27,7 +27,7 @@ public partial class Nourriture : ContentView
{
if (EventSelect == null) { return; }
- var newPage = new Views.Participations.NewFolder1.Nourri(EventSelect);
+ var newPage = new Views.Participations.Boisson.Drink(EventSelect);
changeButton.Content = newPage;
}
@@ -36,7 +36,7 @@ public partial class Nourriture : ContentView
{
if (EventSelect == null) { return; }
- var newPage = new Views.Participations.NewFolder1.Nourri(EventSelect);
+ var newPage = new Views.Participations.Autre.Autres(EventSelect);
changeButton.Content = newPage;
}