ajout visu ( a reprendre fait a la va vite)

GestionBanques
Hugo LIVET 2 years ago
parent 6a363d2516
commit 085561db1e

@ -427,7 +427,14 @@ namespace LinqToPgSQL
return bquesDispo;
}
public Inscrit GetInscrit(string mail)
{
throw new NotImplementedException();
}
public IList<Compte> GetCompteFromOFX(string ofx)
{
throw new NotImplementedException();
}
}
}

@ -0,0 +1,82 @@
using Model;
namespace Data
{
public class Stub : IPersistanceManager
{
public string GetId(string mail)
{
return "1";
}
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){}
public string LastInscrit()
{
return "1";
}
public bool ExistEmail(string mail)
{
return true;
}
public void ChangePasswordBdd(string mail, string newMdp)
{
throw new NotImplementedException();
}
public string RecupMdpBdd(string mail)
{
return "61202106183104184172149183829180134166241997147151111351903525172892257223616564213999421532841808077145252175106506275806214514321147161111472321892055913517616241";
}
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)
{
string mdp = "Azerty12345678!";
Inscrit i = new Inscrit("1", "LIVET", "livet.hugo2003@gmail.com", "Hugo", mdp);
return i;
}
public IList<Compte> GetCompteFromOFX(string ofx)
{
return LoadOperation.LoadOperationsFromOFX(ofx);
}
}
}

@ -1,11 +1,12 @@
using LinqToPgSQL;
using Data;
using LinqToPgSQL;
using Model;
namespace IHM
{
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()
{
InitializeComponent();

@ -1,5 +1,6 @@
using Model;
using System.Diagnostics;
using System.Numerics;
namespace IHM.Mobile;
@ -18,21 +19,35 @@ public partial class AjoutBanques : ContentPage
PickOptions options = new PickOptions();
options.PickerTitle = "Choisir un fichier OFX";
var result = await FilePicker.Default.PickAsync(options);
if (result != null)
{
if (result.FileName.EndsWith("ofx", StringComparison.OrdinalIgnoreCase))
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
{
string file = File.ReadAllText(result.FullPath).ToString();
//return file;
throw new FileLoadException("Imposible de charger le fichier");
}
}
else
catch(Exception ex)
{
throw new FileLoadException("Imposible de charger le fichier");
Debug.WriteLine(ex.Message);
}
}
}

@ -3,6 +3,42 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Mobile.Operations">
<VerticalStackLayout>
<ScrollView>
<CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding User.LesBanques[0].ListeDesComptes[0].LesOpe}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="10">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<!--<ColumnDefinition/>-->
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!--<ImageButton Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
Source="{Binding ImageSrc}"
CornerRadius="10"/>-->
<Label Grid.Row="0" Grid.Column="1"
Text="{Binding IntituleOperation}"
FontAttributes="Bold" />
<Label Grid.Row="1" Grid.Column="1"
Text="{Binding DetailTypeOpe}"
FontAttributes="Italic"/>
<Label Grid.Row="0" Grid.Column="2"
Text="{Binding DateOperation}"/>
<Label Grid.Row="0" Grid.Column="3" Grid.ColumnSpan="2"
Text="{Binding Montant}"
FontAttributes="Bold"/>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ScrollView>
</VerticalStackLayout>
</ContentPage>

@ -1,17 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class Banque
public class Banque : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
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 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)
{
@ -28,6 +42,7 @@ namespace Model
ListeDesComptes = lescomptes;
}
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public void AjouterCompte(Compte compte)
{
ListeDesComptes.Add(compte);

@ -1,14 +1,29 @@
using Microsoft.Maui.Graphics;
using System.Collections.Specialized;
using System.ComponentModel;
namespace Model
{
public class Compte
public class Compte : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public string Identifiant { get; set; }
public string Nom { get; set; }
public double Solde { get; set; }
public DateTime DerniereModification { get; set; }
public List<Operation> LesOpe { get; set; } = new List<Operation>();
public List<Operation> LesOpe
{
get => lesOpe;
set
{
if (lesOpe != value)
{
lesOpe = value;
OnPropertyChanged(nameof(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)
@ -31,6 +46,9 @@ namespace Model
LesEch = lesEch;
}
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public void ajouterOperation(Operation o)
{
if (o == null) throw new NullReferenceException();

@ -21,5 +21,8 @@ namespace Model
List<Banque> LoadBanqueId(string id);
public bool TestConnexionAsDatabase();
public List<Banque> ImportBanques();
public Inscrit GetInscrit(string mail);
public IList<Compte> GetCompteFromOFX(string ofx);
}
}

@ -138,7 +138,8 @@ namespace Model
public void createUser(string mail)
{
User = new Inscrit(mail, GetId(mail));
//User = new Inscrit(mail, GetId(mail));
User = Pers.GetInscrit(mail);
}
public int recupTotalSolde()
@ -162,6 +163,11 @@ namespace Model
BanquesDisponibleInApp = Pers.ImportBanques();
}
public IList<Compte> getCompteFromOFX(string ofx)
{
return Pers.GetCompteFromOFX(ofx);
}
}
}

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

@ -1,48 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class Stub //la classe n'implémante pas IPersistanceManager
{
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;
}
}
}
Loading…
Cancel
Save