From 57ddecbe9ebe939f2446372a9de5404ddd288511 Mon Sep 17 00:00:00 2001 From: nimaye Date: Fri, 14 Oct 2022 15:02:03 +0200 Subject: [PATCH 01/30] modification du stub --- Code/Model/Stub.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Code/Model/Stub.cs b/Code/Model/Stub.cs index 67fbc68..1a671fb 100644 --- a/Code/Model/Stub.cs +++ b/Code/Model/Stub.cs @@ -13,10 +13,15 @@ namespace Model public List Comptes = new(); // ajouter load all pour tout les inscrits + 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", 110,LoadBanques())); + Inscrits.Add(new("00002", "Livet", "hugolivet@gmail.com", "Hugo", "test", 280,LoadBanques())); + Inscrits.Add(new("00003", "Smith", "smith@gmail.com", "Luke", "test", 150,LoadBanques())); + Inscrits.Add(new("00004", "Jean", "jean@gmail.com", "sylvain", "test", 410,LoadBanques())); + Inscrits.Add(new("00005", "Franc", "franc@gmail.com", "Julie", "test", 820,LoadBanques())); + Inscrits.Add(new("00006", "March", "march@gmail.com", "bastien", "test", 1120,LoadBanques())); return Inscrits; } public List LoadBanques() @@ -27,8 +32,9 @@ namespace Model } public List LoadCompte() { - Comptes.Add(new("Livret A", 2)); - Comptes.Add(new("Compte Cheque", 2000)); + Comptes.Add(new("Livret A", 1500)); + Comptes.Add(new("Compte Courant", 2000)); + Comptes.Add(new("PEL", 22000)); return Comptes; } } From c48b6e2438a0c15e90929a37546e600ab54559ee Mon Sep 17 00:00:00 2001 From: nimaye Date: Fri, 14 Oct 2022 17:23:42 +0200 Subject: [PATCH 02/30] creation de connexion pour azure ... En attente --- Code/ConsEco.sln | 6 +++++ Code/LinqToSql/LinqToSql.csproj | 14 ++++++++++ Code/LinqToSql/Program.cs | 46 +++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 Code/LinqToSql/LinqToSql.csproj create mode 100644 Code/LinqToSql/Program.cs diff --git a/Code/ConsEco.sln b/Code/ConsEco.sln index 78d70d3..8ff780e 100644 --- a/Code/ConsEco.sln +++ b/Code/ConsEco.sln @@ -14,6 +14,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestsUnitaires", "TestsUnit {ACFA83F8-98C8-43AE-9328-B3F751098FFA} = {ACFA83F8-98C8-43AE-9328-B3F751098FFA} EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqToSql", "LinqToSql\LinqToSql.csproj", "{1F51162A-1232-42E1-A2C3-B19D96905696}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -36,6 +38,10 @@ Global {B1AE713C-B5DE-4E81-A33F-818AAD0548A7}.Debug|Any CPU.Build.0 = Debug|Any CPU {B1AE713C-B5DE-4E81-A33F-818AAD0548A7}.Release|Any CPU.ActiveCfg = Release|Any CPU {B1AE713C-B5DE-4E81-A33F-818AAD0548A7}.Release|Any CPU.Build.0 = Release|Any CPU + {1F51162A-1232-42E1-A2C3-B19D96905696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F51162A-1232-42E1-A2C3-B19D96905696}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F51162A-1232-42E1-A2C3-B19D96905696}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F51162A-1232-42E1-A2C3-B19D96905696}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Code/LinqToSql/LinqToSql.csproj b/Code/LinqToSql/LinqToSql.csproj new file mode 100644 index 0000000..59b04a5 --- /dev/null +++ b/Code/LinqToSql/LinqToSql.csproj @@ -0,0 +1,14 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + diff --git a/Code/LinqToSql/Program.cs b/Code/LinqToSql/Program.cs new file mode 100644 index 0000000..ca53f45 --- /dev/null +++ b/Code/LinqToSql/Program.cs @@ -0,0 +1,46 @@ +using System; +using Microsoft.Data.SqlClient; +using System.Text; + +namespace sqltest +{ + class Program + { + static void Main(string[] args) + { + try + { + SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(); + builder.DataSource = ".database.windows.net"; + builder.UserID = ""; + builder.Password = ""; + builder.InitialCatalog = ""; + + using (SqlConnection connection = new SqlConnection(builder.ConnectionString)) + { + Console.WriteLine("\nQuery data example:"); + Console.WriteLine("=========================================\n"); + + String sql = "SELECT name, collation_name FROM sys.databases"; + + using (SqlCommand command = new SqlCommand(sql, connection)) + { + connection.Open(); + using (SqlDataReader reader = command.ExecuteReader()) + { + while (reader.Read()) + { + Console.WriteLine("{0} {1}", reader.GetString(0), reader.GetString(1)); + } + } + } + } + } + catch (SqlException e) + { + Console.WriteLine(e.ToString()); + } + Console.ReadLine(); + } + } +} \ No newline at end of file From 47e8c4dcf997afac1f639e9e7949eebbaca68554 Mon Sep 17 00:00:00 2001 From: Nicolas MAYE Date: Sat, 15 Oct 2022 15:31:49 +0100 Subject: [PATCH 03/30] Mise en place de la persistance + modification du manager + liaison de la badd pgsql avec l'application --- Code/ConsEco.sln | 10 ++--- Code/IHM/App.xaml.cs | 3 ++ Code/IHM/IHM.csproj | 5 +++ Code/IHM/MainWindow.xaml | 2 + Code/IHM/MainWindow.xaml.cs | 30 +++++++++++++ Code/LinqToPgSQL/LinqToPgSQL.csproj | 17 +++++++ Code/LinqToPgSQL/PersLinqToPgSQL.cs | 69 +++++++++++++++++++++++++++++ Code/LinqToSql/LinqToSql.csproj | 14 ------ Code/LinqToSql/Program.cs | 46 ------------------- Code/Model/IPersistanceManager.cs | 13 ++++++ Code/Model/Inscrit.cs | 13 ++++++ Code/Model/Manager.cs | 36 ++++++++------- desktop.ini | 6 +++ 13 files changed, 183 insertions(+), 81 deletions(-) create mode 100644 Code/LinqToPgSQL/LinqToPgSQL.csproj create mode 100644 Code/LinqToPgSQL/PersLinqToPgSQL.cs delete mode 100644 Code/LinqToSql/LinqToSql.csproj delete mode 100644 Code/LinqToSql/Program.cs create mode 100644 Code/Model/IPersistanceManager.cs create mode 100644 desktop.ini diff --git a/Code/ConsEco.sln b/Code/ConsEco.sln index 8ff780e..4d578dd 100644 --- a/Code/ConsEco.sln +++ b/Code/ConsEco.sln @@ -14,7 +14,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestsUnitaires", "TestsUnit {ACFA83F8-98C8-43AE-9328-B3F751098FFA} = {ACFA83F8-98C8-43AE-9328-B3F751098FFA} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqToSql", "LinqToSql\LinqToSql.csproj", "{1F51162A-1232-42E1-A2C3-B19D96905696}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqToPgSQL", "LinqToPgSQL\LinqToPgSQL.csproj", "{4A9DB718-B874-4565-87B0-57C73B9BE240}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -38,10 +38,10 @@ Global {B1AE713C-B5DE-4E81-A33F-818AAD0548A7}.Debug|Any CPU.Build.0 = Debug|Any CPU {B1AE713C-B5DE-4E81-A33F-818AAD0548A7}.Release|Any CPU.ActiveCfg = Release|Any CPU {B1AE713C-B5DE-4E81-A33F-818AAD0548A7}.Release|Any CPU.Build.0 = Release|Any CPU - {1F51162A-1232-42E1-A2C3-B19D96905696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1F51162A-1232-42E1-A2C3-B19D96905696}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1F51162A-1232-42E1-A2C3-B19D96905696}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1F51162A-1232-42E1-A2C3-B19D96905696}.Release|Any CPU.Build.0 = Release|Any CPU + {4A9DB718-B874-4565-87B0-57C73B9BE240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4A9DB718-B874-4565-87B0-57C73B9BE240}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4A9DB718-B874-4565-87B0-57C73B9BE240}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4A9DB718-B874-4565-87B0-57C73B9BE240}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Code/IHM/App.xaml.cs b/Code/IHM/App.xaml.cs index aff7815..d606932 100644 --- a/Code/IHM/App.xaml.cs +++ b/Code/IHM/App.xaml.cs @@ -5,6 +5,8 @@ using System.Data; using System.Linq; using System.Threading.Tasks; using System.Windows; +using Model; +using LinqToPgSQL; namespace IHM { @@ -13,5 +15,6 @@ namespace IHM /// public partial class App : Application { + public Manager AllInscrits { get; private set; } = new Manager(new LinqToPgSQL.PersLinqToPgSQL()); } } diff --git a/Code/IHM/IHM.csproj b/Code/IHM/IHM.csproj index 7dc11f9..b8191b8 100644 --- a/Code/IHM/IHM.csproj +++ b/Code/IHM/IHM.csproj @@ -7,4 +7,9 @@ true + + + + + diff --git a/Code/IHM/MainWindow.xaml b/Code/IHM/MainWindow.xaml index d796ffe..4a745ad 100644 --- a/Code/IHM/MainWindow.xaml +++ b/Code/IHM/MainWindow.xaml @@ -7,6 +7,8 @@ mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> +