Merge pull request 'Dashboard' (#113) from Dashboard into master
continuous-integration/drone/push Build is passing Details

Reviewed-on: hugo.livet/ConsEco#113
modifStub
Vincent ASTOLFI 2 years ago
commit b0fed8ff57

@ -0,0 +1,132 @@
using Model;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Formats.Asn1;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;
namespace Data
{
public class LoadOperation
{
public static IList<Operation> LoadOperationsFromOFX(string csv)
{
//liste des opérations d'un compte
IList<Operation> lesOpe = new List<Operation>();
//détail d'une Operation
string intituleOperation;
double montant;
DateTime dateOperation;
MethodePayement modePayement;
bool isDebit;
//info compte
string identifiantCompte="";
double solde=0;
using (StreamReader reader = new StreamReader(csv))
{
if (reader != null)
{
string row;
while ((row = reader.ReadLine()) != null)
{
if (row.Contains("<CURDEF>"))
{
row = "";
}
else if (row.Contains("<ACCTID>"))
{
identifiantCompte = CutRow(row).Last();
}
else if (row.Contains("<BALAMT>"))
{
solde = Convert.ToDouble(GetValueInRow(row, 4));
}
else if (row.Contains("<STMTTRN>"))
{
row = "";
intituleOperation = "";
montant = 0;
dateOperation = new DateTime();
modePayement = MethodePayement.None;
isDebit = false;
while ((row = reader.ReadLine()) != "</STMTTRN>")
{
if (row.Contains("<DTPOSTED>"))
{
DateTime.TryParseExact(CutRow(row).Last(), "yyyyMMdd", null, DateTimeStyles.None, out dateOperation);
}
else if (row.Contains("<TRNAMT>"))
{
montant = double.Parse(CutRow(row).Last(), CultureInfo.InvariantCulture);
if (montant < 0)
{
isDebit = true;
montant = Math.Abs(montant);
}
}
else if (row.Contains("<NAME>"))
{
intituleOperation = CutRow(row).Last();
}
else if (row.Contains("<MEMO>"))
{
if (row.Contains("PAIEMENT"))
{
modePayement = MethodePayement.Cb;
}
else
{
modePayement = MethodePayement.None;
}
}
else
{
row = "";
}
}
lesOpe.Add(new Operation(intituleOperation, identifiantCompte, montant, dateOperation, modePayement, isDebit));
}
else
{
row = "";
}
}
}
}
return lesOpe;
}
public static string[] CutRow(string row)
{
string[] cutRow;
if (row == null) throw new ArgumentNullException();
cutRow = row.Split('>');
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();
}
}
}

@ -243,7 +243,7 @@ namespace LinqToPgSQL
while (dbReader.Read())
{
ListeCompte.Add(new Compte(dbReader.GetString(0), dbReader.GetInt64(1)));
ListeCompte.Add(new Compte("NULL",dbReader.GetString(0), dbReader.GetInt64(1)));//a patch NULL
}
dbReader.Close();
return ListeCompte;

@ -13,6 +13,8 @@ namespace IHM
Routing.RegisterRoute("Inscription", typeof(Inscription));
Routing.RegisterRoute("ForgetPassword", typeof(ForgetPassword));
Routing.RegisterRoute("ChangePassword", typeof(ChangePassword));
}

@ -2,10 +2,100 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.DashBoard">
<VerticalStackLayout>
<Label
Text="Dashboard"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
<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>
</ContentPage>

@ -32,7 +32,10 @@
<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" Color="#512BD4" BaseSize="2000,2000">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiIcon>
<MauiImage Include="Resources\Images\DashBoard\account_banks.png" />
<MauiImage Include="Resources\Images\NavBar\dollar_black.png" />
<MauiImage Include="Resources\Images\NavBar\settings_black.png" />
<Resource Include="Resources\Images\NavBar\home_black.png" />
@ -46,6 +49,9 @@
<MauiImage Update="Resources\Images\logo_sans_fond.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Update="Resources\Images\logo_sans_fond_black.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
@ -54,6 +60,10 @@
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Images\DashBoard\account_banks.png" />
</ItemGroup>
<ItemGroup>
<MauiImage Include="Resources\Images\NavBar\planification_black.png" />
</ItemGroup>

@ -10,26 +10,27 @@
VerticalOptions="Start">
<Label
Margin="0,20,-80,0"
Margin="0,20,0,30"
HorizontalOptions="Center"
FontAttributes="Bold"
Text="Welcome To Cons'Eco"
FontSize="30"/>
<Image Source="Resources/Images/logo_sans_fond.png"
HorizontalOptions="Center"
Scale="0.5"/>
<Image Source="{AppThemeBinding Light=Resources/Images/logo_sans_fond_black.png, Dark=Resources/Images/logo_sans_fond.png}"
HorizontalOptions="Center" HeightRequest="200"/>
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7">
<Entry BackgroundColor="White"
TextColor="Black"
<Border StrokeShape="RoundRectangle 20" BackgroundColor="White" Padding="7">
<Entry BackgroundColor="{StaticResource White}"
TextColor="{StaticResource Black}"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="Addresse mail"
x:Name="EntryMail"/>
</Border>
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7">
<Entry BackgroundColor="White"
TextColor="Black"
<Border StrokeShape="RoundRectangle 20" BackgroundColor="White" Padding="7">
<Entry BackgroundColor="{StaticResource White}"
TextColor="{StaticResource Black}"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="Mot de passe"
@ -45,8 +46,8 @@
HorizontalOptions="Center" />
<Label
Text="Mot de passe oublier "
TextColor="Blue"
Text="Mot de passe oublié ?"
TextColor="{StaticResource Primary}"
Margin="5,0,0,0"
TextDecorations="Underline"
HorizontalOptions="Center">
@ -64,7 +65,7 @@
<Label
Text="S'inscrire"
TextColor="Blue"
TextColor="{StaticResource Primary}"
Margin="5,0,0,0"
TextDecorations="Underline">
<Label.GestureRecognizers>

@ -1,7 +1,4 @@
 using Android.Bluetooth;
using AndroidX.Emoji2.Text.FlatBuffer;
using Microsoft.Maui.Controls;
using Model;
using Model;
using System.Windows.Input;
namespace IHM

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

@ -4,9 +4,9 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<Color x:Key="Primary">#512BD4</Color>
<Color x:Key="Secondary">#DFD8F7</Color>
<Color x:Key="Tertiary">#2B0B98</Color>
<Color x:Key="Primary">#7FB196</Color>
<Color x:Key="Secondary">#3C425A</Color>
<Color x:Key="Tertiary">#DF775C</Color>
<Color x:Key="White">White</Color>
<Color x:Key="Black">Black</Color>
<Color x:Key="Gray100">#E1E1E1</Color>

@ -24,8 +24,8 @@
</Style>
<Style TargetType="Button">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Primary}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource Black}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource Primary}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="CornerRadius" Value="8"/>
@ -118,6 +118,7 @@
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
</Style>
<Style TargetType="Frame">
@ -352,7 +353,7 @@
<Style TargetType="Page" ApplyToDerivedTypes="True">
<Setter Property="Padding" Value="0"/>
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Secondary}}" />
</Style>
<Style TargetType="Shell" ApplyToDerivedTypes="True">
@ -362,9 +363,9 @@
<Setter Property="Shell.DisabledColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
<Setter Property="Shell.UnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray200}}" />
<Setter Property="Shell.NavBarHasShadow" Value="False" />
<Setter Property="Shell.TabBarBackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
<Setter Property="Shell.TabBarBackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Secondary}}" />
<Setter Property="Shell.TabBarForegroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="Shell.TabBarTitleColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="Shell.TabBarTitleColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource Primary}}" />
<Setter Property="Shell.TabBarUnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
</Style>

@ -2,34 +2,39 @@
{
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 Compte(string nom, double solde)
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>();
}
public Compte(string nom, double solde, List<Operation> lesOpe)
public Compte(string id, string nom, double solde, List<Operation> lesOpe)
{
Identifiant = id;
Nom = nom;
Solde = solde;
LesOpe = lesOpe;
}
public Compte(string nom, double solde, List<Operation> lesOpe, List<Planification> lesPla)
public Compte(string id, string nom, double solde, List<Operation> lesOpe, List<Planification> lesPla)
{
Identifiant = id;
Nom = nom;
Solde = solde;
LesOpe = lesOpe;
LesPla = lesPla;
}
public Compte(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)
{
Identifiant = id;
Nom = nom;
Solde = solde;
LesOpe = lesOpe;

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public enum MethodePayement
{
None,
Cb,
Esp,
Chq,
Vir
}
}

@ -8,5 +8,32 @@ namespace Model
{
public class Operation
{
public string IntituleOperation { get; private set; }
public double Montant { get; private set; }
public DateTime DateOperation { get; private set; }
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)
{
IntituleOperation = intituleOperation;
IdCompte = idCompte;
Montant = montant;
DateOperation = dateOperation;
ModePayement = modePayement;
IsDebit = isDebit;
}
public override string ToString()
{
return IdCompte + " " + IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + "\n";
}
}
}

@ -34,9 +34,9 @@ namespace Model
}
public List<Compte> LoadCompte()
{
Comptes.Add(new("Livret A", 1500));
Comptes.Add(new("Compte Courant", 2000));
Comptes.Add(new("PEL", 22000));
Comptes.Add(new("012345678901", "Livret A", 1500));
Comptes.Add(new("012345678902", "Compte Courant", 2000));
Comptes.Add(new("012345678903", "PEL", 22000));
return Comptes;
}

@ -0,0 +1,56 @@
OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE
<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>
<DTSERVER>blabla
<LANGUAGE>FRA
</SONRS>
</SIGNONMSGSRSV1>
<BANKMSGSRSV1>
<STMTTRNRS>
<TRNUID>01234567890
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>
<STMTRS>
<CURDEF>EUR
<BANKACCTFROM>
<BANKID>14506
<BRANCHID>00034
<ACCTID>01234567890
<ACCTTYPE>CHECKING
</BANKACCTFROM>
<BANKTRANLIST>
<DTSTART>20211101000000
<DTEND>20221113235959
<STMTTRN>
<TRNTYPE>OTHER
<DTPOSTED>20221109
<TRNAMT>-4.99
<FITID>6402010009369
<NAME>X8476 Spotify France PARIS 08/11
<MEMO>PAIEMENT PAR CARTE X8476 Spotify France PARIS 08/11
</STMTTRN>
<STMTTRN>
<TRNTYPE>OTHER
<DTPOSTED>20221109
<TRNAMT>-3.47
<FITID>6402010009368
<NAME>X8476 ROYALCDKEYS.COM TSIM 09/11
<MEMO>PAIEMENT PAR CARTE X8476 ROYALCDKEYS.COM TSIM 09/11
</STMTTRN>

@ -1,2 +1,16 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
using Data;
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));
operations = LoadOperation.LoadOperationsFromOFX("C:\\Dev\\ConsEcoAndMAUI\\Sources\\TestFonctionnel\\CA_simplifié.ofx");
foreach (Operation op in operations)
{
Console.WriteLine(op);
}

@ -7,4 +7,9 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Data\Data.csproj" />
<ProjectReference Include="..\Modele\Model.csproj" />
</ItemGroup>
</Project>

@ -7,4 +7,9 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Data\Data_CI.csproj" />
<ProjectReference Include="..\Modele\Model_CI.csproj" />
</ItemGroup>
</Project>

@ -9,7 +9,7 @@ namespace TestsUnitaires
{
public class TestUnitBanque
{
Compte tc = new("Livret A", 16956);
Compte tc = new("012345678901", "Livret A", 16956);
Banque test = new("BNP Paribas", "https://mabanque.bnpparibas/", "https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png");
[Fact]
public void testConstructeur1()

@ -13,8 +13,8 @@ namespace TestsUnitaires
[Fact]
public void TestConstructeurCompte()
{
Compte c1 = new("Livret A", 234);
Compte c2 = new("&e23R_te7", 1245.34);
Compte c1 = new("012345678901", "Livret A", 234);
Compte c2 = new("012345678902", "&e23R_te7", 1245.34);
Assert.Equal("Livret A", c1.Nom);
Assert.Equal("&e23R_te7", c2.Nom);
Assert.Equal(234, c1.Solde);

Loading…
Cancel
Save