Merge branch 'Binding' of https://codefirst.iut.uca.fr/git/ConsEcoTeam/ConsEco into Binding
continuous-integration/drone/push Build was killed Details

pull/143/head
Nicolas MAYE 2 years ago
commit d2cc90c555

@ -45,7 +45,7 @@ $app->get('/Banque/', function(Request $request, Response $response){
$app->post('/Banque/FromId/', function(Request $request, Response $response,array $args){
$id = $request->getParsedBody()["id"];
$query = 'SELECT * FROM Banque WHERE nom IN (SELECT nomBanque FROM InscrBanque WHERE idInscrit=:id)';
$query = 'SELECT id, nomBanque FROM InscrBanque WHERE idInscrit=:id';
try{
$db = new Database();

@ -155,14 +155,14 @@ namespace Data
}
}
public static async Task<List<Banque>> GetBanqueAsync(string id)
public static async Task<List<BanqueInscrit>> GetBanqueAsync(string id)
{
var dataBody = new Dictionary<string, string> { { "id", id } };
HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_BANQUES_INSCRIT_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<List<Banque>>(await reponse.Content.ReadAsStringAsync());
return JsonConvert.DeserializeObject<List<BanqueInscrit>>(await reponse.Content.ReadAsStringAsync());
}
else
{
@ -357,7 +357,7 @@ namespace Data
var dataBody = new Dictionary<string, string>
{
{ "compte", compte.Identifiant },
{ "nom", planification.IntituleOperation },
{ "nom", planification.Nom },
{ "montant", planification.Montant.ToString() },
{ "dateO", planification.DateOperation.ToString() },
{ "methodePayement", planification.ModePayement.ToString() },

@ -56,7 +56,7 @@ namespace Data
{
return await ClientAPI.DeleteBanqueInscritAsync(banque.Nom, inscrit.Id.ToString());
}
public async Task<IList<Banque>> RecupererBanques(Inscrit inscrit)
public async Task<IList<BanqueInscrit>> RecupererBanques(Inscrit inscrit)
{
return await ClientAPI.GetBanqueAsync(inscrit.Id.ToString());
}
@ -75,9 +75,9 @@ namespace Data
{
return await ClientAPI.DeleteCompteInscritAsync(compte.Nom, inscrit.Id.ToString());
}
public async Task<IList<Compte>> RecupererCompte(Banque banque, Inscrit inscrit)
public async Task<IList<Compte>> RecupererCompte(BanqueInscrit banque)
{
return await ClientAPI.GetCompteAsync(inscrit.Id.ToString());
return await ClientAPI.GetCompteAsync(banque.Id.ToString());
}
@ -103,7 +103,7 @@ namespace Data
}
public async Task<bool> SupprimerPlanification(Compte compte, Planification planification)
{
return await ClientAPI.DeletePlanificationInscritAsync(compte.Identifiant, planification.IntituleOperation);
return await ClientAPI.DeletePlanificationInscritAsync(compte.Identifiant, planification.Nom);
}
public async Task<IList<Planification>> RecupererPlanification(Compte compte)
{

@ -201,7 +201,7 @@ namespace Data
throw new NotImplementedException();
}
public Task<IList<Banque>> RecupererBanques(Inscrit inscrit)
public Task<IList<BanqueInscrit>> RecupererBanques(Inscrit inscrit)
{
throw new NotImplementedException();
}
@ -211,7 +211,7 @@ namespace Data
throw new NotImplementedException();
}
public Task<IList<Compte>> RecupererCompte(Banque banque, Inscrit inscrit)
public Task<IList<Compte>> RecupererCompte(BanqueInscrit banque)
{
throw new NotImplementedException();
}

@ -84,7 +84,7 @@
<Label Grid.Column="0" Text="{Binding IntituleOperation}"
<Label Grid.Column="0" Text="{Binding Nom}"
TextColor="{StaticResource Secondary}"
FontAttributes="Bold" FontSize="Body"
HorizontalOptions="Center"

@ -14,9 +14,9 @@ public partial class CV_Planification : ContentView
{
InitializeComponent();
/* Mgr.LoadBanque();
Mgr.LoadBanque();
Mgr.LoadCompte();
*/
BindingContext = Mgr;
}

@ -11,7 +11,7 @@ public partial class AjoutBanques : ContentPage
{
InitializeComponent();
BindingContext = Mgr;
Mgr.LoadBanques();
//Mgr.LoadBanques();
if (OperatingSystem.IsIOS())
{
boutonRetour.IsVisible = true;
@ -71,7 +71,7 @@ public partial class AjoutBanques : ContentPage
}
}
Mgr.User.LesBanques = await Mgr.Pers.RecupererBanques(Mgr.User);
//Mgr.User.LesBanques = await Mgr.Pers.RecupererBanques(Mgr.User);
await Navigation.PopModalAsync();
}
}

@ -11,7 +11,7 @@ public partial class GestionBanques : ContentPage
{
InitializeComponent();
BindingContext= Mgr;
Mgr.LoadBanques();
//Mgr.LoadBanques();
if (OperatingSystem.IsIOS())
{
boutonRetour.IsVisible = true;

@ -28,7 +28,7 @@ namespace IHM.Mobile
Mgr.createUser(EntryMail.Text);
await Navigation.PopModalAsync();
Mgr.LoadBanques();
//Mgr.LoadBanques();
}
else
{

@ -11,6 +11,7 @@ namespace Model
public class Banque : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public string Nom { get; private set; }
/// <summary>
@ -49,10 +50,10 @@ namespace Model
ListeDesComptes = lescomptes;
}
/* public Banque()
{
}
*/
/* public Banque()
{
}
*/
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public void AjouterCompte(Compte compte)
{

@ -0,0 +1,27 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class BanqueInscrit
{
public int Id { get; private set; }
public string Name { get; private set; }
[JsonConstructor]
public BanqueInscrit(int id, string name)
{
Id = id;
Name = name;
}
public override string ToString()
{
return Id + " " + Name;
}
}
}

@ -22,14 +22,14 @@ namespace Model
//actions sur les banques
Task<bool> AjouterBanque(Banque banque, Inscrit inscrit);
Task<bool> SupprimerBanque(Banque banque, Inscrit inscrit);
Task<IList<Banque>> RecupererBanques(Inscrit inscrit);
Task<IList<BanqueInscrit>> RecupererBanques(Inscrit inscrit);
Task<IList<Banque>> RecupererBanquesDisponible();
//actions sur les comptes
Task<bool> AjouterCompte(Compte compte, Inscrit inscrit);
Task<bool> SupprimerCompte(Compte compte, Inscrit inscrit);
Task<IList<Compte>> RecupererCompte(Banque banque, Inscrit inscrit);
Task<IList<Compte>> RecupererCompte(BanqueInscrit banque);
//actions sur les Opérations

@ -26,13 +26,13 @@ namespace Model
{
user = value;
OnPropertyChanged(nameof(User));
LoadBanque();
}
}
}
private Inscrit user;
public Banque SelectedBanque
public BanqueInscrit SelectedBanque
{
get => selectedBanque;
set
@ -44,8 +44,7 @@ namespace Model
}
}
}
private Banque selectedBanque;
private BanqueInscrit selectedBanque;
public IList<Banque> BanquesDisponibleInApp
{
get => banquesDisponibleInApp;
@ -77,8 +76,8 @@ namespace Model
private Compte selectedCompte;
private IList<Banque> listeDesBanques = new List<Banque>();
public ReadOnlyCollection<Banque> AllBanque { get; private set; }
private IList<BanqueInscrit> listeDesBanques = new List<BanqueInscrit>();
public ReadOnlyCollection<BanqueInscrit> AllBanque { get; private set; }
private List<Compte> listeDesComptes = new List<Compte>();
@ -88,7 +87,7 @@ namespace Model
public Manager(IPersistanceManager persistance)
{
AllBanque = new ReadOnlyCollection<Banque>(listeDesBanques);
AllBanque = new ReadOnlyCollection<BanqueInscrit>(listeDesBanques);
AllCompte = new ReadOnlyCollection<Compte>(listeDesComptes);
Pers = persistance;
}
@ -99,6 +98,7 @@ namespace Model
public async void LoadCompte()
{
listeDesComptes.Clear();
if(SelectedBanque == null)
@ -108,7 +108,7 @@ namespace Model
try
{
IList<Compte> comptes = await Pers.RecupererCompte(SelectedBanque, User);
IList<Compte> comptes = await Pers.RecupererCompte(SelectedBanque);
listeDesComptes.AddRange(comptes);
}
catch(Exception exception)
@ -139,7 +139,7 @@ namespace Model
selectedCompte = listeDesComptes.First();
}
SelectedCompte = listeDesComptes.FirstOrDefault();
}
@ -148,16 +148,14 @@ namespace Model
try
{
listeDesBanques = await Pers.RecupererBanques(User);
}catch(Exception exception)
SelectedBanque = listeDesBanques.FirstOrDefault();
}
catch (Exception exception)
{
Debug.WriteLine(exception.Message);
}
if(listeDesBanques.Count > 0)
{
SelectedBanque = listeDesBanques.First();
}
}
public async void LoadBanqueDispo()
@ -187,11 +185,11 @@ namespace Model
User = null;
}
public async void LoadBanques()
/*public async void LoadBanques()
{
User.LesBanques = await Pers.RecupererBanques(User);
BanquesDisponibleInApp = await Pers.RecupererBanquesDisponible();
}
}*/
public async Task<string> getPassword(string email)
{

@ -12,7 +12,7 @@ namespace Model
public class Planification
{
public string IntituleOperation { get; private set; }
public string Nom { get; private set; }
public double Montant { get; private set; }
@ -24,9 +24,9 @@ namespace Model
public TagOperation Tag { get; private set; }
[JsonConstructor]
public Planification(string intituleOperation, double montant, DateTime dateOperation, MethodePayement modePayement, TagOperation tag, bool isDebit = true)
public Planification(string nom, double montant, DateTime dateOperation, MethodePayement modePayement, TagOperation tag, bool isDebit = true)
{
IntituleOperation = intituleOperation;
Nom = nom;
Montant = montant;
DateOperation = dateOperation;
ModePayement = modePayement;
@ -36,7 +36,7 @@ namespace Model
public override string ToString()
{
return IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + " " + Tag;
return Nom + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + " " + Tag;
}
}
}

@ -2,6 +2,7 @@
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Syncfusion.Maui.DataSource.Extensions;
using System.Net.Http.Headers;
using System.Security.Principal;
using System.Xml.Linq;
@ -87,8 +88,8 @@ foreach (Banque b in banques)
Console.WriteLine("\n--------\n");
IList<Banque> banquesId1 = ClientAPI.GetBanqueAsync("1").GetAwaiter().GetResult();
foreach (Banque b in banquesId1)
IList<BanqueInscrit> banquesId1 = ClientAPI.GetBanqueAsync("1").GetAwaiter().GetResult();
foreach (BanqueInscrit b in banquesId1)
{
Console.WriteLine(b);
}
@ -101,7 +102,7 @@ Console.WriteLine("Add banque for user : " + rrrr + "\n");
Console.WriteLine("\n----Verif----\n");
banquesId1 = ClientAPI.GetBanqueAsync("1").GetAwaiter().GetResult();
foreach (Banque b in banquesId1)
foreach (BanqueInscrit b in banquesId1)
{
Console.WriteLine(b);
}
@ -114,7 +115,7 @@ Console.WriteLine("Del banque for user : " + rrrrrr + "\n");
Console.WriteLine("\n----Verif----\n");
banquesId1 = ClientAPI.GetBanqueAsync("1").GetAwaiter().GetResult();
foreach (Banque b in banquesId1)
foreach (BanqueInscrit b in banquesId1)
{
Console.WriteLine(b);
}
@ -245,4 +246,15 @@ echeances = ClientAPI.GetEcheanceAsync("1").GetAwaiter().GetResult();
foreach (Echeance e in echeances)
{
Console.WriteLine(e);
}
}
Console.WriteLine("errr");
// test pers API
IPersistanceManager Pers = new PersAPI();
IList<Compte> bla = Pers.RecupererCompte(new BanqueInscrit(34,"BANQUE POSTALE")).GetAwaiter().GetResult();
bla.ForEach(c=> Console.WriteLine(c));

Loading…
Cancel
Save