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"
Padding="10" Margin="5"
CornerRadius="10" HeightRequest="65"
BackgroundColor="{StaticResource Primary}"/>
BackgroundColor="{StaticResource Primary}"
Clicked="AddBanque_Clicked"/>
</Grid>

@ -11,7 +11,7 @@ public partial class AjoutBanques : ContentPage
{
InitializeComponent();
BindingContext = Mgr;
//Mgr.importBanques();
Mgr.LoadBanques();
if (OperatingSystem.IsIOS())
{
boutonRetour.IsVisible = true;
@ -33,7 +33,11 @@ public partial class AjoutBanques : ContentPage
Debug.WriteLine(lesComptes.Count);
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();
}
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))
{
Mgr.createUser(EntryMail.Text);
ConnexionValide();
await Navigation.PopModalAsync();
}
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)
{
await DisplayAlert(s, s1, s2);

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

@ -36,11 +36,8 @@ namespace Model
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;
}

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

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

Loading…
Cancel
Save