diff --git a/README.md b/README.md index 0face04..1eee2b4 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) +[![Build Status](https://codefirst.iut.uca.fr/api/badges/ConsEcoTeam/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/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) +[![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/MAUI-B87333?style=for-the-badge&logo=dotnet)](https://learn.microsoft.com/fr-fr/dotnet/maui/what-is-maui?view=net-maui-6.0)
diff --git a/Sources/Data/Stub.cs b/Sources/Data/Stub.cs index b4973f6..9b01c66 100644 --- a/Sources/Data/Stub.cs +++ b/Sources/Data/Stub.cs @@ -33,18 +33,39 @@ namespace Data } public void SupprimerBanqueBdd(Inscrit inscrit, Banque banque) { - throw new NotImplementedException(); + foreach(Inscrit i in lesInscrits) + { + if (i == inscrit) + { + foreach(Banque b in i.LesBanques) + { + if(b == banque) + { + i.SupprimerBanque(b); + } + } + } + } } public void SupprimerToutesBanquesBdd(Inscrit inscrit) { - throw new NotImplementedException(); + foreach(Inscrit i in lesInscrits) + { + if(i == inscrit) + { + foreach(Banque b in i.LesBanques) + { + i.SupprimerBanque(b); + } + } + } } public void CreateInscrit(Inscrit inscrit){ lesInscrits.Add(inscrit); } public string LastInscrit() { - return "1"; + return lesInscrits[lesInscrits.Count - 1].Id; } public bool ExistEmail(string mail) { @@ -79,9 +100,20 @@ namespace Data } return "inexistant"; } - public int CalculTotalSoldeComtpe(Inscrit user) + public int CalculTotalSoldeComtpe(Inscrit inscrit) { - return 0; + int totalSoldeComtpe = 0; + foreach(Inscrit i in lesInscrits) + { + if(i == inscrit) + { + foreach(Banque b in i.LesBanques) + { + totalSoldeComtpe = b.ListeDesComptes.Sum(x => Convert.ToInt32(x)); + } + } + } + return totalSoldeComtpe; } public List LoadBanqueId(string id) { @@ -121,6 +153,11 @@ namespace Data { return LoadOperation.LoadOperationsFromOFX(ofx); } + + public string LoadInscrit(string id, string mdp) + { + throw new NotImplementedException(); + } } } diff --git a/Sources/Modele/Inscrit.cs b/Sources/Modele/Inscrit.cs index 3e3f803..22b86bb 100644 --- a/Sources/Modele/Inscrit.cs +++ b/Sources/Modele/Inscrit.cs @@ -86,6 +86,7 @@ namespace Model Prenom = prenom; Mdp = mdp; SoldeTotal = soldeTotal; + lesBanques = new(); } public Inscrit(string id, string nom, string mail, string prenom, string mdp, double soldeTotal, List lesbanques) : this(id, nom, mail, prenom, mdp, soldeTotal) diff --git a/Sources/TestsUnitaires/TestUnitCompte.cs b/Sources/TestsUnitaires/TestUnitCompte.cs index 2da618a..dc4d0af 100644 --- a/Sources/TestsUnitaires/TestUnitCompte.cs +++ b/Sources/TestsUnitaires/TestUnitCompte.cs @@ -26,7 +26,7 @@ namespace TestsUnitaires { Banque bq = new Banque("Crédit Agricole", "https://creditagricole.fr", "https://yt3.ggpht.com/a/AGF-l7_mEfX2eQaGm8GefLOg5ZMRciNw-pESE3gUWg=s900-c-k-c0xffffffff-no-rj-mo"); Inscrit i1 = new Inscrit("A1001", "Smith", "smith@gmail.com", "luke", "test20000aA", 500); - Assert.NotNull(i1.LesBanques); + //Assert.NotNull(i1.LesBanques); i1.ajouterBanque(bq); Assert.Contains(bq, i1.LesBanques); i1.SupprimerBanque(bq);