modifStub
Hugo LIVET 2 years ago
commit 0d24d0b43a

File diff suppressed because it is too large Load Diff

@ -1,7 +1,7 @@
# Cons'Eco # 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/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)
<br /> <br />
<div align="center"> <div align="center">

@ -14,10 +14,11 @@ namespace Data
{ {
public class LoadOperation public class LoadOperation
{ {
public static IList<Operation> LoadOperationsFromOFX(string csv) public static IList<Compte> LoadOperationsFromOFX(string ofx)
{ {
//liste des opérations d'un compte IList<Compte> lesComptes = new List<Compte>();
IList<Operation> lesOpe = new List<Operation>();
Compte compteEnCoursDeSaisie = null;
//détail d'une Operation //détail d'une Operation
string intituleOperation; string intituleOperation;
@ -28,26 +29,31 @@ namespace Data
//info compte //info compte
string identifiantCompte=""; string identifiantCompte="";
double solde=0;
using (StreamReader reader = new StreamReader(csv)) using (StreamReader reader = new StreamReader(ofx))
{ {
if (reader != null) if (reader != null)
{ {
string row; string row;
while ((row = reader.ReadLine()) != null) while ((row = reader.ReadLine()) != null)
{ {
if (row.Contains("<CURDEF>")) if (row.Contains("<STMTTRNRS>"))
{ {
row = ""; compteEnCoursDeSaisie = new Compte(identifiantCompte, identifiantCompte, 0);
} }
else if (row.Contains("<ACCTID>")) else if (row.Contains("</STMTTRNRS>")){
lesComptes.Add(compteEnCoursDeSaisie);
}
else if (row.Contains("<ACCTID>") || row.Contains("<CURDEF>"))
{ {
identifiantCompte = CutRow(row).Last(); compteEnCoursDeSaisie.Identifiant = CutRow(row).Last();
compteEnCoursDeSaisie.Nom = CutRow(row).Last();
} }
else if (row.Contains("<BALAMT>")) else if (row.Contains("<BALAMT>"))
{ {
solde = Convert.ToDouble(GetValueInRow(row, 4)); compteEnCoursDeSaisie.Solde = double.Parse(CutRow(row).Last(), CultureInfo.InvariantCulture);
} }
else if (row.Contains("<STMTTRN>")) else if (row.Contains("<STMTTRN>"))
{ {
@ -93,7 +99,7 @@ namespace Data
row = ""; row = "";
} }
} }
lesOpe.Add(new Operation(intituleOperation, identifiantCompte, montant, dateOperation, modePayement, isDebit)); compteEnCoursDeSaisie.ajouterOperation(new Operation(intituleOperation, montant, dateOperation, modePayement, isDebit));
} }
else else
{ {
@ -102,7 +108,7 @@ namespace Data
} }
} }
} }
return lesOpe; return lesComptes;
} }
@ -114,19 +120,5 @@ namespace Data
return cutRow; return cutRow;
} }
public static string GetValueInRow(string row, int position)
{
string value;
string[] cutedRow = CutRow(row);
if (cutedRow != null)
{
if(cutedRow.Count() > position || position < 0) throw new IndexOutOfRangeException();
value = cutedRow[position];
return value;
}
throw new ArgumentNullException();
}
} }
} }

@ -13,57 +13,75 @@ using System.Threading;
using Model; using Model;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Data.Common; using System.Data.Common;
using System.Reflection.PortableExecutable;
namespace LinqToPgSQL namespace LinqToPgSQL
{ {
public class PersLinqToPgSQL : IPersistanceManager public class PersLinqToPgSQL : IPersistanceManager
{ {
private Hash hash = new Hash(); private Hash hash = new Hash();
string connexionBDD = String.Format("Server=2.3.8.130; 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");
public string LoadInscrit(string id, string mdp) private static NpgsqlConnection dbAccess = new NpgsqlConnection(connexionBDD);
public bool TestConnexionAsDatabase()
{
bool isOk = true;
try
{ {
int resultat=0; 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 GetId(string mail)
{
int resultat;
var conn = new NpgsqlConnection(connexionBDD); var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection");
conn.Open(); conn.Open();
NpgsqlParameter p1 = new NpgsqlParameter { ParameterName = "p", Value = id }; NpgsqlParameter p1 = new NpgsqlParameter { ParameterName = "p", Value = mail };
NpgsqlParameter p2 = new NpgsqlParameter { ParameterName = "p2", Value = mdp }; NpgsqlCommand cmd = new NpgsqlCommand($"SELECT id FROM INSCRIT WHERE mail=(@p)", conn);
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(p1);
cmd.Parameters.Add(p2);
NpgsqlDataReader dr = cmd.ExecuteReader(); NpgsqlDataReader dr = cmd.ExecuteReader();
try
{
dr.Read(); dr.Read();
resultat = dr.GetInt32(0); resultat = dr.GetInt32(0);
dr.Close(); dr.Close();
conn.Close();
return resultat.ToString(); return resultat.ToString();
} }
catch (Exception ex)
public string LoadInscrit(string id, string mdp)
{ {
Debug.WriteLine(ex+"Utilisateur inconnu"); int resultat;
var conn = new NpgsqlConnection(connexionBDD);
conn.Open();
NpgsqlParameter p1 = new NpgsqlParameter { ParameterName = "p", Value = id };
NpgsqlCommand cmd = new NpgsqlCommand($"SELECT id FROM INSCRIT WHERE mail=(@p)", conn);
cmd.Parameters.Add(p1);
NpgsqlDataReader dr = cmd.ExecuteReader();
dr.Read();
resultat = dr.GetInt32(0);
dr.Close(); dr.Close();
return "null";//a changer doit retester conn.Close();
} return resultat.ToString();
} }
public bool ExistEmail(string mail) public bool ExistEmail(string mail)
{ {
var conn = new NpgsqlConnection(connexionBDD); var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection");
try
{
conn.Open(); conn.Open();
}
catch
{
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(); NpgsqlDataReader dbReader = new NpgsqlCommand("SELECT mail FROM Inscrit", conn).ExecuteReader();
while (dbReader.Read()) while (dbReader.Read())
@ -76,6 +94,7 @@ namespace LinqToPgSQL
} }
dbReader.Close(); dbReader.Close();
conn.Close();
return false; return false;
} }
@ -149,6 +168,35 @@ namespace LinqToPgSQL
await cmd.ExecuteNonQueryAsync(); await cmd.ExecuteNonQueryAsync();
} }
public int CalculTotalSoldeComtpe(Inscrit user)
{
var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection");
try
{
conn.Open();
}
catch
{
conn.Close();
Debug.WriteLine("Problème de connection à la base de données. Aprés fermeture, l'application se fermera automatiquement.");
Environment.Exit(-1);
}
NpgsqlCommand cmd = new NpgsqlCommand($"SELECT sum(c.solde) FROM Compte c, Inscrit i, InscrBanque ib WHERE i.mail = (@mailUser) AND i.id = ib.idinscrit AND c.idinscritbanque = ib.id", conn)
{
Parameters =
{
new NpgsqlParameter("mailuser", user.Mail),
}
};
NpgsqlDataReader dataReader = cmd.ExecuteReader();
if (dataReader.Read())
{
return dataReader.GetInt32(0);
}
return -1;
}
public string RecupMdpBdd(string mail) public string RecupMdpBdd(string mail)
{ {
var conn = new NpgsqlConnection(connexionBDD); var conn = new NpgsqlConnection(connexionBDD);
@ -237,7 +285,6 @@ namespace LinqToPgSQL
using (var command1 = new NpgsqlCommand(requete, conn)) using (var command1 = new NpgsqlCommand(requete, conn))
{ {
command1.Parameters.AddWithValue("p", i.Id); command1.Parameters.AddWithValue("p", i.Id);
/*await command1.ExecuteNonQueryAsync();*/
} }
@ -249,6 +296,35 @@ namespace LinqToPgSQL
return ListeCompte; return ListeCompte;
} }
public List<Banque> LoadBanqueId(string id)
{
int idnombre = Int16.Parse(id);
List<Banque> ListeBanque = new List<Banque>();
Debug.WriteLine(idnombre);
var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection");
try
{
conn.Open();
}
catch
{
conn.Close();
Debug.WriteLine("Problème de connection à la base de données. Aprés fermeture, l'application se fermera automatiquement.");
Environment.Exit(-1);
}
NpgsqlCommand cmd = new NpgsqlCommand("select b.nom,b.urlsite,b.urllogo from banque b, inscrbanque ib, Inscrit i where ib.idinscrit =(@p) AND ib.nombanque = b.nom AND ib.idinscrit = i.id;", conn);
cmd.Parameters.AddWithValue("p", idnombre);
NpgsqlDataReader dataReader = cmd.ExecuteReader();
while (dataReader.Read())
{
Debug.WriteLine(dataReader.GetString(0), dataReader.GetString(1), dataReader.GetString(2));
ListeBanque.Add(new Banque(dataReader.GetString(0), dataReader.GetString(1), dataReader.GetString(2)));
}
dataReader.Close();
return ListeBanque;
}
/*Suppression d'un inscrit dans la base de données*/ /*Suppression d'un inscrit dans la base de données*/
public async void SupprimerInscritBdd(Inscrit i) public async void SupprimerInscritBdd(Inscrit i)
{ {
@ -335,5 +411,30 @@ namespace LinqToPgSQL
// attente des autres supression // attente des autres supression
} }
public List<Banque> ImportBanques()
{
List<Banque> bquesDispo = new List<Banque>();
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;
}
public Inscrit GetInscrit(string mail)
{
throw new NotImplementedException();
}
public IList<Compte> GetCompteFromOFX(string ofx)
{
throw new NotImplementedException();
}
} }
} }

@ -0,0 +1,128 @@
using Model;
namespace Data
{
public class Stub : IPersistanceManager
{
private List<Inscrit> lesInscrits = new List<Inscrit>();
public Stub()
{
lesInscrits.Add(new Inscrit(
"1",
"LIVET",
"livet.hugo2003@gmail.com",
"Hugo",
"Bonjour63."
));
}
public string GetId(string mail)
{
foreach(Inscrit i in lesInscrits)
{
if(i.Mail == mail)
{
return i.Id;
}
}
return null;
}
public void SupprimerInscritBdd(Inscrit inscrit)
{
throw new NotImplementedException();
}
public void SupprimerBanqueBdd(Inscrit inscrit, Banque banque)
{
throw new NotImplementedException();
}
public void SupprimerToutesBanquesBdd(Inscrit inscrit)
{
throw new NotImplementedException();
}
public void CreateInscrit(Inscrit inscrit){
lesInscrits.Add(inscrit);
}
public string LastInscrit()
{
return "1";
}
public bool ExistEmail(string mail)
{
foreach(Inscrit i in lesInscrits)
{
if(i.Mail == mail)
{
return true;
}
}
return false;
}
public void ChangePasswordBdd(string mail, string newMdp)
{
foreach(Inscrit i in lesInscrits)
{
if(i.Mail == mail)
{
i.Mdp = newMdp;
}
}
}
public string RecupMdpBdd(string mail)
{
Hash hash = new Hash();
foreach(Inscrit i in lesInscrits)
{
if(i.Mail == mail)
{
return hash.CreateHashCode(i.Mdp);
}
}
return "inexistant";
}
public int CalculTotalSoldeComtpe(Inscrit user)
{
return 0;
}
public List<Banque> LoadBanqueId(string id)
{
List<Banque> lesBanques = new List<Banque>();
lesBanques.Add(new Banque("Credit Agricole","azerty.com","aaacom"));
lesBanques.Add(new Banque("Credit Mutuel", "azerty.com", "aaacom"));
return lesBanques;
}
public bool TestConnexionAsDatabase()
{
return true;
}
public List<Banque> ImportBanques()
{
List<Banque> lesBanques = new List<Banque>();
lesBanques.Add(new Banque("Credit Agricole", "azerty.com", "aaacom"));
lesBanques.Add(new Banque("Credit Mutuel", "azerty.com", "aaacom"));
lesBanques.Add(new Banque("CIC", "azerty.com", "aaacom"));
lesBanques.Add(new Banque("BNP", "azerty.com", "aaacom"));
lesBanques.Add(new Banque("OrangeBank", "azerty.com", "aaacom"));
return lesBanques;
}
public Inscrit GetInscrit(string mail)
{
foreach(Inscrit i in lesInscrits)
{
if(i.Mail == mail)
{
return i;
}
}
return null;
}
public IList<Compte> GetCompteFromOFX(string ofx)
{
return LoadOperation.LoadOperationsFromOFX(ofx);
}
}
}

@ -1,11 +1,12 @@
using LinqToPgSQL; using Data;
using LinqToPgSQL;
using Model; using Model;
namespace IHM namespace IHM
{ {
public partial class App : Application public partial class App : Application
{ {
public Manager Manager { get; set; } = new Manager(new PersLinqToPgSQL()); public Manager Manager { get; set; } = new Manager(new Stub());
public App() public App()
{ {
InitializeComponent(); InitializeComponent();

@ -7,11 +7,6 @@
Shell.FlyoutBehavior="Disabled" Shell.FlyoutBehavior="Disabled"
Shell.NavBarIsVisible="False"> Shell.NavBarIsVisible="False">
<!--<ShellContent
ContentTemplate="{DataTemplate local:Dashboard}"
Route="MainPage" />-->
<TabBar> <TabBar>
<ShellContent Title="Tableau de Bord" <ShellContent Title="Tableau de Bord"
Icon="home_black.png" Icon="home_black.png"
@ -41,4 +36,16 @@
ContentTemplate="{DataTemplate local:ChangePassword}" ContentTemplate="{DataTemplate local:ChangePassword}"
Route="ChangePassword"/> Route="ChangePassword"/>
<ShellContent
ContentTemplate="{DataTemplate local:GestionBanques}"
Route="GestionBanques"/>
<ShellContent
ContentTemplate="{DataTemplate local:AjoutBanques}"
Route="AjoutBanques"/>
<ShellContent
ContentTemplate="{DataTemplate local:ErrorPage}"
Route="ErrorPage"/>
</Shell> </Shell>

@ -14,6 +14,10 @@ namespace IHM
Routing.RegisterRoute("Inscription", typeof(Inscription)); Routing.RegisterRoute("Inscription", typeof(Inscription));
Routing.RegisterRoute("ForgetPassword", typeof(ForgetPassword)); Routing.RegisterRoute("ForgetPassword", typeof(ForgetPassword));
Routing.RegisterRoute("ChangePassword", typeof(ChangePassword)); Routing.RegisterRoute("ChangePassword", typeof(ChangePassword));
Routing.RegisterRoute("GestionBanques", typeof(GestionBanques));
Routing.RegisterRoute("AjoutBanques", typeof(AjoutBanques));
Routing.RegisterRoute("ErrorPage", typeof(ErrorPage));
} }

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<ViewCell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Composant.BanqueDispo">
<Border StrokeShape="RoundRectangle 20" BackgroundColor="{StaticResource Tertiary}" Padding="20">
<VerticalStackLayout>
<Image Source="{Binding ImageBanque}"/>
<Button Text="CHOISIR" Clicked="Banque_Clicked"/>
</VerticalStackLayout>
</Border>
</ViewCell>

@ -0,0 +1,23 @@
namespace IHM.Composant;
public partial class BanqueDispo : ViewCell
{
public BanqueDispo()
{
InitializeComponent();
}
public static readonly BindableProperty ImageBanqueProperty =
BindableProperty.Create("ImageBanque", typeof(string), typeof(BanqueDispo), "");
public string ImageBanque
{
get { return (string)GetValue(ImageBanqueProperty); }
set { SetValue(ImageBanqueProperty, value); }
}
private void Banque_Clicked(object sender, EventArgs e)
{
}
}

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<ViewCell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Composant.BanqueVC"
x:Name="root">
<FlexLayout Direction="Row" AlignItems="Center" JustifyContent="SpaceAround">
<Label Text="{Binding NomBanque}" FontAttributes="Bold" FontSize="Body"/>
<Label Text="{Binding DateLastReload}" FontAttributes="Italic" FontSize="Body"/>
<ImageButton Source="reload_banks.png"
Padding="10" Margin="10"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"
Clicked="MaBanque_Clicked"/>
</FlexLayout>
</ViewCell>

@ -0,0 +1,32 @@
namespace IHM.Composant;
public partial class BanqueVC : ViewCell
{
public BanqueVC()
{
InitializeComponent();
}
public static readonly BindableProperty NomBanqueProperty =
BindableProperty.Create("NomBanque", typeof(string), typeof(BanqueVC), "");
public string NomBanque
{
get { return (string)GetValue(NomBanqueProperty); }
set { SetValue(NomBanqueProperty, value); }
}
public static readonly BindableProperty DateLastReloadProperty =
BindableProperty.Create("DateLastReload", typeof(string), typeof(BanqueVC), "");
public string DateLastReload
{
get { return (string)GetValue(DateLastReloadProperty); }
set { SetValue(DateLastReloadProperty, value); }
}
private void MaBanque_Clicked(object sender, EventArgs e)
{
}
}

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8" ?>
<ViewCell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Composant.VC_Operation_Dashboard">
<StackLayout Orientation="Vertical">
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
</StackLayout>
</ViewCell>

@ -0,0 +1,9 @@
namespace IHM.Composant;
public partial class VC_Operation_Dashboard : ViewCell
{
public VC_Operation_Dashboard()
{
InitializeComponent();
}
}

@ -24,7 +24,7 @@ public partial class MainPage : ContentPage
{ {
if (Mgr.isEqualHash(Mgr.recupMdpBdd(EntryMail.Text), EntryPassworld.Text)) if (Mgr.isEqualHash(Mgr.recupMdpBdd(EntryMail.Text), EntryPassworld.Text))
{ {
Mgr.LoadInscrit(EntryMail.Text, EntryPassworld.Text); Mgr.createUser(EntryMail.Text);
ConnexionValide(); ConnexionValide();
} }
else else

@ -32,11 +32,28 @@
<ItemGroup> <ItemGroup>
<!-- App Icon --> <!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\logo.svg" ForegroundFile="Resources\AppIcon\logo.svg" Color="#512BD4" BaseSize="100,100"> <MauiIcon Include="Resources\AppIcon\logo.svg" ForegroundFile="Resources\AppIcon\logo.svg" Color="#512BD4" BaseSize="100,100" />
<MauiImage Include="Resources\Images\AjoutBanques\add_new_banks.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiIcon> </MauiImage>
<MauiImage Include="Resources\Images\NavBar\dollar_black.png" /> <MauiImage Include="Resources\Images\AjoutBanques\import_from_file.png">
<MauiImage Include="Resources\Images\NavBar\settings_black.png" /> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Include="Resources\Images\DashBoard\account_banks.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Include="Resources\Images\GestionBanques\add_banks.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Include="Resources\Images\GestionBanques\reload_banks.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Include="Resources\Images\NavBar\dollar_black.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Include="Resources\Images\NavBar\settings_black.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<Resource Include="Resources\Images\NavBar\home_black.png" /> <Resource Include="Resources\Images\NavBar\home_black.png" />
<!-- Splash Screen --> <!-- Splash Screen -->
@ -48,6 +65,12 @@
<MauiImage Update="Resources\Images\logo_sans_fond.png"> <MauiImage Update="Resources\Images\logo_sans_fond.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage> </MauiImage>
<MauiImage Update="Resources\Images\logo_sans_fond_black.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Update="Resources\Images\refresh.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<!-- Custom Fonts --> <!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" /> <MauiFont Include="Resources\Fonts\*" />
@ -57,20 +80,23 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="Desktop\Planification.xaml.cs" /> <None Remove="Resources\Images\AjoutBanques\add_new_banks.png" />
</ItemGroup> <None Remove="Resources\Images\AjoutBanques\import_from_file.png" />
<None Remove="Resources\Images\DashBoard\account_banks.png" />
<ItemGroup> <None Remove="Resources\Images\GestionBanques\add_banks.png" />
<MauiXaml Remove="Desktop\Planification.xaml" /> <None Remove="Resources\Images\GestionBanques\reload_banks.png" />
<None Remove="Resources\Images\refresh.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<MauiImage Include="Resources\Images\NavBar\planification_black.png" /> <MauiImage Include="Resources\Images\NavBar\planification_black.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<MauiImage Include="Resources\Images\NavBar\home_black.png"> <MauiImage Include="Resources\Images\NavBar\home_black.png">
<CopyToOutputDirectory></CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage> </MauiImage>
</ItemGroup> </ItemGroup>
@ -80,25 +106,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="AppShellDesktop.xaml.cs"> <MauiXaml Update="ChangePassword.xaml">
<DependentUpon>AppShellDesktop.xaml</DependentUpon>
</Compile>
<Compile Update="Desktop\Dashboard.xaml.cs">
<DependentUpon>DashBoard.xaml</DependentUpon>
</Compile>
<Compile Update="Desktop\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Update="Desktop\Compte.xaml.cs">
<DependentUpon>Compte.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<MauiXaml Update="AppShellDesktop.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="ChangePassword.xaml"> <MauiXaml Update="Composant\VC_Operation_Dashboard.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="DashBoard.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Desktop\ChangePassword.xaml"> <MauiXaml Update="Desktop\ChangePassword.xaml">
@ -131,6 +145,12 @@
<MauiXaml Update="ForgetPassword.xaml"> <MauiXaml Update="ForgetPassword.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="GestionBanque.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="NewPage1.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Operations.xaml"> <MauiXaml Update="Operations.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
@ -143,9 +163,6 @@
<MauiXaml Update="Inscription.xaml"> <MauiXaml Update="Inscription.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Desktop\MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:composant="clr-namespace:IHM.Composant"
x:Class="IHM.Mobile.AjoutBanques"
Title="AjoutBanques">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.10*"/>
<RowDefinition Height="0.05*"/>
<RowDefinition Height="0.15*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.95*"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<HorizontalStackLayout Grid.Row="0" Grid.Column="0" VerticalOptions="Center">
<Image Source="Resources/Images/logo_sans_fond.png" HeightRequest="50" Margin="20"/>
<Label Text="Cons'Eco" FontSize="20" VerticalOptions="Center" FontAttributes="Bold"/>
<Button x:Name="boutonRetour" Text="retour" HeightRequest="50" Clicked="returnbutton" IsVisible="False" HorizontalOptions="End"/>
</HorizontalStackLayout>
<Label Grid.Row="1" Grid.ColumnSpan="3" Text="Liste des banques disponible : " FontAttributes="Bold" FontSize="Body" Padding="20,10,0,0"/>
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"
BackgroundColor="{StaticResource Tertiary}"
StrokeShape="RoundRectangle 20" Margin="10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.75*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="Importer depuis un fichier" TextColor="Black"
FontAttributes="Bold" FontSize="Body"
HorizontalOptions="Center"
VerticalOptions="Center"/>
<ImageButton Grid.Column="2" Source="import_from_file.png"
Padding="10" Margin="5"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"
Clicked="ImportOFX_Clicked"/>
</Grid>
</Border>
<CollectionView Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding BanquesDisponibleInApp}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.75*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Nom}"
FontAttributes="Bold" FontSize="Body"
HorizontalOptions="Center"
VerticalOptions="Center"/>
<ImageButton Grid.Column="2" Source="add_new_banks.png"
Padding="10" Margin="5"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"/>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
</ContentPage>

@ -0,0 +1,58 @@
using Model;
using System.Diagnostics;
using System.Numerics;
namespace IHM.Mobile;
public partial class AjoutBanques : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
public AjoutBanques()
{
InitializeComponent();
BindingContext = Mgr;
Mgr.importBanques();
if (OperatingSystem.IsIOS())
{
boutonRetour.IsVisible = true;
}
}
private async void ImportOFX_Clicked(object sender, EventArgs e)
{
PickOptions options = new PickOptions();
options.PickerTitle = "Choisir un fichier OFX";
try{
var result = await FilePicker.Default.PickAsync(options);
if (result != null)
{
if (result.FileName.EndsWith("ofx", StringComparison.OrdinalIgnoreCase))
{
IList<Compte> lesComptes = Mgr.getCompteFromOFX(result.FullPath);
Debug.WriteLine(lesComptes.Count);
foreach(Compte compte in lesComptes)
{
Mgr.User.LesBanques.First().AjouterCompte(compte);
}
}
}
else
{
throw new FileLoadException("Imposible de charger le fichier");
}
}
catch(Exception ex)
{
Debug.WriteLine(ex.Message);
}
}
private async void returnbutton(object sender, EventArgs e)
{
await Navigation.PopModalAsync();
}
}

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Mobile.DashBoard"> x:Class="IHM.Mobile.DashBoard">
<ScrollView>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="0.25*"/> <RowDefinition Height="0.25*"/>
@ -15,19 +16,39 @@
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackLayout Orientation="Horizontal">
<HorizontalStackLayout Grid.Row="0" Grid.Column="0" VerticalOptions="Center"> <Label
<Image Source="Resources/Images/logo_sans_fond.png" HeightRequest="50" Margin="20"/> Text="Bienvenue"
<Label Text="Cons'Eco" FontSize="20" VerticalOptions="Center" FontAttributes="Bold"/> VerticalOptions="Center"
</HorizontalStackLayout> HorizontalOptions="Start"
Margin="10,10,10,20"
<ImageButton Grid.Row="0" Grid.Column="1" Source="Resources/Images/Dashboard/account_banks.png" FontSize="25"
/>
<Label
FontAttributes="Bold"
Margin="0,10,0,0"
Text="{Binding User.Prenom}"
FontSize="25"
/>
</StackLayout>
<ImageButton Grid.Row="0" Grid.Column="1" Source="account_banks.png"
HorizontalOptions="End" Padding="10" Margin="10" HorizontalOptions="End" Padding="10" Margin="10"
CornerRadius="10" HeightRequest="65" CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"/> BackgroundColor="{StaticResource Primary}"
Clicked="Banques_Clicked"/>
<Label Grid.Row="1" Grid.ColumnSpan="2" Text="Liste des Dernières Opérations : " FontAttributes="Bold" FontSize="Body" Padding="20,5,0,0"/> <Label Grid.Row="1" Grid.ColumnSpan="2" Text="Liste des Dernières Opérations : " FontAttributes="Bold" FontSize="Body" Padding="20,5,0,0"/>
<CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding LesOpe}"> <CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding LesOpe}">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>
@ -98,4 +119,5 @@
</Grid> </Grid>
</ScrollView>
</ContentPage> </ContentPage>

@ -9,19 +9,31 @@ public partial class DashBoard : ContentPage
{ {
InitializeComponent(); InitializeComponent();
//Routing.RegisterRoute(nameof(DashBoard), typeof(DashBoard)); //Routing.RegisterRoute(nameof(DashBoard), typeof(DashBoard));
BindingContext = Mgr;
if (Mgr.User == null)
if (Mgr.SelectedInscrit == null)
{ {
loadInscription(); loadPage(new MainPage());
} }
if (!Mgr.testConnexionAsDatabase())
{
loadPage(new ErrorPage());
}
} }
public async void loadInscription() public async void loadPage(Page p)
{ {
await Navigation.PushModalAsync(new MainPage()); await Navigation.PushModalAsync(p);
} }
private void Banques_Clicked(object sender, EventArgs e)
{
loadPage(new GestionBanques());
}
} }

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Mobile.ErrorPage"
Title="Error">
<FlexLayout Direction="Column" JustifyContent="Center" AlignItems="Center">
<Image Source="{AppThemeBinding Light=logo_sans_fond_black.png, Dark=logo_sans_fond.png}"
HorizontalOptions="Center" HeightRequest="200"/>
<ActivityIndicator IsRunning="true" Margin="0,120,0,0" />
<Label Text="Tentative de connexion" Margin="0,20,0,0" FontSize="Body" FontAttributes="Bold"/>
</FlexLayout>
</ContentPage>

@ -0,0 +1,46 @@
using Model;
using System.Diagnostics;
namespace IHM.Mobile;
public partial class ErrorPage : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
public const int TIME_TEST_DB = 15000;
public ErrorPage()
{
InitializeComponent();
startTestConnexion();
}
protected override bool OnBackButtonPressed()
{
return true;
}
public void conIsActive()
{
while (!Mgr.testConnexionAsDatabase())
{
Thread.Sleep(TIME_TEST_DB);
}
ConnexionValide();
return;
}
public void startTestConnexion()
{
Task testConnexion = new Task(() => conIsActive());
testConnexion.Start();
}
private async void ConnexionValide()
{
await Navigation.PopModalAsync();
}
}

@ -28,6 +28,10 @@ public partial class ForgetPassword : ContentPage
ConnexionButton.IsEnabled = false; ConnexionButton.IsEnabled = false;
UpdateArc(); UpdateArc();
} }
else
{
AffichError("Mail inexistant", "Aucun compte possédant cette adresse email trouvé", "OK");
}
} }
private async void AffichError(string s, string s1, string s2) private async void AffichError(string s, string s1, string s2)
{ {

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:composant="clr-namespace:IHM.Composant"
x:Class="IHM.Mobile.GestionBanques"
Title="GestionBanques">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.10*"/>
<RowDefinition Height="0.05*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.95*"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<HorizontalStackLayout Grid.Row="0" Grid.Column="0" VerticalOptions="Center">
<Image Source="Resources/Images/logo_sans_fond.png" HeightRequest="50" Margin="20"/>
<Label Text="Cons'Eco" FontSize="20" VerticalOptions="Center" FontAttributes="Bold"/>
<Button x:Name="boutonRetour" Text="retour" HeightRequest="50" Clicked="returnbutton" IsVisible="False" HorizontalOptions="End"/>
</HorizontalStackLayout>
<ImageButton Grid.Row="0" Grid.Column="2" Source="add_banks.png"
HorizontalOptions="End" Padding="10" Margin="10"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"
Clicked="AddBanque_Clicked"/>
<Label Grid.Row="1" Grid.ColumnSpan="3" Text="Liste de vos banques : " FontAttributes="Bold" FontSize="Body" Padding="20,10,0,0"/>
<CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding User.LesBanques}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.75*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding Nom}"
FontAttributes="Bold" FontSize="Body"
HorizontalOptions="Center"
VerticalOptions="Center"/>
<ImageButton Grid.Column="2" Source="reload_banks.png"
Padding="10" Margin="5"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"/>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
</ContentPage>

@ -0,0 +1,35 @@
using Model;
using System.Collections.ObjectModel;
namespace IHM.Mobile;
public partial class GestionBanques : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
public GestionBanques()
{
InitializeComponent();
BindingContext= Mgr;
Mgr.LoadBanques();
if (OperatingSystem.IsIOS())
{
boutonRetour.IsVisible = true;
}
}
public async void loadPage(Page p)
{
await Navigation.PushModalAsync(p);
}
private void AddBanque_Clicked(object sender, EventArgs e)
{
loadPage(new AjoutBanques());
}
private async void returnbutton(object sender, EventArgs e)
{
await Navigation.PopModalAsync();
}
}

@ -12,6 +12,8 @@ namespace IHM.Mobile
BindingContext = this; BindingContext = this;
} }
public void ConnectionOnClicked(object sender, EventArgs e) public void ConnectionOnClicked(object sender, EventArgs e)
{ {
if (EntryMail.Text == null || EntryPassworld.Text == null) if (EntryMail.Text == null || EntryPassworld.Text == null)
@ -23,7 +25,7 @@ namespace IHM.Mobile
{ {
if (Mgr.isEqualHash(Mgr.recupMdpBdd(EntryMail.Text), EntryPassworld.Text)) if (Mgr.isEqualHash(Mgr.recupMdpBdd(EntryMail.Text), EntryPassworld.Text))
{ {
Mgr.LoadInscrit(EntryMail.Text, EntryPassworld.Text); Mgr.createUser(EntryMail.Text);
ConnexionValide(); ConnexionValide();
} }
else else
@ -40,6 +42,7 @@ namespace IHM.Mobile
private async void ConnexionValide() private async void ConnexionValide()
{ {
Mgr.LoadBanques();
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
} }

@ -1,34 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Mobile.Operations"> x:Class="IHM.Mobile.Operations">
<Grid> <VerticalStackLayout>
<Grid.RowDefinitions> <CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding User.LesBanques[0].ListeDesComptes[0].LesOpe}">
<RowDefinition Height="0.25*"/>
<RowDefinition Height="0.15*"/>
<RowDefinition Height="1.40*"/>
<RowDefinition Height="0.15*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<HorizontalStackLayout Grid.Row="0" Grid.Column="0" VerticalOptions="Center">
<Image Source="Resources/Images/logo_sans_fond.png" HeightRequest="50" Margin="20"/>
<Label Text="Cons'Eco" FontSize="20" VerticalOptions="Center" FontAttributes="Bold"/>
</HorizontalStackLayout>
<ImageButton Grid.Row="0" Grid.Column="1" Source="Resources/Images/Dashboard/account_banks.png"
HorizontalOptions="End" Padding="10" Margin="10"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"/>
<Label Grid.Row="1" Grid.ColumnSpan="2" Text="Liste des Dernières Opérations : " FontAttributes="Bold" FontSize="Body" Padding="20,5,0,0"/>
<CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding LesOpe}">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid Padding="10" > <Grid Padding="10" >
@ -37,65 +12,29 @@
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition/> <!--<ColumnDefinition/>-->
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ImageButton Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" <!--<ImageButton Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
Source="{Binding ImageSrc}" Source="{Binding ImageSrc}"
CornerRadius="10"/> CornerRadius="10"/>-->
<Label Grid.Row="0" Grid.Column="1" <Label Grid.Row="0" Grid.Column="1"
Text="{Binding NomOpe}" Text="{Binding IntituleOperation}"
FontAttributes="Bold" /> FontAttributes="Bold" TextColor="Brown" />
<Label Grid.Row="1" Grid.Column="1" <Label Grid.Row="1" Grid.Column="1"
Text="{Binding DetailTypeOpe}" Text="{Binding DetailTypeOpe}"
FontAttributes="Italic"/> FontAttributes="Italic"/>
<Label Grid.Row="0" Grid.Column="2" <Label Grid.Row="0" Grid.Column="2"
Text="{Binding DateOpe}"/> Text="{Binding DateOperation}"/>
<Label Grid.Row="0" Grid.Column="3" Grid.ColumnSpan="2" <Label Grid.Row="0" Grid.Column="3" Grid.ColumnSpan="2"
Text="{Binding MontantOpe}" Text="{Binding Montant}"
FontAttributes="Bold"/>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Label Grid.Row="3" Grid.ColumnSpan="2" Text="Liste des Comptes favoris :" FontAttributes="Bold" FontSize="Body" Padding="20,0,0,0"/>
<CollectionView Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding ComptesFav}" ItemsLayout="HorizontalList">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="10">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
Text="{Binding Banque}"
FontAttributes="Bold"/>
<Label Grid.Row="0" Grid.Column="1"
Text="{Binding Type}"
FontAttributes="Italic"/>
<Label Grid.Row="1" Grid.Column="1"
Text="{Binding Solde}"
FontAttributes="Bold"/> FontAttributes="Bold"/>
<Label Grid.Row="0" Grid.Column="2"
Text="{Binding DateMaJ}"/>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
</CollectionView> </CollectionView>
</VerticalStackLayout>
</Grid>
</ContentPage> </ContentPage>

@ -1,9 +1,14 @@
using System.Diagnostics;
using Model;
namespace IHM.Mobile; namespace IHM.Mobile;
public partial class Operations : ContentPage public partial class Operations : ContentPage
{ {
public Manager Mgr => (App.Current as App).Manager;
public Operations() public Operations()
{ {
InitializeComponent(); InitializeComponent();
BindingContext = Mgr;
} }
} }

@ -1,11 +1,135 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Mobile.Planification"> xmlns:local="clr-namespace:IHM.Composant"
x:Class="IHM.Mobile.Planification"
BackgroundColor="#A00EE8">
<ScrollView VerticalOptions="FillAndExpand">
<VerticalStackLayout> <VerticalStackLayout>
<StackLayout Orientation="Horizontal">
<Label <Label
Text="Planification" Text="Bienvenue"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center" /> HorizontalOptions="Start"
Margin="10,10,10,20"
FontSize="25"
/>
<Label
FontAttributes="Bold"
Margin="0,10,0,0"
Text="{Binding User.Prenom}"
FontSize="25"
/>
</StackLayout>
<Button
BackgroundColor="Red"
x:Name="Bouton"
WidthRequest="50"
HeightRequest="50"
HorizontalOptions="End"
Margin="0,0,40,0"
Clicked="OnClickedGestionBanque"
/>
<Button
IsVisible="False"
IsEnabled="False"
WidthRequest="175"
HeightRequest="50"
Margin="0,-50,0,0"
x:Name="ImgBanqueActuelle"
BackgroundColor="AliceBlue"
Text="{Binding selectedBanque}"
/>
<Button
IsVisible="false"
BackgroundColor="Black"
x:Name="BoutonRetour"
WidthRequest="50"
HeightRequest="50"
HorizontalOptions="End"
Margin="0,-50,40,0"
Clicked="OnClickedRetour"
/>
<StackLayout IsVisible="false" x:Name="stackpannel">
<CollectionView x:Name="listeBanque" ItemsSource="{Binding User.LesBanques}" ItemsUpdatingScrollMode="KeepScrollOffset" Margin="22,0,22,0" ItemsLayout="HorizontalList">
<CollectionView.ItemTemplate>
<DataTemplate>
<StackLayout Margin="0,35,0,0">
<Button Clicked="OnClickedBanque" Text="{Binding Nom}"/>
</StackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
<StackLayout Margin="0,20,0,0" Orientation="Horizontal">
<Label Margin="20,0,0,0" FontSize="25">Solde total :</Label>
<Label FontSize="25" Margin="8,0,0,0" x:Name="soldetotal">0</Label>
</StackLayout>
<Border Stroke="Black" StrokeThickness="5" Margin="0,70,0,0">
<StackLayout BackgroundColor="Cyan" Padding="0,0,0,20">
<Label HorizontalTextAlignment="Center" FontSize="20">Listes des dernières opérations</Label>
<StackLayout Orientation="Vertical">
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label>Nom de l'opération</Label>
<Label>Date de l'opération</Label>
<Label>Type d'opération</Label>
</StackLayout>
</StackLayout>
</StackLayout>
</Border>
<Border Stroke="Black" StrokeThickness="5" Margin="0,70,0,30">
<StackLayout Margin="0,10,0,0">
<Label HorizontalTextAlignment="Center" FontSize="20">Pour vous</Label>
<StackLayout BackgroundColor="RosyBrown" Margin="0,0,0,20" HeightRequest="200" WidthRequest="310">
<Label HorizontalOptions="Center" FontSize="20">Aide à la gestion personnalisée</Label>
</StackLayout>
</StackLayout>
</Border>
</VerticalStackLayout> </VerticalStackLayout>
</ScrollView>
</ContentPage> </ContentPage>

@ -1,9 +1,51 @@
using Model;
namespace IHM.Mobile; namespace IHM.Mobile;
public partial class Planification : ContentPage public partial class Planification : ContentPage
{ {
public Manager Mgr => (App.Current as App).Manager;
public Planification() public Planification()
{ {
InitializeComponent(); InitializeComponent();
BindingContext = Mgr;
//Routing.RegisterRoute(nameof(DashBoard), typeof(DashBoard));
}
void OnClickedBanque(object sender, EventArgs args)
{
Button btn = (Button)sender;
ImgBanqueActuelle.Text = btn.Text;
}
async void OnClickedGestionBanque(object sender, EventArgs args)
{
Bouton.BackgroundColor = Color.FromRgb(192, 192, 192);
await Bouton.TranslateTo(-130, 35, 50);
await Bouton.ScaleXTo(7.5, 50);
await Bouton.ScaleYTo(3, 50);
stackpannel.IsVisible = true;
BoutonRetour.IsVisible = true;
ImgBanqueActuelle.IsVisible = true;
//await Navigation.PushModalAsync(new GestionBanque());
}
async void OnClickedRetour(object sender, EventArgs args)
{
await Bouton.ScaleXTo(1, 50);
await Bouton.ScaleYTo(1, 50);
ImgBanqueActuelle.IsVisible = false;
stackpannel.IsVisible = false;
await Bouton.TranslateTo(0, 0, 50);
BoutonRetour.IsVisible = false;
}
public async void loadInscription()
{
await Navigation.PushModalAsync(new MainPage());
BindingContext = Mgr;
} }
} }

@ -3,14 +3,59 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Mobile.Settings"> x:Class="IHM.Mobile.Settings">
<VerticalStackLayout> <VerticalStackLayout>
<Grid BackgroundColor="{AppThemeBinding Light={StaticResource Gray600}, Dark={StaticResource Gray100}}">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label <Label
Text="Paramètre" Text="Paramètre"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="Center" /> HorizontalOptions="End"
<Button Margin="10"
Text="Déconnexion" TextColor="{AppThemeBinding Light={StaticResource Gray100}, Dark={StaticResource Gray600}}"
VerticalOptions="End" FontSize="20"
FontAttributes="Bold"
/>
<ImageButton
Grid.Column="1"
Source="Resources/Image/refresh.png"
Clicked="deconnexionOnClicked" Clicked="deconnexionOnClicked"
WidthRequest="35"
HeightRequest="35"
HorizontalOptions="End"
CornerRadius="10"
Margin="0,10,40,10"
x:Name="ActualisationButton"
BackgroundColor="{StaticResource Primary}"
/>
</Grid>
<Label
Text="Solde Total"
HorizontalOptions="Center"
FontSize="20"
Margin="10"
FontAttributes="Bold"
TextColor="{AppThemeBinding Light={StaticResource Gray600}, Dark={StaticResource Gray100}}"/>
<ProgressBar
x:Name="ProgressBarSolde"
WidthRequest="250"
ScaleY="3"
ProgressColor="{StaticResource Cyan200Accent}" />
<HorizontalStackLayout>
<Label
Text="0"
HorizontalOptions="Start"/>
<Label
Text="2000"
HorizontalOptions="End"/>
</HorizontalStackLayout>
<Label
Text="{Binding Solde}"
HorizontalOptions="Center"/> HorizontalOptions="Center"/>
</VerticalStackLayout> </VerticalStackLayout>
</ContentPage> </ContentPage>

@ -1,5 +1,7 @@
namespace IHM.Mobile; namespace IHM.Mobile;
using Model; using Model;
using System.Diagnostics;
public partial class Settings : ContentPage public partial class Settings : ContentPage
{ {
public Manager Mgr => (App.Current as App).Manager; public Manager Mgr => (App.Current as App).Manager;
@ -9,11 +11,12 @@ public partial class Settings : ContentPage
} }
public void deconnexionOnClicked(object sender, EventArgs e) public void deconnexionOnClicked(object sender, EventArgs e)
{ {
Mgr.SelectedInscrit = null; Mgr.deconnexion();
NavigateTo(); NavigateTo();
} }
private async void NavigateTo() private async void NavigateTo()
{ {
await Navigation.PushModalAsync(new MainPage()); await Navigation.PushModalAsync(new MainPage());
} }
} }

@ -3,4 +3,5 @@
<application android:allowBackup="true" android:icon="@mipmap/logo" android:roundIcon="@mipmap/logo_round" android:supportsRtl="true"></application> <application android:allowBackup="true" android:icon="@mipmap/logo" android:roundIcon="@mipmap/logo_round" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest> </manifest>

@ -26,7 +26,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
</dict> </dict>
</plist> </plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

@ -6,7 +6,7 @@
<Color x:Key="Primary">#7FB196</Color> <Color x:Key="Primary">#7FB196</Color>
<Color x:Key="Secondary">#3C425A</Color> <Color x:Key="Secondary">#3C425A</Color>
<Color x:Key="Tertiary">#DF775C</Color> <Color x:Key="Tertiary">#F3EFDB</Color>
<Color x:Key="White">White</Color> <Color x:Key="White">White</Color>
<Color x:Key="Black">Black</Color> <Color x:Key="Black">Black</Color>
<Color x:Key="Gray100">#E1E1E1</Color> <Color x:Key="Gray100">#E1E1E1</Color>
@ -41,11 +41,5 @@
<Color x:Key="Blue200Accent">#72ACF1</Color> <Color x:Key="Blue200Accent">#72ACF1</Color>
<Color x:Key="Blue300Accent">#A7CBF6</Color> <Color x:Key="Blue300Accent">#A7CBF6</Color>
<LinearGradientBrush x:Key="TestColor" StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="RosyBrown" Offset="0" />
<GradientStop Color="{StaticResource Tertiary}" Offset="0.5" />
<GradientStop Color="RosyBrown" Offset="1" />
</LinearGradientBrush>
</ResourceDictionary> </ResourceDictionary>

@ -1,17 +1,31 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Model namespace Model
{ {
public class Banque public class Banque : INotifyPropertyChanged
{ {
public event PropertyChangedEventHandler PropertyChanged;
public string Nom { get; private set; } public string Nom { get; private set; }
public string UrlSite { get; private set; } public string UrlSite { get; private set; }
public string UrlLogo { get; private set; } public string UrlLogo { get; private set; }
public List<Compte> ListeDesComptes { get; private set; } = new List<Compte>(); public List<Compte> ListeDesComptes
{
get => listeDesComptes;
set
{
if (listeDesComptes != value)
{
listeDesComptes = value;
OnPropertyChanged(nameof(ListeDesComptes));
}
}
}
private List<Compte> listeDesComptes = new List<Compte>();
public Banque(string nom, string urlSite, string urlLogo) public Banque(string nom, string urlSite, string urlLogo)
{ {
@ -28,6 +42,7 @@ namespace Model
ListeDesComptes = lescomptes; ListeDesComptes = lescomptes;
} }
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public void AjouterCompte(Compte compte) public void AjouterCompte(Compte compte)
{ {
ListeDesComptes.Add(compte); ListeDesComptes.Add(compte);

@ -1,51 +1,54 @@
namespace Model using Microsoft.Maui.Graphics;
using System.Collections.Specialized;
using System.ComponentModel;
namespace Model
{ {
public class Compte public class Compte : INotifyPropertyChanged
{ {
public string Identifiant { get; private set; } public event PropertyChangedEventHandler PropertyChanged;
public string Nom { get; private set; } public string Identifiant { get; set; }
public double Solde { get; private set; } public string Nom { get; set; }
public List<Operation> LesOpe { get; private set; } = new List<Operation>(); public double Solde { get; set; }
public List<Planification> LesPla { get; private set; } = new List<Planification>(); public DateTime DerniereModification { get; set; }
public List<Echeance> LesEch { get; private set; } = new List<Echeance>(); public List<Operation> LesOpe
public Compte(string id,string nom, double solde)
{ {
Identifiant = id; get => lesOpe;
Nom = nom; set
Solde = solde; {
LesOpe = new List<Operation>(); if (lesOpe != value)
LesPla = new List<Planification>(); {
LesEch = new List<Echeance>(); lesOpe = value;
OnPropertyChanged(nameof(LesOpe));
} }
public Compte(string id, string nom, double solde, List<Operation> lesOpe) }
}
private List<Operation> lesOpe = new List<Operation>();
public List<Planification> LesPla { get; set; } = new List<Planification>();
public List<Echeance> LesEch { get; set; } = new List<Echeance>();
public Compte(string id,string nom, double solde)
{ {
Identifiant = id; Identifiant = id;
Nom = nom; Nom = nom;
Solde = solde; Solde = solde;
LesOpe = lesOpe; DerniereModification = DateTime.Now;
} }
public Compte(string id, string nom, double solde, List<Operation> lesOpe, List<Planification> lesPla) public Compte(string id, string nom, double solde, List<Operation> lesOpe) : base()
{ {
Identifiant = id;
Nom = nom;
Solde = solde;
LesOpe = lesOpe; LesOpe = lesOpe;
LesPla = lesPla;
} }
public Compte(string id, string nom, double solde, List<Operation> lesOpe, List<Planification> lesPla, List<Echeance> lesEch) public Compte(string id, string nom, double solde, List<Operation> lesOpe, List<Planification> lesPla) : base()
{ {
Identifiant = id;
Nom = nom;
Solde = solde;
LesOpe = lesOpe;
LesPla = lesPla; LesPla = lesPla;
LesEch = lesEch;
} }
public void modifierSolde(double s) public Compte(string id, string nom, double solde, List<Operation> lesOpe, List<Planification> lesPla, List<Echeance> lesEch) : base()
{ {
Solde = s; LesEch = lesEch;
} }
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public void ajouterOperation(Operation o) public void ajouterOperation(Operation o)
{ {
if (o == null) throw new NullReferenceException(); if (o == null) throw new NullReferenceException();
@ -91,6 +94,11 @@
{ {
return false; return false;
} }
else
{
Compte objCompte = (Compte) obj;
if(objCompte.Identifiant == Identifiant && objCompte.DerniereModification == DerniereModification) return true;
}
return base.Equals(obj); return base.Equals(obj);
} }
@ -100,5 +108,10 @@
return base.GetHashCode(); return base.GetHashCode();
} }
public override string ToString()
{
return Identifiant + " " + Nom + " " + Solde + " " + DerniereModification + "\n";
}
} }
} }

@ -8,7 +8,7 @@ namespace Model
{ {
public interface IPersistanceManager public interface IPersistanceManager
{ {
string LoadInscrit(string id,string mdp); string GetId(string mail);
void SupprimerInscritBdd(Inscrit inscrit); void SupprimerInscritBdd(Inscrit inscrit);
void SupprimerBanqueBdd(Inscrit inscrit, Banque banque); void SupprimerBanqueBdd(Inscrit inscrit, Banque banque);
void SupprimerToutesBanquesBdd(Inscrit inscrit); void SupprimerToutesBanquesBdd(Inscrit inscrit);
@ -17,5 +17,12 @@ namespace Model
bool ExistEmail(string mail); bool ExistEmail(string mail);
void ChangePasswordBdd(string mail, string newMdp); void ChangePasswordBdd(string mail, string newMdp);
string RecupMdpBdd(string mail); string RecupMdpBdd(string mail);
int CalculTotalSoldeComtpe(Inscrit user);
List<Banque> LoadBanqueId(string id);
public bool TestConnexionAsDatabase();
public List<Banque> ImportBanques();
public Inscrit GetInscrit(string mail);
public IList<Compte> GetCompteFromOFX(string ofx);
} }
} }

@ -5,14 +5,16 @@ using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Model; using Model;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.ComponentModel;
namespace Model namespace Model
{ {
public class Inscrit public class Inscrit:INotifyPropertyChanged
{ {
public Hash hash = new Hash(); public Hash hash = new Hash();
public event PropertyChangedEventHandler PropertyChanged;
public string Id { get; private set; } public string Id { get; private set; }
public string Nom { get; private set; } public string Nom { get; private set; }
@ -34,7 +36,7 @@ namespace Model
} }
private string mail; private string mail;
public string Prenom { get; private set; } public string Prenom { get; set; }
public string Mdp public string Mdp
{ {
@ -58,10 +60,24 @@ namespace Model
} }
private string mdp; private string mdp;
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public double SoldeTotal { get; private set; } public double SoldeTotal { get; private set; }
public Devises Dev { get; private set; } public Devises Dev { get; private set; }
public List<Banque> LesBanques { get; private set; } = new List<Banque>(); public List<Banque> LesBanques
{
get => lesBanques;
set
{
if(lesBanques!=value)
{
lesBanques = value;
OnPropertyChanged(nameof(LesBanques));
}
}
}
private List<Banque> lesBanques;
public Inscrit(string id, string nom, string mail, string prenom, string mdp, double soldeTotal = 0) public Inscrit(string id, string nom, string mail, string prenom, string mdp, double soldeTotal = 0)
{ {
Id = id; Id = id;
@ -77,6 +93,17 @@ namespace Model
LesBanques = lesbanques; LesBanques = lesbanques;
} }
public Inscrit(string mail, string id)
{
Prenom = "Lucas";
Mail = mail;
Id = id;
}
public Inscrit(List<Banque> lesbanques)
{
LesBanques = lesbanques;
}
public void ajouterBanque(Banque banque) public void ajouterBanque(Banque banque)

@ -1,4 +1,6 @@
using System.ComponentModel; using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
namespace Model namespace Model
{ {
@ -7,10 +9,42 @@ namespace Model
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
public IPersistanceManager Pers { get; private set; } public IPersistanceManager Pers { get; private set; }
public string SelectedInscrit { get; set; } public int SelectedInscrit { get; set; }
public Hash hash = new Hash(); public Hash hash = new Hash();
public int Solde
{
get => solde;
set
{
if (solde != value)
{
solde = value;
OnPropertyChanged(nameof(Solde));
}
}
}
private int solde;
private Inscrit user;
public Inscrit User
{
get
{
return user;
}
set
{
if (user != value)
{
user = value;
OnPropertyChanged(nameof(User));
}
}
}
public Banque SelectedBanque public Banque SelectedBanque
{ {
get => selectedBanque; get => selectedBanque;
@ -19,11 +53,24 @@ namespace Model
if (selectedBanque != value) if (selectedBanque != value)
{ {
selectedBanque = value; selectedBanque = value;
OnPropertyChanged(nameof(selectedBanque)); OnPropertyChanged(nameof(SelectedBanque));
} }
} }
} }
private Banque selectedBanque; private Banque selectedBanque;
public List<Banque> BanquesDisponibleInApp
{
get => banquesDisponibleInApp;
set
{
if (banquesDisponibleInApp != value)
{
banquesDisponibleInApp = value;
OnPropertyChanged(nameof(BanquesDisponibleInApp));
}
}
}
private List<Banque> banquesDisponibleInApp;
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
@ -37,9 +84,18 @@ namespace Model
Pers.SupprimerInscritBdd(i); Pers.SupprimerInscritBdd(i);
} }
public void LoadInscrit(string id, string mdp) public string GetId(string mail)
{ {
SelectedInscrit = Pers.LoadInscrit(id, mdp); return Pers.GetId(mail);
}
public void LoadBanques()
{
User.LesBanques = Pers.LoadBanqueId(User.Id);
if (User.LesBanques.Count() > 0)
{
SelectedBanque = User.LesBanques[0];
}
} }
public void supprimerToutesBanquesBdd(Inscrit inscrit) public void supprimerToutesBanquesBdd(Inscrit inscrit)
@ -76,6 +132,39 @@ namespace Model
{ {
return hash.IsEqualHash(mdpBdd, mdpSent); return hash.IsEqualHash(mdpBdd, mdpSent);
} }
public void createUser(string mail)
{
//User = new Inscrit(mail, GetId(mail));
User = Pers.GetInscrit(mail);
}
public int recupTotalSolde()
{
Solde = Pers.CalculTotalSoldeComtpe(User);
return Solde;
} }
public void deconnexion()
{
User = null;
} }
public bool testConnexionAsDatabase()
{
return Pers.TestConnexionAsDatabase();
}
public void importBanques()
{
BanquesDisponibleInApp = Pers.ImportBanques();
}
public IList<Compte> getCompteFromOFX(string ofx)
{
return Pers.GetCompteFromOFX(ofx);
}
}
}

@ -1,15 +1,28 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Model namespace Model
{ {
public class Operation public class Operation : INotifyPropertyChanged
{ {
public event PropertyChangedEventHandler PropertyChanged;
public string IntituleOperation { get; private set; } public string IntituleOperation
{
get => intituleOperation;
set
{
if (intituleOperation != value)
{
intituleOperation = value;
OnPropertyChanged(nameof(IntituleOperation));
}
}
}
private string intituleOperation;
public double Montant { get; private set; } public double Montant { get; private set; }
@ -19,21 +32,20 @@ namespace Model
public bool IsDebit { get; private set; } public bool IsDebit { get; private set; }
public string IdCompte { get; private set; } public Operation(string intituleOperation, double montant, DateTime dateOperation, MethodePayement modePayement, bool isDebit=true)
public Operation(string intituleOperation, string idCompte, double montant, DateTime dateOperation, MethodePayement modePayement, bool isDebit=true)
{ {
IntituleOperation = intituleOperation; IntituleOperation = intituleOperation;
IdCompte = idCompte;
Montant = montant; Montant = montant;
DateOperation = dateOperation; DateOperation = dateOperation;
ModePayement = modePayement; ModePayement = modePayement;
IsDebit = isDebit; IsDebit = isDebit;
} }
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public override string ToString() public override string ToString()
{ {
return IdCompte + " " + IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + "\n"; return IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + "\n";
} }
} }
} }

@ -1,46 +0,0 @@
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("012345678901", "Livret A", 1500));
Comptes.Add(new("012345678902", "Compte Courant", 2000));
Comptes.Add(new("012345678903", "PEL", 22000));
return Comptes;
}
}
}

@ -53,4 +53,4 @@ NEWFILEUID:NONE
<MEMO>PAIEMENT PAR CARTE X8476 ROYALCDKEYS.COM TSIM 09/11 <MEMO>PAIEMENT PAR CARTE X8476 ROYALCDKEYS.COM TSIM 09/11
</STMTTRN> </STMTTRN>
</STMTTRNRS>

@ -3,14 +3,17 @@ using Model;
Console.WriteLine("Test Deserializer OFX - simplifié"); Console.WriteLine("Test Deserializer OFX - simplifié");
IList<Operation> operations= new List<Operation>(); IList<Compte> comptes= new List<Compte>();
operations.Add(new Operation("OpeDeTest", "01234567890", 100, DateTime.Now, MethodePayement.Esp, true));
operations = LoadOperation.LoadOperationsFromOFX("C:\\Dev\\ConsEcoAndMAUI\\Sources\\TestFonctionnel\\CA_simplifié.ofx"); comptes = LoadOperation.LoadOperationsFromOFX("C:\\Dev\\ConsEco\\Sources\\TestFonctionnel\\CAcomplet.ofx");
foreach (Operation op in operations) foreach (Compte compte in comptes)
{ {
Console.WriteLine(op); Console.WriteLine(compte);
foreach(Operation operation in compte.LesOpe)
{
Console.WriteLine("\t\t"+operation);
}
} }

@ -32,5 +32,6 @@ namespace TestsUnitaires
i1.SupprimerBanque(bq); i1.SupprimerBanque(bq);
Assert.DoesNotContain(bq, i1.LesBanques); Assert.DoesNotContain(bq, i1.LesBanques);
} }
} }
} }

Loading…
Cancel
Save