Gestion Banques presque oke
continuous-integration/drone/push Build is passing Details

GestionBanques
Hugo LIVET 2 years ago
parent 5c5ac6637d
commit 55d1fd1b28

@ -360,9 +360,9 @@ namespace LinqToPgSQL
// attente des autres supression
}
public IList<Banque> ImportBanques()
public List<Banque> ImportBanques()
{
IList<Banque> bquesDispo = new List<Banque>();
List<Banque> bquesDispo = new List<Banque>();
dbAccess.Open();
NpgsqlCommand cmd = new NpgsqlCommand($"SELECT * FROM Banque", dbAccess);
@ -375,6 +375,22 @@ 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;
}
}
}

@ -38,6 +38,9 @@
<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>
@ -67,6 +70,7 @@
<ItemGroup>
<None Remove="Resources\Images\DashBoard\account_banks.png" />
<None Remove="Resources\Images\GestionBanques\add_banks.png" />
<None Remove="Resources\Images\GestionBanques\reload_banks.png" />
</ItemGroup>

@ -13,7 +13,7 @@
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="1.95*"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
@ -23,7 +23,7 @@
<Label Text="Cons'Eco" FontSize="20" VerticalOptions="Center" FontAttributes="Bold"/>
</HorizontalStackLayout>
<ImageButton Grid.Row="0" Grid.Column="1" Source="reload_banks.png"
<ImageButton Grid.Row="0" Grid.Column="1" Source="add_banks.png"
HorizontalOptions="End" Padding="10" Margin="10"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"/>
@ -38,7 +38,25 @@
<CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding BanquesDisponibleInApp}">
<CollectionView.ItemTemplate>
<DataTemplate>
<composant:BanqueVC NomBanque="{Binding Nom}" DateLastReload="12/12/2003" /><!-- 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="reload_banks.png"
Padding="10" Margin="10"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"/>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>

@ -1,4 +1,5 @@
using Model;
using System.Collections.ObjectModel;
namespace IHM.Mobile;
@ -10,7 +11,7 @@ public partial class GestionBanques : ContentPage
{
InitializeComponent();
BindingContext= Mgr;
//Mgr.BanquesDisponibleInApp=Mgr.importBanques();
//Mgr.importBanquesForUser(Mgr.SelectedInscrit);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

@ -41,4 +41,5 @@
<Color x:Key="Blue200Accent">#72ACF1</Color>
<Color x:Key="Blue300Accent">#A7CBF6</Color>
</ResourceDictionary>

@ -18,6 +18,7 @@ namespace Model
void ChangePasswordBdd(string mail, string newMdp);
string RecupMdpBdd(string mail);
bool TestConnexionAsDatabase();
public IList<Banque> ImportBanques();
public List<Banque> ImportBanques();
public List<Banque> ImportBanquesForUser(Inscrit i);
}
}

@ -26,7 +26,33 @@ namespace Model
}
private Banque selectedBanque;
public ObservableCollection<Banque> BanquesDisponibleInApp { get; set; } = new ObservableCollection<Banque>();
public List<Banque> BanquesDisponibleInApp
{
get => banquesDisponibleInApp;
set
{
if (banquesDisponibleInApp != value)
{
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;
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
@ -85,10 +111,16 @@ namespace Model
return Pers.TestConnexionAsDatabase();
}
public IList<Banque> importBanques()
public void importBanques()
{
return Pers.ImportBanques();
BanquesDisponibleInApp = Pers.ImportBanques();
}
public void importBanquesForUser(Inscrit i)
{
BanquesUser = Pers.ImportBanquesForUser(i);
}
}
}

Loading…
Cancel
Save