Compare commits

...

62 Commits

Author SHA1 Message Date
Hug0lvt 957038ad5b Correction Fusion
continuous-integration/drone/push Build is passing Details
2 years ago
Hug0lvt 65caf7d7b2 Fusion de Connexion dans Npgsql
continuous-integration/drone/push Build is failing Details
2 years ago
Hug0lvt 7d7439a9f7 MaJ Classe de Perssistance
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas EVARD 717a5d5eea réparation de la branche connexion
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 0fc5970b9f Ajout fonction de suppression de toutes les banques dans la base de données
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas EVARD 474726bbd4 Modification encapsulation
continuous-integration/drone/push Build is failing Details
2 years ago
Lucas EVARD 1c4ec437f5 Modification connexion
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas EVARD 75b6c7a2fd Connexion par ID et MDP fonctionnelle
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas EVARD 98c88e43bf modification loadInsrit
continuous-integration/drone/push Build is passing Details
2 years ago
Hugo LIVET 8ed4a57ef1 Ajout de Sonnar
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 0ba69853f2 Merge branch 'Link_to_npgsql' of https://codefirst.iut.uca.fr/git/hugo.livet/ConsEco into Link_to_npgsql
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 97e017f340 creation de loadComptebdd (implémentation de la méthode dans le manager a faire)
2 years ago
Nicolas MAYE a025c16af4 indexation
2 years ago
Nicolas MAYE 4548789618 modification
2 years ago
Lucas EVARD 9c2913d709 nouvelle branche connexion
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 6e35e92208 correction sur les identifiaqnts de connexions
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 5206b6cc73 Patch bug message erreur de connection à la base de données
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 3aa542361a modification mineur sur supprimerInscrit
2 years ago
Vincent ASTOLFI 3f73450693 résoliution bug manager
continuous-integration/drone/push Build is passing Details
2 years ago
Vincent ASTOLFI 5b1a4d0e9a correction bug bdd
continuous-integration/drone/push Build is passing Details
2 years ago
Vincent ASTOLFI d0c1493116 correction fusion
2 years ago
Hugo LIVET d79ac4cf32 Ajout de Sonnar
continuous-integration/drone/push Build is passing Details
2 years ago
Vincent ASTOLFI e692cbf73e correction de bug lors de la supression de banque
2 years ago
Vincent ASTOLFI 7b4735c6a4 finission de la supression de la banque en BDD
2 years ago
Nicolas MAYE 4759d16bd8 la méthode supprimerInscritBdd faite mais en attente des méthodes de suppression banque, compte, echéancier et planification
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 1c39f4b402 modification de la surchage du constructeur inscrit
continuous-integration/drone/push Build is passing Details
2 years ago
Vincent ASTOLFI f34ab4444f ajout supression des banques
2 years ago
Hug0lvt c8291716ac Patch bug du premier élément de la base manquant
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 4076bac802 ajout d'une exception persolinq
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 5b996f98f0 gestion de l'exception
2 years ago
Hugo LIVET 23d6d50084 Fusion
continuous-integration/drone/push Build is passing Details
2 years ago
Hugo LIVET 37f6961afe Détection de bug
2 years ago
Nicolas MAYE 756bf52499 modifcation suppression inscrit bdd
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 58e1f540a3 ajout fonction de suppression d'identifiant dans la bdd (en attente de modification des tables)
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 47e8c4dcf9 Mise en place de la persistance + modification du manager + liaison de la badd pgsql avec l'application
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE c48b6e2438 creation de connexion pour azure ... En attente
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 57ddecbe9e modification du stub
2 years ago
Nicolas MAYE 0b46964ad1 modification du test supprimer banque
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 4e23dd4184 Merge branch 'Code' of https://codefirst.iut.uca.fr/git/hugo.livet/ConsEco into Code
2 years ago
Nicolas MAYE 16c8f803ab Test de la fonction supprimer banque
2 years ago
Raphael LACOTE 5da1701e34 Rectification test précédent
continuous-integration/drone/push Build is passing Details
2 years ago
Raphael LACOTE eb39ce7ef4 Ajout de Test unitaires pour compte
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE adca1c7b24 Merge branch 'Code' of https://codefirst.iut.uca.fr/git/hugo.livet/ConsEco into Code
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 0676558625 modif inscrit et manager
2 years ago
Lucas EVARD f9fbea405d Test unitaire de banque fini
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE e0e52c266c Merge branch 'Code' of https://codefirst.iut.uca.fr/git/hugo.livet/ConsEco into Code
2 years ago
Lucas EVARD 158c6c7def Merge branch 'Code' of https://codefirst.iut.uca.fr/git/hugo.livet/ConsEco into Code
continuous-integration/drone/push Build is failing Details
2 years ago
Lucas EVARD 35a3e81c20 Ajout test unitaire de banque,modification de la classe banque et ajout de méthode dans banque
2 years ago
Nicolas MAYE 22010eaf43 indexation
2 years ago
Nicolas MAYE 679dbcb2b5 modification banque et manager
2 years ago
Nicolas MAYE 8cd04879ff Modification classe Banque et manager
2 years ago
Hugo LIVET 853257491b Ajout de test
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas EVARD dc5993dbb0 Ajout du stub et ajout de constructeur dans banque et inscrit
continuous-integration/drone/push Build is passing Details
2 years ago
Vincent ASTOLFI 4361847010 correction des erreurs
continuous-integration/drone/push Build is passing Details
2 years ago
Nicolas MAYE 6b540e7731 modification mineur (incrémentation)
continuous-integration/drone/push Build is failing Details
2 years ago
Hugo LIVET f27994b865 Merge branch 'Code' of https://codefirst.iut.uca.fr/git/hugo.livet/ConsEco into Code
continuous-integration/drone/push Build is failing Details
2 years ago
Hugo LIVET cb76b61f26 Ajout de la classe Compte sans les méthodes car pas la classe Opération, Echancier et Plannification
2 years ago
Raphael LACOTE 5a052eaeb6 Ajout de devises et inscrit
continuous-integration/drone/push Build is failing Details
2 years ago
Nicolas MAYE 8aef4dfebf modification classe Banque
continuous-integration/drone/push Build is failing Details
2 years ago
Nicolas MAYE 078a38a384 classe Banque créer
continuous-integration/drone/push Build is failing Details
2 years ago
Nicolas MAYE 5582da857b Modification Manager
continuous-integration/drone/push Build is failing Details
2 years ago
Nicolas MAYE 7ae0af702a classe Manager crée + diagramme de classe ajusté
2 years ago

@ -21,3 +21,23 @@ steps:
- dotnet restore CI_CONSECO.sln - dotnet restore CI_CONSECO.sln
- dotnet test CI_CONSECO.sln --no-restore - dotnet test CI_CONSECO.sln --no-restore
depends_on: [build] depends_on: [build]
- name: code-analysis
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
commands:
- cd Code/
- dotnet restore CI_CONSECO.sln
- dotnet sonarscanner begin /k:ConsEco /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="Tests/**" /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
- dotnet build CI_CONSECO.sln -c Release --no-restore
- dotnet test CI_CONSECO.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
- reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
- dotnet publish CI_CONSECO.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release
- dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
secrets: [ SECRET_SONAR_LOGIN ]
settings:
# accessible en ligne de commande par ${PLUGIN_SONAR_HOST}
sonar_host: https://codefirst.iut.uca.fr/sonar/
# accessible en ligne de commande par ${PLUGIN_SONAR_TOKEN}
sonar_token:
from_secret: SECRET_SONAR_LOGIN
depends_on: [tests]

@ -5,11 +5,16 @@ VisualStudioVersion = 17.2.32616.157
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IHM", "IHM\IHM.csproj", "{355FC972-9C0D-4CBD-8003-EFBDACA7CFFF}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IHM", "IHM\IHM.csproj", "{355FC972-9C0D-4CBD-8003-EFBDACA7CFFF}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model", "Model\Model.csproj", "{ACFA83F8-98C8-43AE-9328-B3F751098FFA}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model", "Model\Model.csproj", "{ACFA83F8-98C8-43AE-9328-B3F751098FFA}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestFonctionnel", "TestFonctionnel\TestFonctionnel.csproj", "{7AC4F84F-1124-4EC1-BF38-17F3F4FBEB3E}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFonctionnel", "TestFonctionnel\TestFonctionnel.csproj", "{7AC4F84F-1124-4EC1-BF38-17F3F4FBEB3E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestsUnitaires", "TestsUnitaires\TestsUnitaires.csproj", "{B1AE713C-B5DE-4E81-A33F-818AAD0548A7}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestsUnitaires", "TestsUnitaires\TestsUnitaires.csproj", "{B1AE713C-B5DE-4E81-A33F-818AAD0548A7}"
ProjectSection(ProjectDependencies) = postProject
{ACFA83F8-98C8-43AE-9328-B3F751098FFA} = {ACFA83F8-98C8-43AE-9328-B3F751098FFA}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinqToPgSQL", "LinqToPgSQL\LinqToPgSQL.csproj", "{4A9DB718-B874-4565-87B0-57C73B9BE240}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -33,6 +38,10 @@ Global
{B1AE713C-B5DE-4E81-A33F-818AAD0548A7}.Debug|Any CPU.Build.0 = Debug|Any CPU {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.ActiveCfg = Release|Any CPU
{B1AE713C-B5DE-4E81-A33F-818AAD0548A7}.Release|Any CPU.Build.0 = Release|Any CPU {B1AE713C-B5DE-4E81-A33F-818AAD0548A7}.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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

@ -5,6 +5,8 @@ using System.Data;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using Model;
using LinqToPgSQL;
namespace IHM namespace IHM
{ {
@ -13,5 +15,8 @@ namespace IHM
/// </summary> /// </summary>
public partial class App : Application public partial class App : Application
{ {
public Manager Manager { get; private set; } = new Manager(new LinqToPgSQL.PersLinqToPgSQL());
//public Manager AllInscrits { get; private set; } = new Manager(new Stub());
} }
} }

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;
namespace IHM.Converters
{
public class Func2WindowPartConverter : IValueConverter
{
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Func<UserControl>? windowPartCreator = value as Func<UserControl>;
if (windowPartCreator == null)
{
return null;
}
return windowPartCreator();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

@ -7,4 +7,9 @@
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\LinqToPgSQL\LinqToPgSQL.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project> </Project>

@ -7,6 +7,13 @@
mc:Ignorable="d" mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"> Title="MainWindow" Height="450" Width="800">
<Grid> <Grid>
<TextBlock Name="idpers" Text="null"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBox Name="id" Height="100" Width="200" Text="OUIOUIOUI"/>
<TextBox Name="mdp" Height="100" Width="200" Text="OUIOUIOUI"/>
</StackPanel>
<Button x:Name="test2" Content="Button" HorizontalAlignment="Center" Margin="0,320,0,0" VerticalAlignment="Top" Click="test_Click"/>
</Grid> </Grid>
</Window> </Window>

@ -12,6 +12,8 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using LinqToPgSQL;
using Model;
namespace IHM namespace IHM
{ {
@ -20,9 +22,34 @@ namespace IHM
/// </summary> /// </summary>
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
public Manager Manager => ((App)Application.Current).Manager;
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
DataContext = Manager.SelectedInscrits;
}
public void testSelect()
{
MessageBox.Show($"{Manager.SelectedInscrits}");
}
public void testSuppression()
{
MessageBox.Show("Suppression ok");
} }
private void test_Click(object sender, RoutedEventArgs e)
{
Manager.LoadInscrit(id.Text,mdp.Text);
if (Manager.SelectedInscrits != null)
{
idpers.Text = Manager.SelectedInscrits;
testSelect();
}
else idpers.Text = "";
}
} }
} }

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Npgsql" Version="6.0.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,207 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Configuration;
using Npgsql;
using Model;
using System.IO;
using System.Diagnostics;
using System.Windows;
using System.Threading;
namespace LinqToPgSQL
{
public class PersLinqToPgSQL : IPersistanceManager
{
string connexionBDD = String.Format("Server=90.114.135.116; Username=postgres; Database=conseco; Port=5432; Password=lulu; SSLMode=Prefer");
public string LoadInscrit(string id, string mdp)
{
string resultat="";
var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection");
conn.Open();
NpgsqlParameter p1 = new NpgsqlParameter { ParameterName = "p", Value = id };
NpgsqlParameter p2 = new NpgsqlParameter { ParameterName = "p2", Value = mdp };
NpgsqlCommand cmd = new NpgsqlCommand($"SELECT id FROM INSCRIT WHERE (nom=(@p) OR mail=(@p)) AND mdp=@p2", conn);
cmd.Parameters.Add(p1);
cmd.Parameters.Add(p2);
NpgsqlDataReader dr = cmd.ExecuteReader();
try
{
dr.Read();
resultat = dr.GetString(0);
dr.Close();
return resultat;
}
catch (Exception ex)
{
MessageBox.Show(ex+"Utilisateur inconnu");
dr.Close();
return "null";//a changer doit retester
}
}
public IEnumerable<Banque> LoadBanque()
{
List<Banque> ListeBanques = new List<Banque>();
var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection");
try
{
conn.Open();
}
catch
{
conn.Close();
MessageBox.Show("Problème de connection à la base de donnée. Aprés fermeture, l'application se fermera automatiquement");
Environment.Exit(-1);
}
NpgsqlDataReader dbReader = new NpgsqlCommand("SELECT * FROM Banque", conn).ExecuteReader();
while (dbReader.Read())
{
ListeBanques.Add(new Banque(dbReader.GetString(0), dbReader.GetString(1), dbReader.GetString(2)));
}
dbReader.Close();
return ListeBanques;
}
/*Charge le compte d'un inscrit*/
public IEnumerable<Compte> LoadCompte(Inscrit i)
{
List<Compte> ListeCompte = new List<Compte>();
var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection");
try
{
conn.Open();
}
catch
{
conn.Close();
MessageBox.Show("Problème de connection à la base de données. Aprés fermeture, l'application se fermera automatiquement.");
Environment.Exit(-1);
}
string requete = "Select * FROM Compte c, InscrBanque ib, Inscrit i WHERE c.idInscrit = ib.idInscrit AND c.idInscritBanque = ib.id AND i.id = (@p1)";
NpgsqlDataReader dbReader = new NpgsqlCommand("Select * FROM Compte c, InscrBanque ib, Inscrit i WHERE c.idInscrit = ib.idInscrit AND c.idInscritBanque = ib.id AND i.id = (@p1) ", conn).ExecuteReader();
using (var command1 = new NpgsqlCommand(requete, conn))
{
command1.Parameters.AddWithValue("p", i.Id);
/*await command1.ExecuteNonQueryAsync();*/
}
while (dbReader.Read())
{
ListeCompte.Add(new Compte(dbReader.GetString(0), dbReader.GetInt64(1)));
}
dbReader.Close();
return ListeCompte;
}
/*Suppression d'un inscrit dans la base de données*/
public async void SupprimerInscritBdd(Inscrit i)
{
/*List<Inscrit> ListeInscrits = new List<Inscrit>(LoadInscrit());*/
var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection");
try
{
conn.Open();
}
catch
{
conn.Close();
MessageBox.Show("Problème de connection à la base de données. Aprés fermeture, l'application se fermera automatiquement.");
Environment.Exit(-1);
}
string requete = $"DELETE FROM INSCRIT WHERE id=(@p)";
string requeteFKey = $"DELETE FROM DEVISEINSCRIT WHERE idInscrit=(@p2)";
using (var command1 = new NpgsqlCommand(requeteFKey, conn))
{
command1.Parameters.AddWithValue("p", i.Id);
await command1.ExecuteNonQueryAsync();
}
SupprimerToutesBanquesBdd(i);
/* SupprimerCompteBdd(i);
SupprimerEcheancierBdd(i);
SupprimerPlanificationBdd(i);
*/
}
/* Suppression de toutes les banques d'un inscrit*/
public async void SupprimerToutesBanquesBdd(Inscrit i)
{
var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection");
try
{
conn.Open();
}
catch
{
conn.Close();
MessageBox.Show("Problème de connection ave la base de données. Aprés fermeture de la fenêtre, l'application se fermera automatiquement");
Environment.Exit(-1);
}
string requete = $"DELETE * FROM BANQUE b, INSCRBANQUE ib WHERE b.nom=ib.nomBanque AND ib.idInscrit=(@id)";
using (var command1 = new NpgsqlCommand(requete, conn))
{
command1.Parameters.AddWithValue("p", i.Id);
await command1.ExecuteNonQueryAsync();
}
}
/*Suppression d'une banque d'un inscrit*/
public async void SupprimerBanqueBdd(Inscrit i, Banque b)
{
var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection");
try
{
conn.Open();
}
catch
{
conn.Close();
MessageBox.Show("Problème de connection avec la base de données. Aprés fermeture de la fenêtre, l'application se fermera automatiquement");
Environment.Exit(-1);
}
await using var cmd = new NpgsqlCommand("DELETE FROM InscrBanque WHERE nombanque=(@b) AND idinscrit=(@i)", conn)
{
Parameters =
{
new("b", b.Nom),
new("i", i.Id)
}
};
await cmd.ExecuteNonQueryAsync();
// attente des autres supression
}
}
}

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class Banque
{
public string Nom { get; private set; }
public string UrlSite { get; private set; }
public string UrlLogo { get; private set; }
public List<Compte> ListeDesComptes { get; private set; } = new List<Compte>();
public Banque(string nom, string urlSite, string urlLogo)
{
Nom = nom;
UrlSite = urlSite;
UrlLogo = urlLogo;
}
public Banque(string nom, string urlSite, string urlLogo, List<Compte>lescomptes)
{
Nom = nom;
UrlSite = urlSite;
UrlLogo = urlLogo;
ListeDesComptes = lescomptes;
}
public void AjouterCompte(Compte compte)
{
ListeDesComptes.Add(compte);
}
public void SupprimerCompte(Compte compte)
{
ListeDesComptes.Remove(compte);
}
public bool ExisteCompte(string s)
{
foreach (Compte compte in ListeDesComptes)
{
if (compte.Nom.Equals(s))
return true;
}
return false;
}
public Compte ReturnCompte(string s)
{
foreach (Compte compte in ListeDesComptes)
{
if (compte.Nom.Equals(s))
return compte;
}
throw new KeyNotFoundException();
}
}
}

@ -1,7 +0,0 @@
namespace Model
{
public class Class1
{
}
}

@ -0,0 +1,14 @@
namespace Model
{
public class Compte
{
public string Nom { get; private set; }
public double Solde { get; private set; }
public Compte(string nom, double solde)
{
Nom = nom;
Solde = solde;
}
}
}

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public enum Devises
{
Livre_sterling,
Rouble,
Euro,
Yen,
Dollars
}
}

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public interface IPersistanceManager
{
string LoadInscrit(string id,string mdp);
void SupprimerInscritBdd(Inscrit inscrit);
void SupprimerBanqueBdd(Inscrit inscrit, Banque banque);
void SupprimerToutesBanquesBdd(Inscrit inscrit);
}
}

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using Banque;
namespace Model
{
public class Inscrit
{
public Inscrit(string id, string nom, string prenom, string mail, string mdp)
{
Id = id;
Nom = nom;
Mail = mail;
Prenom = prenom;
Mdp = mdp;
}
public Inscrit(string id, string nom, string mail, string prenom, string mdp, double soldeTotal)
{
Id = id;
Nom = nom;
Mail = mail;
Prenom = prenom;
Mdp = mdp;
SoldeTotal = soldeTotal;
}
public Inscrit(string id, string nom, string mail, string prenom, string mdp, double soldeTotal,List<Banque>lesbanques)
{
Id = id;
Nom = nom;
Mail = mail;
Prenom = prenom;
Mdp = mdp;
SoldeTotal = soldeTotal;
LesBanques = lesbanques;
}
public string Id { get; private set; }
public string Nom { get; private set; }
public string Mail { get; private set; }
public string Prenom { get; private set; }
public string Mdp { get; private set; }
public double SoldeTotal { get; private set; }
public Devises Dev { get; private set; }
public List<Banque> LesBanques { get; private set; } = new List<Banque>();
public void ajouterBanque(Banque banque)
{
LesBanques.Add(banque);
}
public void SupprimerBanque(Banque banque)
{
LesBanques.Remove(banque);
}
public void ChoisirDevise(Devises devise)
{
Dev = devise;
}
}
}

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using Npgsql;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class Manager : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
public IPersistanceManager Pers { get; private set; }
public string SelectedInscrits;
public Banque SelectedBanque
{
get => selectedBanque;
set
{
if(selectedBanque != value)
{
selectedBanque = value;
OnPropertyChanged(nameof(selectedBanque));
}
}
}
private Banque selectedBanque;
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public Manager(IPersistanceManager persistance)
{
Pers = persistance;
}
public void SupprimerInscritBdd(Inscrit i)
{
Pers.SupprimerInscritBdd(i);
}
public void LoadInscrit(string id, string mdp)
{
SelectedInscrits = Pers.LoadInscrit(id, mdp);
}
public void supprimerToutesBanquesBdd(Inscrit inscrit)
{
Pers.SupprimerToutesBanquesBdd(inscrit);
}
}
}

@ -6,4 +6,8 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Npgsql" Version="6.0.7" />
</ItemGroup>
</Project> </Project>

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class Stub
{
public List<Banque> Banques = new();
public List<Inscrit> Inscrits = new();
public List<Compte> Comptes = new();
// ajouter load all pour tout les inscrits
public List<Inscrit> 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()));
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<Banque> 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<Compte> LoadCompte()
{
Comptes.Add(new("Livret A", 1500));
Comptes.Add(new("Compte Courant", 2000));
Comptes.Add(new("PEL", 22000));
return Comptes;
}
}
}

@ -0,0 +1,18 @@
using Model;
namespace TestsUnitaires
{
public class TU_Compte
{
[Fact]
public void Ctor_Compte()
{
Compte c = new Compte("Crédit Agricole", 20000);
Assert.NotNull(c);
Assert.Equal("Crédit Agricole", c.Nom);
Assert.Equal(20000, c.Solde);
}
}
}

@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
namespace TestsUnitaires
{
public class TestUnitBanque
{
Compte tc = new("Livret A", 16956);
Banque test = new("BNP Paribas", "https://mabanque.bnpparibas/", "https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png");
[Fact]
public void testConstructeur1()
{
Assert.NotNull(test);
Assert.Equal("BNP Paribas", test.Nom);
Assert.NotEqual("https://mabanque.bnpparibas/", test.Nom);
Assert.Equal("https://mabanque.bnpparibas/", test.UrlSite);
Assert.Equal("https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png", test.UrlLogo);
}
[Fact]
public void testConstructeur2()
{
List<Compte> listeCompte = new();
listeCompte.Add(tc);
Banque test2 = new("BNP Paribas", "https://mabanque.bnpparibas/", "https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png", listeCompte);
Assert.NotNull(test);
Assert.NotNull(test.ListeDesComptes);
Assert.Equal("BNP Paribas", test.Nom);
Assert.NotEqual("https://mabanque.bnpparibas/", test.Nom);
Assert.Equal("https://mabanque.bnpparibas/", test.UrlSite);
Assert.Equal("https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png", test.UrlLogo);
Assert.Contains(tc,test2.ListeDesComptes);
}
[Fact]
public void testAjouterCompte()
{
Assert.NotNull(test.ListeDesComptes);
test.AjouterCompte(tc);
Assert.Contains(tc, test.ListeDesComptes);
}
[Fact]
public void testSupprimerCompte()
{
Assert.NotNull(test.ListeDesComptes);
test.AjouterCompte(tc);
Assert.Contains(tc, test.ListeDesComptes);
test.SupprimerCompte(tc);
Assert.DoesNotContain(tc, test.ListeDesComptes);
}
[Fact]
public void testExisteCompte()
{
List<Compte> listeCompte = new();
listeCompte.Add(tc);
Banque test2 = new("BNP Paribas", "https://mabanque.bnpparibas/", "https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png", listeCompte);
Assert.True(test2.ExisteCompte("Livret A"));
}
[Fact]
public void testReturnCompte()
{
List<Compte> listeCompte = new();
listeCompte.Add(tc);
Banque test2 = new("BNP Paribas", "https://mabanque.bnpparibas/", "https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png", listeCompte);
Assert.True(test2.ExisteCompte("Livret A"));
Assert.Equal(tc, test2.ReturnCompte("Livret A"));
}
}
}

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
namespace TestsUnitaires
{
public class TestUnitCompte
{
[Fact]
public void TestConstructeurCompte()
{
Compte c1 = new("Livret A", 234);
Compte c2 = new("&e23R_te7", 1245.34);
Assert.Equal("Livret A", c1.Nom);
Assert.Equal("&e23R_te7", c2.Nom);
Assert.Equal(234, c1.Solde);
Assert.Equal(1245.34, c2.Solde);
}
[Fact]
public void testSupprimerBanque()
{
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", "test", 500);
Assert.NotNull(i1.LesBanques);
i1.ajouterBanque(bq);
Assert.Contains(bq, i1.LesBanques);
i1.SupprimerBanque(bq);
Assert.DoesNotContain(bq, i1.LesBanques);
}
}
}

@ -21,4 +21,8 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project> </Project>

@ -1,11 +0,0 @@
namespace TestsUnitaires
{
public class UnitTest1
{
[Fact]
public void Test1()
{
}
}
}

@ -764,16 +764,16 @@
"$ref": "AAAAAAGDnLICnAi+zCE=" "$ref": "AAAAAAGDnLICnAi+zCE="
}, },
"font": "Arial;13;0", "font": "Arial;13;0",
"left": 1046, "left": 1044,
"top": 403, "top": 403,
"width": 88.50537109375, "width": 93.919921875,
"height": 13, "height": 13,
"alpha": -0.28083777583322966, "alpha": -0.28083777583322966,
"distance": 54.120236510939236, "distance": 54.120236510939236,
"hostEdge": { "hostEdge": {
"$ref": "AAAAAAGDnLICnQjA19I=" "$ref": "AAAAAAGDnLICnQjA19I="
}, },
"text": "-lesUtilisateurs" "text": "-TousLesInscrits"
}, },
{ {
"_type": "EdgeLabelView", "_type": "EdgeLabelView",
@ -8245,7 +8245,6 @@
"propertyLabel": { "propertyLabel": {
"$ref": "AAAAAAGDrfOMKWsqZ4o=" "$ref": "AAAAAAGDrfOMKWsqZ4o="
}, },
"showEndOrder": "hide",
"tailRoleNameLabel": { "tailRoleNameLabel": {
"$ref": "AAAAAAGDrfOMKWsr5PY=" "$ref": "AAAAAAGDrfOMKWsr5PY="
}, },
@ -8515,7 +8514,6 @@
"propertyLabel": { "propertyLabel": {
"$ref": "AAAAAAGDrfQ+sW/wAWw=" "$ref": "AAAAAAGDrfQ+sW/wAWw="
}, },
"showEndOrder": "hide",
"tailRoleNameLabel": { "tailRoleNameLabel": {
"$ref": "AAAAAAGDrfQ+sW/x4Vo=" "$ref": "AAAAAAGDrfQ+sW/x4Vo="
}, },
@ -8573,7 +8571,7 @@
"_parent": { "_parent": {
"$ref": "AAAAAAGDnLICnAi8gKM=" "$ref": "AAAAAAGDnLICnAi8gKM="
}, },
"name": "lesUtilisateurs", "name": "TousLesInscrits",
"reference": { "reference": {
"$ref": "AAAAAAGDnLHWEwiR3RE=" "$ref": "AAAAAAGDnLHWEwiR3RE="
}, },

@ -0,0 +1,6 @@
[.ShellClassInfo]
IconResource=C:\WINDOWS\System32\SHELL32.dll,294
[ViewState]
Mode=
Vid=
FolderType=Generic
Loading…
Cancel
Save