banque avec le manager a jour
continuous-integration/drone/push Build is failing Details

GestionBanques
Hugo LIVET 2 years ago
parent 3f6f1c4905
commit 6a363d2516

@ -14,10 +14,11 @@ namespace Data
{
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<Operation> lesOpe = new List<Operation>();
IList<Compte> lesComptes = new List<Compte>();
Compte compteEnCoursDeSaisie = null;
//détail d'une Operation
string intituleOperation;
@ -28,26 +29,31 @@ namespace Data
//info compte
string identifiantCompte="";
double solde=0;
using (StreamReader reader = new StreamReader(csv))
using (StreamReader reader = new StreamReader(ofx))
{
if (reader != null)
{
string row;
while ((row = reader.ReadLine()) != null)
{
if (row.Contains("<CURDEF>"))
if (row.Contains("<STMTTRNRS>"))
{
row = "";
compteEnCoursDeSaisie = new Compte(identifiantCompte, identifiantCompte, 0);
}
else if (row.Contains("</STMTTRNRS>")){
lesComptes.Add(compteEnCoursDeSaisie);
}
else if (row.Contains("<ACCTID>"))
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>"))
{
solde = Convert.ToDouble(GetValueInRow(row, 4));
compteEnCoursDeSaisie.Solde = double.Parse(CutRow(row).Last(), CultureInfo.InvariantCulture);
}
else if (row.Contains("<STMTTRN>"))
{
@ -93,7 +99,7 @@ namespace Data
row = "";
}
}
lesOpe.Add(new Operation(intituleOperation, identifiantCompte, montant, dateOperation, modePayement, isDebit));
compteEnCoursDeSaisie.ajouterOperation(new Operation(intituleOperation, montant, dateOperation, modePayement, isDebit));
}
else
{
@ -102,7 +108,7 @@ namespace Data
}
}
}
return lesOpe;
return lesComptes;
}
@ -114,19 +120,5 @@ namespace Data
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();
}
}
}

@ -21,7 +21,9 @@ namespace LinqToPgSQL
{
private Hash hash = new Hash();
private static string connexionBDD = String.Format("Server=2.3.8.130; Username=postgres; Database=conseco; Port=5432; Password=lulu; SSLMode=Prefer");
private static NpgsqlConnection dbAccess = new NpgsqlConnection(connexionBDD);
public bool TestConnexionAsDatabase()
{
bool isOk = true;
@ -41,11 +43,10 @@ namespace LinqToPgSQL
return isOk;
}
public string LoadInscrit(string id, string mdp)
public string GetId(string mail)
{
int resultat;
var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection");
conn.Open();
NpgsqlParameter p1 = new NpgsqlParameter { ParameterName = "p", Value = mail };
NpgsqlCommand cmd = new NpgsqlCommand($"SELECT id FROM INSCRIT WHERE mail=(@p)", conn);
@ -54,29 +55,33 @@ namespace LinqToPgSQL
dr.Read();
resultat = dr.GetInt32(0);
dr.Close();
conn.Close();
return resultat.ToString();
}
public bool ExistEmail(string mail)
public string LoadInscrit(string id, string mdp)
{
int resultat;
var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection");
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();
conn.Close();
return resultat.ToString();
}
public bool ExistEmail(string mail)
{
/*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);
}*/
var conn = new NpgsqlConnection(connexionBDD);
conn.Open();
NpgsqlDataReader dbReader = new NpgsqlCommand("SELECT mail FROM Inscrit", conn).ExecuteReader();
while (dbReader.Read())
@ -89,6 +94,7 @@ namespace LinqToPgSQL
}
dbReader.Close();
conn.Close();
return false;
}
@ -282,7 +288,7 @@ namespace LinqToPgSQL
}
/* while (dbReader.Read())
while (dbReader.Read())
{
ListeCompte.Add(new Compte("NULL",dbReader.GetString(0), dbReader.GetInt64(1)));//a patch NULL
}
@ -421,21 +427,6 @@ namespace LinqToPgSQL
return bquesDispo;
}
public List<Banque> ImportBanquesForUser(Inscrit i)
{
List<Banque> bquesDispo = new List<Banque>();
dbAccess.Open();
NpgsqlCommand cmd = new NpgsqlCommand($"SELECT b.nom, b.urllogo, b.urldl FROM Banque b, InscrBanque ib WHERE ib.nombanque = b.nom AND ib.idinscrit=(@id);", dbAccess);
cmd.Parameters.AddWithValue("p", i.Id);
NpgsqlDataReader dbReader = cmd.ExecuteReader();
while (dbReader.Read())
{
bquesDispo.Add(new Banque(dbReader.GetString(0), dbReader.GetString(1), dbReader.GetString(2)));
}
dbAccess.Close();
return bquesDispo;
}
}

@ -1,59 +0,0 @@
using Model;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.PlatformConfiguration.TizenSpecific;
using System.Diagnostics;
namespace IHM
{
public partial class DashBoard : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
public DashBoard()
{
InitializeComponent();
BindingContext = Mgr;
//Routing.RegisterRoute(nameof(DashBoard), typeof(DashBoard));
if (Mgr.User == null)
{
loadInscription();
}
}
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;
}
}
}

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

@ -1,14 +0,0 @@
<?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.GestionBanque"
MaximumWidthRequest="130"
HeightRequest="500"
Title="GestionBanque">
<VerticalStackLayout>
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentPage>

@ -1,9 +0,0 @@
namespace IHM;
public partial class GestionBanque : ContentPage
{
public GestionBanque()
{
InitializeComponent();
}
}

@ -32,9 +32,13 @@
<ItemGroup>
<!-- 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>
</MauiIcon>
</MauiImage>
<MauiImage Include="Resources\Images\AjoutBanques\import_from_file.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Include="Resources\Images\DashBoard\account_banks.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
@ -44,8 +48,12 @@
<MauiImage Include="Resources\Images\GestionBanques\reload_banks.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Include="Resources\Images\NavBar\dollar_black.png" />
<MauiImage Include="Resources\Images\NavBar\settings_black.png" />
<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" />
<!-- Splash Screen -->
@ -57,10 +65,10 @@
<MauiImage Update="Resources\Images\logo_sans_fond.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Update="Resources\Images\refresh.png">
<MauiImage Update="Resources\Images\logo_sans_fond_black.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Update="Resources\Images\logo_sans_fond_black.png">
<MauiImage Update="Resources\Images\refresh.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
@ -72,22 +80,23 @@
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Images\refresh.png" />
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Images\AjoutBanques\add_new_banks.png" />
<None Remove="Resources\Images\AjoutBanques\import_from_file.png" />
<None Remove="Resources\Images\DashBoard\account_banks.png" />
<None Remove="Resources\Images\GestionBanques\add_banks.png" />
<None Remove="Resources\Images\GestionBanques\reload_banks.png" />
<None Remove="Resources\Images\refresh.png" />
</ItemGroup>
<ItemGroup>
<MauiImage Include="Resources\Images\NavBar\planification_black.png" />
<MauiImage Include="Resources\Images\NavBar\planification_black.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
</ItemGroup>
<ItemGroup>
<MauiImage Include="Resources\Images\NavBar\home_black.png">
<CopyToOutputDirectory></CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
</ItemGroup>
@ -97,21 +106,6 @@
</ItemGroup>
<ItemGroup>
<Compile Update="AppShellDesktop.xaml.cs">
<DependentUpon>AppShellDesktop.xaml</DependentUpon>
</Compile>
<Compile Update="Desktop\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Update="Mobile\ErrorPage.xaml.cs">
<DependentUpon>ErrorPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<MauiXaml Update="AppShellDesktop.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="ChangePassword.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
@ -119,10 +113,6 @@
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="DashBoard.xaml">
<MauiXaml Update="Composant\BanqueDispo.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Composant\BanqueVC.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="ForgetPassword.xaml">
@ -134,15 +124,6 @@
<MauiXaml Update="NewPage1.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Mobile\AjoutBanques.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Mobile\ErrorPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Mobile\GestionBanques.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Operations.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
@ -155,9 +136,6 @@
<MauiXaml Update="Inscription.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Desktop\MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>
</Project>

@ -4,15 +4,79 @@
xmlns:composant="clr-namespace:IHM.Composant"
x:Class="IHM.Mobile.AjoutBanques"
Title="AjoutBanques">
<VerticalStackLayout>
<Label Text="Liste des Banques" FontAttributes="Bold" FontSize="Body" HorizontalOptions="Center"/>
<CollectionView>
<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"/>
</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>
<composant:BanqueDispo ImageBanque="bla.png" />
<!-- il faut le namespace !!!! -->
<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>
</VerticalStackLayout>
</Grid>
</ContentPage>

@ -1,9 +1,38 @@
using Model;
using System.Diagnostics;
namespace IHM.Mobile;
public partial class AjoutBanques : ContentPage
{
public AjoutBanques()
public Manager Mgr => (App.Current as App).Manager;
public AjoutBanques()
{
InitializeComponent();
BindingContext = Mgr;
Mgr.importBanques();
}
private async void ImportOFX_Clicked(object sender, EventArgs e)
{
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))
{
string file = File.ReadAllText(result.FullPath).ToString();
//return file;
}
}
else
{
throw new FileLoadException("Imposible de charger le fichier");
}
}
}

@ -90,11 +90,11 @@
FontAttributes="Bold"/>
<Label Grid.Row="0" Grid.Column="2"
Text="{Binding DateMaJ}"/>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</CollectionView>

@ -6,12 +6,12 @@ public partial class DashBoard : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
public DashBoard()
{
InitializeComponent();
{
InitializeComponent();
//Routing.RegisterRoute(nameof(DashBoard), typeof(DashBoard));
if (Mgr.SelectedInscrit == null)
if (Mgr.User == null)
{
loadPage(new MainPage());
@ -34,4 +34,4 @@ public partial class DashBoard : ContentPage
{
loadPage(new GestionBanques());
}
}
}

@ -23,19 +23,15 @@
<Label Text="Cons'Eco" FontSize="20" VerticalOptions="Center" FontAttributes="Bold"/>
</HorizontalStackLayout>
<ImageButton Grid.Row="0" Grid.Column="1" Source="add_banks.png"
<ImageButton Grid.Row="0" Grid.Column="2" Source="add_banks.png"
HorizontalOptions="End" Padding="10" Margin="10"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"/>
BackgroundColor="{StaticResource Primary}"
Clicked="AddBanque_Clicked"/>
<ImageButton Grid.Row="0" Grid.Column="2" Source="reload_banks.png"
HorizontalOptions="End" Padding="10" Margin="10"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"/>
<Label Grid.Row="1" Grid.ColumnSpan="3" Text="Liste des Banques disponibles : " FontAttributes="Bold" FontSize="Body" Padding="20,5,0,0"/>
<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 BanquesDisponibleInApp}">
<CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding User.LesBanques}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid>
@ -49,7 +45,7 @@
HorizontalOptions="Center"
VerticalOptions="Center"/>
<ImageButton Grid.Column="2" Source="reload_banks.png"
Padding="10" Margin="10"
Padding="10" Margin="5"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"/>

@ -11,7 +11,17 @@ public partial class GestionBanques : ContentPage
{
InitializeComponent();
BindingContext= Mgr;
//Mgr.importBanquesForUser(Mgr.SelectedInscrit);
Mgr.LoadBanques();
}
public async void loadPage(Page p)
{
await Navigation.PushModalAsync(p);
}
private void AddBanque_Clicked(object sender, EventArgs e)
{
loadPage(new AjoutBanques());
}
}

@ -2,100 +2,7 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Mobile.Operations">
<Grid>
<Grid.RowDefinitions>
<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>
<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 NomOpe}"
FontAttributes="Bold" />
<Label Grid.Row="1" Grid.Column="1"
Text="{Binding DetailTypeOpe}"
FontAttributes="Italic"/>
<Label Grid.Row="0" Grid.Column="2"
Text="{Binding DateOpe}"/>
<Label Grid.Row="0" Grid.Column="3" Grid.ColumnSpan="2"
Text="{Binding MontantOpe}"
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"/>
<Label Grid.Row="0" Grid.Column="2"
Text="{Binding DateMaJ}"/>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
<VerticalStackLayout>
</VerticalStackLayout>
</ContentPage>

@ -1,3 +1,5 @@
using Model;
namespace IHM.Mobile;
public partial class Operations : ContentPage
@ -7,31 +9,6 @@ public partial class Operations : ContentPage
{
InitializeComponent();
BindingContext = Mgr;
double test = Mgr.recupTotalSolde();
double i = test / 2000;
PrgressAnimationBar(i);
}
private void Button_Clicked(object sender, EventArgs e)
{
double test = Mgr.recupTotalSolde();
double i = test/2000;
PrgressAnimationBar(i);
UpdateArc();
}
private async void UpdateArc()
{
ActualisationButton.IsEnabled = false;
int timeRemaining = 60;
while (timeRemaining != 0)
{
timeRemaining--;
await Task.Delay(1000);
}
ActualisationButton.IsEnabled = true;
}
private async void PrgressAnimationBar(double progress)
{
await ProgressBarSolde.ProgressTo(0.75, 500, Easing.Linear);
}
}

@ -2,7 +2,7 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:IHM.Composant"
x:Class="IHM.DashBoard"
x:Class="IHM.Mobile.Planification"
BackgroundColor="#A00EE8">
<ScrollView VerticalOptions="FillAndExpand">
<VerticalStackLayout>

@ -1,9 +1,51 @@
using Model;
namespace IHM.Mobile;
public partial class Planification : ContentPage
{
public Planification()
public Manager Mgr => (App.Current as App).Manager;
public Planification()
{
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;
}
}

@ -22,7 +22,7 @@
<ImageButton
Grid.Column="1"
Source="Resources/Image/refresh.png"
Clicked="Button_Clicked"
Clicked="deconnexionOnClicked"
WidthRequest="35"
HeightRequest="35"
HorizontalOptions="End"

@ -3,4 +3,5 @@
<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.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

@ -6,7 +6,7 @@
<Color x:Key="Primary">#7FB196</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="Black">Black</Color>
<Color x:Key="Gray100">#E1E1E1</Color>

@ -1,50 +1,35 @@
namespace Model
using Microsoft.Maui.Graphics;
namespace Model
{
public class Compte
{
public string Identifiant { get; private set; }
public string Nom { get; private set; }
public double Solde { get; private set; }
public List<Operation> LesOpe { get; private set; } = new List<Operation>();
public List<Planification> LesPla { get; private set; } = new List<Planification>();
public List<Echeance> LesEch { get; private set; } = new List<Echeance>();
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<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;
Nom = nom;
Solde = solde;
LesOpe = new List<Operation>();
LesPla = new List<Planification>();
LesEch = new List<Echeance>();
DerniereModification = DateTime.Now;
}
public Compte(string id, string nom, double solde, List<Operation> lesOpe)
public Compte(string id, string nom, double solde, List<Operation> lesOpe) : base()
{
Identifiant = id;
Nom = nom;
Solde = solde;
LesOpe = lesOpe;
}
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, List<Planification> lesPla) : base()
{
Identifiant = id;
Nom = nom;
Solde = solde;
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, List<Echeance> lesEch) : base()
{
Identifiant = id;
Nom = nom;
Solde = solde;
LesOpe = lesOpe;
LesPla = lesPla;
LesEch = lesEch;
}
public void modifierSolde(double s)
{
Solde = s;
}
public void ajouterOperation(Operation o)
{
@ -91,6 +76,11 @@
{
return false;
}
else
{
Compte objCompte = (Compte) obj;
if(objCompte.Identifiant == Identifiant && objCompte.DerniereModification == DerniereModification) return true;
}
return base.Equals(obj);
}
@ -100,5 +90,10 @@
return base.GetHashCode();
}
public override string ToString()
{
return Identifiant + " " + Nom + " " + Solde + " " + DerniereModification + "\n";
}
}
}

@ -17,10 +17,9 @@ namespace Model
bool ExistEmail(string mail);
void ChangePasswordBdd(string mail, string newMdp);
string RecupMdpBdd(string mail);
bool TestConnexionAsDatabase();
public List<Banque> ImportBanques();
public List<Banque> ImportBanquesForUser(Inscrit i);
int CalculTotalSoldeComtpe(Inscrit user);
List<Banque> LoadBanqueId(string id);
public bool TestConnexionAsDatabase();
public List<Banque> ImportBanques();
}
}

@ -13,17 +13,17 @@ namespace Model
public Hash hash = new Hash();
public int Solde
public int Solde
{
get => solde;
set
{
if(solde != value)
if (solde != value)
{
solde = value;
OnPropertyChanged(nameof(Solde));
}
}
}
}
private int solde;
@ -31,8 +31,9 @@ namespace Model
private Inscrit user;
public Inscrit User {
public Inscrit User
{
get
{
return user;
@ -52,7 +53,7 @@ namespace Model
get => selectedBanque;
set
{
if(selectedBanque != value)
if (selectedBanque != value)
{
selectedBanque = value;
OnPropertyChanged(nameof(SelectedBanque));
@ -60,9 +61,8 @@ namespace Model
}
}
private Banque selectedBanque;
public List<Banque> BanquesDisponibleInApp
{
public List<Banque> BanquesDisponibleInApp
{
get => banquesDisponibleInApp;
set
{
@ -71,23 +71,9 @@ namespace Model
banquesDisponibleInApp = value;
OnPropertyChanged(nameof(BanquesDisponibleInApp));
}
}
}
private List<Banque> banquesDisponibleInApp;
public List<Banque> BanquesUser
{
get => banquesUser;
set
{
if (banquesUser != value)
{
banquesUser = value;
OnPropertyChanged(nameof(BanquesUser));
}
}
}
private List<Banque> banquesUser;
private List<Banque> banquesDisponibleInApp;
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
@ -103,7 +89,7 @@ namespace Model
public string GetId(string mail)
{
return Pers.GetId(mail);
return Pers.GetId(mail);
}
public void LoadBanques()
@ -114,7 +100,7 @@ namespace Model
SelectedBanque = User.LesBanques[0];
}
}
public void supprimerToutesBanquesBdd(Inscrit inscrit)
{
Pers.SupprimerToutesBanquesBdd(inscrit);
@ -150,37 +136,32 @@ namespace Model
return hash.IsEqualHash(mdpBdd, mdpSent);
}
public bool testConnexionAsDatabase()
public void createUser(string mail)
{
return Pers.TestConnexionAsDatabase();
User = new Inscrit(mail, GetId(mail));
}
public void importBanques()
public int recupTotalSolde()
{
BanquesDisponibleInApp = Pers.ImportBanques();
Solde = Pers.CalculTotalSoldeComtpe(User);
return Solde;
}
public void importBanquesForUser(Inscrit i)
public void deconnexion()
{
BanquesUser = Pers.ImportBanquesForUser(i);
User = null;
}
}
public void createUser(string mail)
{
User = new Inscrit(mail, GetId(mail));
}
public int recupTotalSolde()
public bool testConnexionAsDatabase()
{
Solde = Pers.CalculTotalSoldeComtpe(User);
return Solde;
return Pers.TestConnexionAsDatabase();
}
public void deconnexion()
public void importBanques()
{
User=null;
BanquesDisponibleInApp = Pers.ImportBanques();
}
}
}

@ -18,13 +18,10 @@ namespace Model
public MethodePayement ModePayement { get; private set; }
public bool IsDebit { get; private set; }
public string IdCompte { get; private set; }
public Operation(string intituleOperation, string idCompte, double montant, DateTime dateOperation, MethodePayement modePayement, bool isDebit=true)
public Operation(string intituleOperation, double montant, DateTime dateOperation, MethodePayement modePayement, bool isDebit=true)
{
IntituleOperation = intituleOperation;
IdCompte = idCompte;
Montant = montant;
DateOperation = dateOperation;
ModePayement = modePayement;
@ -33,7 +30,7 @@ namespace Model
public override string ToString()
{
return IdCompte + " " + IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + "\n";
return IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + "\n";
}
}
}

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

File diff suppressed because it is too large Load Diff

@ -3,14 +3,17 @@ using Model;
Console.WriteLine("Test Deserializer OFX - simplifié");
IList<Operation> operations= new List<Operation>();
operations.Add(new Operation("OpeDeTest", "01234567890", 100, DateTime.Now, MethodePayement.Esp, true));
IList<Compte> comptes= new List<Compte>();
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);
}
}

@ -68,6 +68,6 @@ namespace TestsUnitaires
Assert.Equal(tc, test2.ReturnCompte("Livret A"));
}
*/
}
}

@ -10,7 +10,7 @@ namespace TestsUnitaires
public class TestUnitCompte
{
/* [Fact]
[Fact]
public void TestConstructeurCompte()
{
Compte c1 = new("012345678901", "Livret A", 234);
@ -32,6 +32,6 @@ namespace TestsUnitaires
i1.SupprimerBanque(bq);
Assert.DoesNotContain(bq, i1.LesBanques);
}
*/
}
}

Loading…
Cancel
Save