diff --git a/Sources/Data/PersLinqToPgSQL.cs b/Sources/Data/PersLinqToPgSQL.cs
index 00c61d3..2fcd14b 100644
--- a/Sources/Data/PersLinqToPgSQL.cs
+++ b/Sources/Data/PersLinqToPgSQL.cs
@@ -148,6 +148,35 @@ namespace LinqToPgSQL
await cmd.ExecuteNonQueryAsync();
}
+ public int CalculTotalSoldeComtpe(Inscrit user)
+ {
+ var conn = new NpgsqlConnection(connexionBDD);
+ Console.Out.WriteLine("Ouverture de la connection");
+ try
+ {
+ conn.Open();
+ }
+ catch
+ {
+ conn.Close();
+ Debug.WriteLine("Problème de connection à la base de données. Aprés fermeture, l'application se fermera automatiquement.");
+ Environment.Exit(-1);
+ }
+ NpgsqlCommand cmd = new NpgsqlCommand($"SELECT sum(c.solde) FROM Compte c, Inscrit i, InscrBanque ib WHERE i.mail = (@mailUser) AND i.id = ib.idinscrit AND c.idinscritbanque = ib.id", conn)
+ {
+ Parameters =
+ {
+ new NpgsqlParameter("mailuser", user.Mail),
+ }
+ };
+ NpgsqlDataReader dataReader = cmd.ExecuteReader();
+ if (dataReader.Read())
+ {
+ return dataReader.GetInt32(0);
+ }
+ return -1;
+ }
+
public string RecupMdpBdd(string mail)
{
var conn = new NpgsqlConnection(connexionBDD);
diff --git a/Sources/IHM/IHM.csproj b/Sources/IHM/IHM.csproj
index cbce615..e12cd6e 100644
--- a/Sources/IHM/IHM.csproj
+++ b/Sources/IHM/IHM.csproj
@@ -46,6 +46,9 @@
PreserveNewest
+
+ PreserveNewest
+
@@ -54,6 +57,10 @@
+
+
+
+
diff --git a/Sources/IHM/MainPage.xaml.cs b/Sources/IHM/MainPage.xaml.cs
index 9a31ac9..30f0bdd 100644
--- a/Sources/IHM/MainPage.xaml.cs
+++ b/Sources/IHM/MainPage.xaml.cs
@@ -25,6 +25,7 @@ namespace IHM
if (Mgr.isEqualHash(Mgr.recupMdpBdd(EntryMail.Text), EntryPassworld.Text))
{
Mgr.LoadInscrit(EntryMail.Text, EntryPassworld.Text);
+ Mgr.createUser(EntryMail.Text);
ConnexionValide();
}
else
diff --git a/Sources/IHM/Operations.xaml b/Sources/IHM/Operations.xaml
index 36ee16a..4dbb154 100644
--- a/Sources/IHM/Operations.xaml
+++ b/Sources/IHM/Operations.xaml
@@ -3,9 +3,59 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Operations">
+
+
+
+
+
+
+ HorizontalOptions="End"
+ Margin="10"
+ TextColor="{AppThemeBinding Light={StaticResource Gray100}, Dark={StaticResource Gray600}}"
+ FontSize="20"
+ FontAttributes="Bold"
+ />
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sources/IHM/Operations.xaml.cs b/Sources/IHM/Operations.xaml.cs
index dd1c8e6..d9a981b 100644
--- a/Sources/IHM/Operations.xaml.cs
+++ b/Sources/IHM/Operations.xaml.cs
@@ -1,9 +1,39 @@
+using Model;
+
namespace IHM;
public partial class Operations : ContentPage
{
+ public Manager Mgr => (App.Current as App).Manager;
public Operations()
{
InitializeComponent();
- }
+ BindingContext = Mgr;
+ double test = Mgr.recupTotalSolde();
+ double i = test / 2000;
+ PrgressAnimationBar(i);
+ }
+
+ private void Button_Clicked(object sender, EventArgs e)
+ {
+ double test = Mgr.recupTotalSolde();
+ double i = test/2000;
+ PrgressAnimationBar(i);
+ UpdateArc();
+ }
+ private async void UpdateArc()
+ {
+ ActualisationButton.IsEnabled = false;
+ int timeRemaining = 60;
+ while (timeRemaining != 0)
+ {
+ timeRemaining--;
+ await Task.Delay(1000);
+ }
+ ActualisationButton.IsEnabled = true;
+ }
+ private async void PrgressAnimationBar(double progress)
+ {
+ await ProgressBarSolde.ProgressTo(0.75, 500, Easing.Linear);
+ }
}
\ No newline at end of file
diff --git a/Sources/IHM/Resources/Images/refresh.png b/Sources/IHM/Resources/Images/refresh.png
new file mode 100644
index 0000000..c43cfe8
Binary files /dev/null and b/Sources/IHM/Resources/Images/refresh.png differ
diff --git a/Sources/Modele/IPersistanceManager.cs b/Sources/Modele/IPersistanceManager.cs
index cef2b6e..63dcc57 100644
--- a/Sources/Modele/IPersistanceManager.cs
+++ b/Sources/Modele/IPersistanceManager.cs
@@ -17,6 +17,7 @@ namespace Model
bool ExistEmail(string mail);
void ChangePasswordBdd(string mail, string newMdp);
string RecupMdpBdd(string mail);
+ int CalculTotalSoldeComtpe(Inscrit user);
IEnumerable LoadBanqueId(string id);
}
}
diff --git a/Sources/Modele/Inscrit.cs b/Sources/Modele/Inscrit.cs
index 458fd85..206a9c3 100644
--- a/Sources/Modele/Inscrit.cs
+++ b/Sources/Modele/Inscrit.cs
@@ -77,6 +77,11 @@ namespace Model
LesBanques = lesbanques;
}
+ public Inscrit(string mail)
+ {
+ Mail = mail;
+ }
+
public Inscrit(List lesbanques)
{
LesBanques = lesbanques;
diff --git a/Sources/Modele/Manager.cs b/Sources/Modele/Manager.cs
index 47c4661..fb91db0 100644
--- a/Sources/Modele/Manager.cs
+++ b/Sources/Modele/Manager.cs
@@ -12,6 +12,23 @@ namespace Model
public Hash hash = new Hash();
+ public int Solde
+ {
+ get => solde;
+ set
+ {
+ if(solde != value)
+ {
+ solde = value;
+ OnPropertyChanged(nameof(Solde));
+ }
+ }
+ }
+
+ private int solde;
+
+ public Inscrit User { get; set; }
+
public Banque SelectedBanque
{
get => selectedBanque;
@@ -85,6 +102,17 @@ namespace Model
return hash.IsEqualHash(mdpBdd, mdpSent);
}
+ public void createUser(string mail)
+ {
+ User = new Inscrit(mail);
+ }
+
+ public int recupTotalSolde()
+ {
+ Solde = Pers.CalculTotalSoldeComtpe(User);
+ return Solde;
+ }
+
public void deconnexion()
{
SelectedBanque= null;
diff --git a/Sources/Modele/Stub.cs b/Sources/Modele/Stub.cs
index 1b5ba0c..f34e091 100644
--- a/Sources/Modele/Stub.cs
+++ b/Sources/Modele/Stub.cs
@@ -16,7 +16,7 @@ namespace Model
// ajouter load all pour tout les inscrits
- /* public List LoadInscrit()
+ public List LoadInscrit()
{
Inscrits.Add(new("00001", "Evard", "lucasevard@gmail.com","Lucas","test",10,LoadBanques()));
Inscrits.Add(new("00002", "Livet", "hugolivet@gmail.com", "Hugo", "test", 280,LoadBanques()));
@@ -26,19 +26,21 @@ namespace Model
Inscrits.Add(new("00006", "March", "march@gmail.com", "bastien", "test", 1120,LoadBanques()));
return Inscrits;
}
+
public List LoadBanques()
{
Banques.Add(new("BNP Paribas", "https://mabanque.bnpparibas/", "https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png",LoadCompte()));
Banques.Add(new("Crédit Agricole", "https://www.credit-agricole.fr", "https://yt3.ggpht.com/a/AGF-l7_mEfX2eQaGm8GefLOg5ZMRciNw-pESE3gUWg=s900-c-k-c0xffffffff-no-rj-mo",LoadCompte()));
return Banques;
}
+
public List LoadCompte()
{
- Comptes.Add(new("Livret A", 1500));
- Comptes.Add(new("Compte Courant", 2000));
- Comptes.Add(new("PEL", 22000));
+ Comptes.Add(new("1","Livret A", 1500));
+ Comptes.Add(new("2","Compte Courant", 2000));
+ Comptes.Add(new("3","PEL", 22000));
return Comptes;
- }*/
+ }
}