Push bind banques
continuous-integration/drone/push Build is failing Details

ManagerRefactoring
Hugo LIVET 2 years ago
parent 1499d68d98
commit 16e266e8e6

@ -66,7 +66,8 @@
<ImageButton Grid.Column="2" Source="add_new_banks.png" <ImageButton Grid.Column="2" Source="add_new_banks.png"
Padding="10" Margin="5" Padding="10" Margin="5"
CornerRadius="10" HeightRequest="65" CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"/> BackgroundColor="{StaticResource Primary}"
Clicked="AddBanque_Clicked"/>
</Grid> </Grid>

@ -11,7 +11,7 @@ public partial class AjoutBanques : ContentPage
{ {
InitializeComponent(); InitializeComponent();
BindingContext = Mgr; BindingContext = Mgr;
//Mgr.importBanques(); Mgr.LoadBanques();
if (OperatingSystem.IsIOS()) if (OperatingSystem.IsIOS())
{ {
boutonRetour.IsVisible = true; boutonRetour.IsVisible = true;
@ -33,7 +33,11 @@ public partial class AjoutBanques : ContentPage
Debug.WriteLine(lesComptes.Count); Debug.WriteLine(lesComptes.Count);
foreach(Compte compte in lesComptes) foreach(Compte compte in lesComptes)
{ {
Mgr.User.LesBanques.First().AjouterCompte(compte); if(Mgr.User.LesBanques.Count != 0)
{
Mgr.User.LesBanques.First().AjouterCompte(compte);
}
} }
} }
@ -54,5 +58,21 @@ public partial class AjoutBanques : ContentPage
{ {
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
} }
private async void AddBanque_Clicked(object sender, EventArgs e)
{
ImageButton imageButton = (ImageButton)sender;
Grid grid = (Grid)imageButton.Parent;
foreach(IView iw in grid.Children)
{
if (iw.GetType() == typeof(Label))
{
await Mgr.Pers.AjouterBanque((Banque)(iw as Label).BindingContext, Mgr.User);
}
}
Mgr.User.LesBanques = await Mgr.Pers.RecupererBanques(Mgr.User);
await Navigation.PopModalAsync();
}
} }

@ -26,7 +26,7 @@ namespace IHM.Mobile
if (Mgr.CompareHash(await Mgr.getPassword(EntryMail.Text), EntryPassworld.Text)) if (Mgr.CompareHash(await Mgr.getPassword(EntryMail.Text), EntryPassworld.Text))
{ {
Mgr.createUser(EntryMail.Text); Mgr.createUser(EntryMail.Text);
ConnexionValide(); await Navigation.PopModalAsync();
} }
else else
{ {
@ -40,12 +40,6 @@ namespace IHM.Mobile
} }
} }
private async void ConnexionValide()
{
//Mgr.LoadBanques();
await Navigation.PopModalAsync();
}
private async void AffichError(string s, string s1, string s2) private async void AffichError(string s, string s1, string s2)
{ {
await DisplayAlert(s, s1, s2); await DisplayAlert(s, s1, s2);

@ -3,8 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Mobile.Operations"> x:Class="IHM.Mobile.Operations">
<VerticalStackLayout> <VerticalStackLayout>
<CollectionView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding User.LesBanques[0].ListeDesComptes[0].LesOpe}"> <ListView Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding User.LesBanques[0].ListeDesComptes[0].LesOpe}">
<CollectionView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid Padding="10" > <Grid Padding="10" >
<Grid.RowDefinitions> <Grid.RowDefinitions>
@ -34,7 +34,7 @@
FontAttributes="Bold"/> FontAttributes="Bold"/>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </ListView.ItemTemplate>
</CollectionView> </ListView>
</VerticalStackLayout> </VerticalStackLayout>
</ContentPage> </ContentPage>

@ -36,11 +36,8 @@ namespace Model
UrlLogo = urlLogo; UrlLogo = urlLogo;
} }
public Banque(string nom, string urlSite, string urlLogo, List<Compte> lescomptes) public Banque(string nom, string urlSite, string urlLogo, List<Compte> lescomptes) : this(nom,urlSite, urlLogo)
{ {
Nom = nom;
UrlSite = urlSite;
UrlLogo = urlLogo;
ListeDesComptes = lescomptes; ListeDesComptes = lescomptes;
} }

@ -64,7 +64,7 @@ namespace Model
public double SoldeTotal { get; private set; } public double SoldeTotal { get; private set; }
public Devises Dev { get; private set; } public Devises Dev { get; private set; }
public List<Banque> LesBanques public IList<Banque> LesBanques
{ {
get => lesBanques; get => lesBanques;
set set
@ -77,7 +77,7 @@ namespace Model
} }
} }
private List<Banque> lesBanques; private IList<Banque> lesBanques;
[JsonConstructor] [JsonConstructor]
public Inscrit(int id, string nom, string mail, string prenom, string mdp, double soldeTotal = 0) public Inscrit(int id, string nom, string mail, string prenom, string mdp, double soldeTotal = 0)
@ -88,7 +88,7 @@ namespace Model
Prenom = prenom; Prenom = prenom;
Mdp = mdp; Mdp = mdp;
SoldeTotal = soldeTotal; SoldeTotal = soldeTotal;
lesBanques = new(); lesBanques = new List<Banque>();
} }
public Inscrit(int id, string nom, string mail, string prenom, string mdp, double soldeTotal, List<Banque> lesbanques) public Inscrit(int id, string nom, string mail, string prenom, string mdp, double soldeTotal, List<Banque> lesbanques)
: this(id, nom, mail, prenom, mdp, soldeTotal) : this(id, nom, mail, prenom, mdp, soldeTotal)

@ -9,8 +9,6 @@ namespace Model
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
public IPersistanceManager Pers { get; private set; } public IPersistanceManager Pers { get; private set; }
public int SelectedInscrit { get; set; }
private Inscrit user; private Inscrit user;
public Inscrit User public Inscrit User
{ {
@ -75,6 +73,7 @@ namespace Model
public async void LoadBanques() public async void LoadBanques()
{ {
User.LesBanques = await Pers.RecupererBanques(User);
BanquesDisponibleInApp = await Pers.RecupererBanquesDisponible(); BanquesDisponibleInApp = await Pers.RecupererBanquesDisponible();
} }

Loading…
Cancel
Save