From 782d82eb74a6b2cd98275f900f02d431b3c144d2 Mon Sep 17 00:00:00 2001 From: hulivet1 Date: Thu, 5 Jan 2023 17:24:28 +0100 Subject: [PATCH] =?UTF-8?q?Remise=20en=20=C3=A9tat=20avec=20le=20nouvel=20?= =?UTF-8?q?IPersistanceManager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Data/LoadOperation.cs | 4 ++-- Sources/Data/PersAPI.cs | 5 +++++ Sources/IHM/Mobile/AjoutBanques.xaml.cs | 8 ++++---- Sources/IHM/Mobile/Dashboard.xaml.cs | 4 ++-- Sources/IHM/Mobile/ErrorPage.xaml.cs | 4 ++-- Sources/IHM/Mobile/GestionBanques.xaml.cs | 2 +- Sources/Modele/IPersistanceManager.cs | 1 + Sources/Modele/Manager.cs | 11 ++++++----- 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/Sources/Data/LoadOperation.cs b/Sources/Data/LoadOperation.cs index cd95fa0..a47c7b9 100644 --- a/Sources/Data/LoadOperation.cs +++ b/Sources/Data/LoadOperation.cs @@ -12,7 +12,7 @@ using static System.Net.Mime.MediaTypeNames; namespace Data { - public class LoadOperation + public static class LoadOperation { public static IList LoadOperationsFromOFX(string ofx) { @@ -112,7 +112,7 @@ namespace Data } - public static string[] CutRow(string row) + private static string[] CutRow(string row) { string[] cutRow; if (row == null) throw new ArgumentNullException(); diff --git a/Sources/Data/PersAPI.cs b/Sources/Data/PersAPI.cs index baad602..e050a2e 100644 --- a/Sources/Data/PersAPI.cs +++ b/Sources/Data/PersAPI.cs @@ -129,5 +129,10 @@ namespace Data { return ClientAPI.GetStateApi().GetAwaiter().GetResult(); } + + public IList GetDataFromOFX(string path) + { + return LoadOperation.LoadOperationsFromOFX(path); + } } } \ No newline at end of file diff --git a/Sources/IHM/Mobile/AjoutBanques.xaml.cs b/Sources/IHM/Mobile/AjoutBanques.xaml.cs index 50011ff..6d7e9c1 100644 --- a/Sources/IHM/Mobile/AjoutBanques.xaml.cs +++ b/Sources/IHM/Mobile/AjoutBanques.xaml.cs @@ -11,7 +11,7 @@ public partial class AjoutBanques : ContentPage { InitializeComponent(); BindingContext = Mgr; - //Mgr.importBanques(); + Mgr.importBanques(); if (OperatingSystem.IsIOS()) { boutonRetour.IsVisible = true; @@ -29,12 +29,12 @@ public partial class AjoutBanques : ContentPage { if (result.FileName.EndsWith("ofx", StringComparison.OrdinalIgnoreCase)) { - //IList lesComptes = Mgr.getCompteFromOFX(result.FullPath); - /*Debug.WriteLine(lesComptes.Count); + IList lesComptes = Mgr.Pers.GetDataFromOFX(result.FullPath); + Debug.WriteLine(lesComptes.Count); foreach(Compte compte in lesComptes) { Mgr.User.LesBanques.First().AjouterCompte(compte); - }*/ + } } } diff --git a/Sources/IHM/Mobile/Dashboard.xaml.cs b/Sources/IHM/Mobile/Dashboard.xaml.cs index 6be0d67..cf3538e 100644 --- a/Sources/IHM/Mobile/Dashboard.xaml.cs +++ b/Sources/IHM/Mobile/Dashboard.xaml.cs @@ -17,11 +17,11 @@ public partial class DashBoard : ContentPage } - /* if (!Mgr.testConnexionAsDatabase()) + if (!Mgr.Pers.TestConnexion()) { loadPage(new ErrorPage()); - }*/ + } } diff --git a/Sources/IHM/Mobile/ErrorPage.xaml.cs b/Sources/IHM/Mobile/ErrorPage.xaml.cs index 7809cb6..9863e1e 100644 --- a/Sources/IHM/Mobile/ErrorPage.xaml.cs +++ b/Sources/IHM/Mobile/ErrorPage.xaml.cs @@ -22,10 +22,10 @@ public partial class ErrorPage : ContentPage public void conIsActive() { - /*while (!Mgr.testConnexionAsDatabase()) + while (!Mgr.Pers.TestConnexion()) { Thread.Sleep(TIME_TEST_DB); - }*/ + } ConnexionValide(); return; diff --git a/Sources/IHM/Mobile/GestionBanques.xaml.cs b/Sources/IHM/Mobile/GestionBanques.xaml.cs index 04681a8..6d1001a 100644 --- a/Sources/IHM/Mobile/GestionBanques.xaml.cs +++ b/Sources/IHM/Mobile/GestionBanques.xaml.cs @@ -11,7 +11,7 @@ public partial class GestionBanques : ContentPage { InitializeComponent(); BindingContext= Mgr; - //Mgr.LoadBanques(); + Mgr.LoadBanques(); if (OperatingSystem.IsIOS()) { boutonRetour.IsVisible = true; diff --git a/Sources/Modele/IPersistanceManager.cs b/Sources/Modele/IPersistanceManager.cs index cfbd58e..5d6992a 100644 --- a/Sources/Modele/IPersistanceManager.cs +++ b/Sources/Modele/IPersistanceManager.cs @@ -52,6 +52,7 @@ namespace Model //actions utilitaire bool TestConnexion(); + IList GetDataFromOFX(string path); } } diff --git a/Sources/Modele/Manager.cs b/Sources/Modele/Manager.cs index 7b7ef81..1f374f4 100644 --- a/Sources/Modele/Manager.cs +++ b/Sources/Modele/Manager.cs @@ -43,7 +43,7 @@ namespace Model } } private Banque selectedBanque; - public List BanquesDisponibleInApp + public IList BanquesDisponibleInApp { get => banquesDisponibleInApp; set @@ -55,7 +55,7 @@ namespace Model } } } - private List banquesDisponibleInApp; + private IList banquesDisponibleInApp; public Manager(IPersistanceManager persistance) { @@ -70,14 +70,15 @@ namespace Model return hash.IsEqualHash(mdpBdd, mdpSent); } - - public void deconnexion() { User = null; } - + public void LoadBanques() + { + BanquesDisponibleInApp = Pers.RecupererBanquesDisponible(); + } } }