diff --git a/README.md b/README.md index 4d1c84d..0face04 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Cons'Eco [![Build Status](https://codefirst.iut.uca.fr/api/badges/hugo.livet/ConsEco/status.svg)](https://codefirst.iut.uca.fr/hugo.livet/ConsEco) -[![Csharp](https://img.shields.io/badge/-CSharp-50C878?style=for-the-badge&logo=csharp)](https://learn.microsoft.com/fr-fr/dotnet/csharp/) [![Xaml](https://img.shields.io/badge/-XAML-6495ED?style=for-the-badge&logo=xaml)](https://learn.microsoft.com/fr-fr/dotnet/desktop/wpf/xaml/?view=netdesktop-6.0) [![.NET/MAUI](https://img.shields.io/badge/-.NET/WPF-B87333?style=for-the-badge&logo=dotnet)](https://learn.microsoft.com/fr-fr/dotnet/maui/what-is-maui?view=net-maui-7.0) +[![Csharp](https://img.shields.io/badge/-CSharp-50C878?style=for-the-badge&logo=csharp)](https://learn.microsoft.com/fr-fr/dotnet/csharp/) [![Xaml](https://img.shields.io/badge/-XAML-6495ED?style=for-the-badge&logo=xaml)](https://learn.microsoft.com/fr-fr/dotnet/desktop/wpf/xaml/?view=netdesktop-6.0) [![.NET/WPF](https://img.shields.io/badge/-.NET/WPF-B87333?style=for-the-badge&logo=dotnet)](https://learn.microsoft.com/fr-fr/dotnet/desktop/wpf/?view=netdesktop-6.0)
diff --git a/Sources/Data/PersLinqToPgSQL.cs b/Sources/Data/PersLinqToPgSQL.cs index 2927b13..d6fa114 100644 --- a/Sources/Data/PersLinqToPgSQL.cs +++ b/Sources/Data/PersLinqToPgSQL.cs @@ -13,14 +13,34 @@ using System.Threading; using Model; using System.Runtime.CompilerServices; using System.Data.Common; +using System.Reflection.PortableExecutable; namespace LinqToPgSQL { public class PersLinqToPgSQL : IPersistanceManager { private Hash hash = new Hash(); - string connexionBDD = String.Format("Server=90.114.135.116; Username=postgres; Database=conseco; Port=5432; Password=lulu; SSLMode=Prefer"); - + private static string connexionBDD = String.Format("Server=2.3.8.130; Username=postgres; Database=conseco; Port=5432; Password=lulu; SSLMode=Prefer"); + private static NpgsqlConnection dbAccess = new NpgsqlConnection(connexionBDD); + public bool TestConnexionAsDatabase() + { + bool isOk = true; + try + { + dbAccess.Open(); + } + catch(NpgsqlException ex) + { + isOk = false; + Debug.WriteLine("Problème de connection à la base de données. - " + ex.Message); + } + finally + { + dbAccess.Close(); + } + return isOk; + } + public string LoadInscrit(string id, string mdp) { int resultat=0; @@ -53,7 +73,11 @@ namespace LinqToPgSQL { var conn = new NpgsqlConnection(connexionBDD); Console.Out.WriteLine("Ouverture de la connection"); - try + + conn.Open(); + + + /*try { conn.Open(); } @@ -62,7 +86,7 @@ namespace LinqToPgSQL conn.Close(); Debug.WriteLine("Problème de connection à la base de données. Aprés fermeture, l'application se fermera automatiquement."); Environment.Exit(-1); - } + }*/ NpgsqlDataReader dbReader = new NpgsqlCommand("SELECT mail FROM Inscrit", conn).ExecuteReader(); @@ -335,5 +359,22 @@ namespace LinqToPgSQL // attente des autres supression } + + public IList ImportBanques() + { + IList bquesDispo = new List(); + dbAccess.Open(); + + NpgsqlCommand cmd = new NpgsqlCommand($"SELECT * FROM Banque", dbAccess); + NpgsqlDataReader dbReader = cmd.ExecuteReader(); + while (dbReader.Read()) + { + bquesDispo.Add(new Banque(dbReader.GetString(0), dbReader.GetString(1), dbReader.GetString(2))); + } + dbAccess.Close(); + return bquesDispo; + } + + } } \ No newline at end of file diff --git a/Sources/IHM/AppShell.xaml b/Sources/IHM/AppShell.xaml index f5e6baf..87ab094 100644 --- a/Sources/IHM/AppShell.xaml +++ b/Sources/IHM/AppShell.xaml @@ -7,11 +7,6 @@ Shell.FlyoutBehavior="Disabled" Shell.NavBarIsVisible="False"> - - + + + + + + diff --git a/Sources/IHM/AppShell.xaml.cs b/Sources/IHM/AppShell.xaml.cs index e82d776..1001ddd 100644 --- a/Sources/IHM/AppShell.xaml.cs +++ b/Sources/IHM/AppShell.xaml.cs @@ -14,12 +14,16 @@ namespace IHM Routing.RegisterRoute("Inscription", typeof(Inscription)); Routing.RegisterRoute("ForgetPassword", typeof(ForgetPassword)); Routing.RegisterRoute("ChangePassword", typeof(ChangePassword)); + Routing.RegisterRoute("GestionBanques", typeof(GestionBanques)); + Routing.RegisterRoute("AjoutBanques", typeof(AjoutBanques)); + + Routing.RegisterRoute("ErrorPage", typeof(ErrorPage)); + - } - - - + + + } } \ No newline at end of file diff --git a/Sources/IHM/Composant/BanqueDispo.xaml b/Sources/IHM/Composant/BanqueDispo.xaml new file mode 100644 index 0000000..cce516c --- /dev/null +++ b/Sources/IHM/Composant/BanqueDispo.xaml @@ -0,0 +1,12 @@ + + + + + + +