premier ajout de la page opérations
continuous-integration/drone/push Build is passing Details

UI_Mobile
Vincent ASTOLFI 2 years ago
parent 708400876c
commit d4de3b9a20

@ -149,6 +149,35 @@ namespace LinqToPgSQL
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)
{
var conn = new NpgsqlConnection(connexionBDD);

@ -46,6 +46,9 @@
<MauiImage Update="Resources\Images\logo_sans_fond.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<MauiImage Update="Resources\Images\refresh.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiImage>
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
@ -54,6 +57,10 @@
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Images\refresh.png" />
</ItemGroup>
<ItemGroup>
<MauiImage Include="Resources\Images\NavBar\planification_black.png" />
</ItemGroup>

@ -27,6 +27,7 @@ namespace IHM
if (Mgr.isEqualHash(Mgr.recupMdpBdd(EntryMail.Text), EntryPassworld.Text))
{
Mgr.LoadInscrit(EntryMail.Text, EntryPassworld.Text);
Mgr.createUser(EntryMail.Text);
ConnexionValide();
}
else

@ -3,9 +3,59 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Operations">
<VerticalStackLayout>
<Grid BackgroundColor="{AppThemeBinding Light={StaticResource Gray600}, Dark={StaticResource Gray100}}">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label
Text="Operations"
VerticalOptions="Center"
HorizontalOptions="Center" />
HorizontalOptions="End"
Margin="10"
TextColor="{AppThemeBinding Light={StaticResource Gray100}, Dark={StaticResource Gray600}}"
FontSize="20"
FontAttributes="Bold"
/>
<ImageButton
Grid.Column="1"
Source="Resources/Image/refresh.png"
Clicked="Button_Clicked"
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"/>
</VerticalStackLayout>
</ContentPage>

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

@ -17,5 +17,6 @@ namespace Model
bool ExistEmail(string mail);
void ChangePasswordBdd(string mail, string newMdp);
string RecupMdpBdd(string mail);
int CalculTotalSoldeComtpe(Inscrit user);
}
}

@ -77,6 +77,11 @@ namespace Model
LesBanques = lesbanques;
}
public Inscrit(string mail)
{
Mail = mail;
}
public void ajouterBanque(Banque banque)

@ -11,6 +11,23 @@ namespace Model
public Hash hash = new Hash();
public int Solde
{
get => solde;
set
{
if(solde != value)
{
solde = value;
OnPropertyChanged(nameof(Solde));
}
}
}
private int solde;
public Inscrit User { get; set; }
public Banque SelectedBanque
{
get => selectedBanque;
@ -19,7 +36,7 @@ namespace Model
if(selectedBanque != value)
{
selectedBanque = value;
OnPropertyChanged(nameof(selectedBanque));
OnPropertyChanged(nameof(SelectedBanque));
}
}
}
@ -29,6 +46,7 @@ namespace Model
public Manager(IPersistanceManager persistance)
{
Solde = 20;
Pers = persistance;
}
@ -76,6 +94,17 @@ namespace Model
{
return hash.IsEqualHash(mdpBdd, mdpSent);
}
public void createUser(string mail)
{
User = new Inscrit(mail);
}
public int recupTotalSolde()
{
Solde = Pers.CalculTotalSoldeComtpe(User);
return Solde;
}
}
}

@ -16,7 +16,7 @@ namespace Model
// ajouter load all pour tout les inscrits
/* public List<Inscrit> LoadInscrit()
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()));
@ -26,19 +26,21 @@ namespace Model
Inscrits.Add(new("00006", "March", "march@gmail.com", "bastien", "test", 1120,LoadBanques()));
return Inscrits;
}
public List<Banque> LoadBanques()
{
Banques.Add(new("BNP Paribas", "https://mabanque.bnpparibas/", "https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png",LoadCompte()));
Banques.Add(new("Crédit Agricole", "https://www.credit-agricole.fr", "https://yt3.ggpht.com/a/AGF-l7_mEfX2eQaGm8GefLOg5ZMRciNw-pESE3gUWg=s900-c-k-c0xffffffff-no-rj-mo",LoadCompte()));
return Banques;
}
public List<Compte> LoadCompte()
{
Comptes.Add(new("Livret A", 1500));
Comptes.Add(new("Compte Courant", 2000));
Comptes.Add(new("PEL", 22000));
Comptes.Add(new("1","Livret A", 1500));
Comptes.Add(new("2","Compte Courant", 2000));
Comptes.Add(new("3","PEL", 22000));
return Comptes;
}*/
}
}

Loading…
Cancel
Save