Merge pull request 'ClientAPI' (#138) from ClientAPI into master
continuous-integration/drone/push Build is failing Details

Reviewed-on: #138
PatchDeserialisation
Hugo LIVET 2 years ago
commit 8abc26d7c8

@ -10,6 +10,7 @@ steps:
- name: build - name: build
image: mcr.microsoft.com/dotnet/sdk:6.0 image: mcr.microsoft.com/dotnet/sdk:6.0
commands: commands:
- dotnet add package Newtonsoft.Json
- cd Sources - cd Sources
- dotnet workload restore - dotnet workload restore
- dotnet restore CI_MAUI.sln - dotnet restore CI_MAUI.sln
@ -27,6 +28,7 @@ steps:
- name: code-analysis - name: code-analysis
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6 image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dronesonarplugin-dotnet6
commands: commands:
- dotnet add package Newtonsoft.Json
- cd Sources/ - cd Sources/
- dotnet workload restore - dotnet workload restore
- dotnet restore CI_MAUI.sln - dotnet restore CI_MAUI.sln

@ -15,6 +15,11 @@ $app->get('/', function (Request $request, Response $response, $args) {
}); });
require __DIR__.'/../routes/Inscrit.php'; require __DIR__.'/../routes/Inscrit.php';
require __DIR__.'/../routes/Banque.php';
require __DIR__.'/../routes/Compte.php';
require __DIR__.'/../routes/Operation.php';
require __DIR__.'/../routes/Planification.php';
require __DIR__.'/../routes/Echeance.php';
$app->run(); $app->run();
?> ?>

@ -0,0 +1,140 @@
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
use OpenApi\Annotations as OA;
/**
* @OA\Info(title="My First API", version="0.1")
*/
$app->addBodyParsingMiddleware();
$app->addRoutingMiddleware();
$app->addErrorMiddleware(true, true, true);
/**
* @OA\Get(path="/api/Banque",
* @OA\Response(response="200", description="Succes")
* @OA\Response(response="500", description="Bdd Error")
* )
*/
$app->get('/Banque/', function(Request $request, Response $response){
$query = "SELECT * FROM Banque";
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->query($query);
$inscrits = $stmt->fetchAll(PDO::FETCH_OBJ);
$db = null;
$response->getBody()->write(json_encode($inscrits));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
$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)';
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':id', $id, PDO::PARAM_STR);
$stmt->execute();
$inscrit = $stmt->fetchAll(PDO::FETCH_OBJ);
$db = null;
$response->getBody()->write(json_encode($inscrit));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
$app->post('/Banque/add/', function(Request $request, Response $response, array $args){
$nom = $request->getParsedBody()["nom"];
$idInscrit = $request->getParsedBody()["idInscrit"];
$query = "INSERT INTO InscrBanque (nomBanque, idInscrit) VALUES (:nom, :idI)";
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':nom', $nom, PDO::PARAM_STR);
$stmt->bindValue(':idI', $idInscrit, PDO::PARAM_STR);
$result = $stmt->execute();
$db = null;
$response->getBody()->write(json_encode($result));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
$app->delete('/Banque/delete/', function (Request $request, Response $response, array $args) {
$nom = $request->getParsedBody()["nom"];
$idInscrit = $request->getParsedBody()["idInscrit"];
$query = "DELETE FROM InscrBanque WHERE nomBanque=:nom AND idInscrit=:idI";
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':nom', $nom, PDO::PARAM_STR);
$stmt->bindValue(':idI', $idInscrit, PDO::PARAM_STR);
$result = $stmt->execute();
$db = null;
$response->getBody()->write(json_encode($result));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
?>

@ -0,0 +1,116 @@
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
use OpenApi\Annotations as OA;
/**
* @OA\Info(title="My First API", version="0.1")
*/
$app->addBodyParsingMiddleware();
$app->addRoutingMiddleware();
$app->addErrorMiddleware(true, true, true);
/**
* @OA\Get(path="/api/Compte",
* @OA\Response(response="200", description="Succes")
* @OA\Response(response="500", description="Bdd Error")
* )
*/
$app->post('/Compte/FromIdInscrit/', function(Request $request, Response $response,array $args){
$idInscrit = $request->getParsedBody()["id"];
$query = 'SELECT * FROM Compte WHERE idInscritBanque=:id';
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':id', $idInscrit, PDO::PARAM_STR);
$stmt->execute();
$compte = $stmt->fetchAll(PDO::FETCH_OBJ);
$db = null;
$response->getBody()->write(json_encode($compte));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
$app->post('/Compte/add/', function(Request $request, Response $response, array $args){
$nom = $request->getParsedBody()["nom"];
$idInscrit = $request->getParsedBody()["idInscrit"];
$query = "INSERT INTO Compte (nom, idInscritBanque) VALUES (:nom, :idI)";
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':nom', $nom, PDO::PARAM_STR);
$stmt->bindValue(':idI', $idInscrit, PDO::PARAM_STR);
$result = $stmt->execute();
$db = null;
$response->getBody()->write(json_encode($result));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
$app->delete('/Compte/delete/', function (Request $request, Response $response, array $args) {
$nom = $request->getParsedBody()["nom"];
$idInscrit = $request->getParsedBody()["idInscrit"];
$query = "DELETE FROM Compte WHERE nom=:nom AND idInscritBanque=:idI";
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':nom', $nom, PDO::PARAM_STR);
$stmt->bindValue(':idI', $idInscrit, PDO::PARAM_STR);
$result = $stmt->execute();
$db = null;
$response->getBody()->write(json_encode($result));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
?>

@ -0,0 +1,125 @@
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
use OpenApi\Annotations as OA;
/**
* @OA\Info(title="My First API", version="0.1")
*/
$app->addBodyParsingMiddleware();
$app->addRoutingMiddleware();
$app->addErrorMiddleware(true, true, true);
/**
* @OA\Get(path="/api/Echeance",
* @OA\Response(response="200", description="Succes")
* @OA\Response(response="500", description="Bdd Error")
* )
*/
$app->post('/Echeance/FromIdCompte/', function(Request $request, Response $response,array $args){
$idCompte = $request->getParsedBody()["id"];
$query = 'SELECT * FROM Echeancier WHERE compte=:id';
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':id', $idCompte, PDO::PARAM_STR);
$stmt->execute();
$ope = $stmt->fetchAll(PDO::FETCH_OBJ);
$db = null;
$response->getBody()->write(json_encode($ope));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
$app->post('/Echeance/add/', function(Request $request, Response $response, array $args){
$compte = $request->getParsedBody()["compte"];
$nom = $request->getParsedBody()["nom"];
$montant = $request->getParsedBody()["montant"];
$dateO = $request->getParsedBody()["dateO"];
$methodePayement = $request->getParsedBody()["methodePayement"];
$isDebit = $request->getParsedBody()["isDebit"];
$tag = $request->getParsedBody()["tag"];
$query = "INSERT INTO Echeancier (compte, nom, montant, dateO, methodePayement, isDebit, tag) SELECT :compte,:nom,:montant, STR_TO_DATE(:dateO, '%d/%m/%Y %H:%i:%s' ), :methodePayement, :isD ,:tag;";
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':compte', $compte, PDO::PARAM_STR);
$stmt->bindValue(':nom', $nom, PDO::PARAM_STR);
$stmt->bindValue(':montant', $montant, PDO::PARAM_STR);
$stmt->bindValue(':dateO', $dateO, PDO::PARAM_STR);
$stmt->bindValue(':methodePayement', $methodePayement, PDO::PARAM_STR);
$stmt->bindValue(':isD', $isDebit, PDO::PARAM_BOOL);
$stmt->bindValue(':tag', $tag, PDO::PARAM_STR);
$result = $stmt->execute();
$db = null;
$response->getBody()->write(json_encode($result));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
$app->delete('/Echeance/delete/', function (Request $request, Response $response, array $args) {
$compte = $request->getParsedBody()["compte"];
$nom = $request->getParsedBody()["nom"];
$query = "DELETE FROM Echeancier WHERE compte=:compte AND nom=:nom";
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':compte', $compte, PDO::PARAM_STR);
$stmt->bindValue(':nom', $nom, PDO::PARAM_STR);
$result = $stmt->execute();
$db = null;
$response->getBody()->write(json_encode($result));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
?>

@ -8,8 +8,6 @@ use OpenApi\Annotations as OA;
* @OA\Info(title="My First API", version="0.1") * @OA\Info(title="My First API", version="0.1")
*/ */
$app = AppFactory::create();
$app->addBodyParsingMiddleware(); $app->addBodyParsingMiddleware();
$app->addRoutingMiddleware(); $app->addRoutingMiddleware();
$app->addErrorMiddleware(true, true, true); $app->addErrorMiddleware(true, true, true);
@ -138,4 +136,37 @@ $app->post('/Inscrit/add/', function(Request $request, Response $response, array
->withStatus(500); ->withStatus(500);
} }
}); });
$app->delete('/Inscrit/delete/', function (Request $request, Response $response, array $args) {
$email = $request->getParsedBody()["email"];
$query = "DELETE FROM Inscrit WHERE mail=:mail";
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':mail', $email, PDO::PARAM_STR);
$result = $stmt->execute();
$db = null;
$response->getBody()->write(json_encode($result));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
?> ?>

@ -0,0 +1,127 @@
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
use OpenApi\Annotations as OA;
/**
* @OA\Info(title="My First API", version="0.1")
*/
$app->addBodyParsingMiddleware();
$app->addRoutingMiddleware();
$app->addErrorMiddleware(true, true, true);
/**
* @OA\Get(path="/api/Operation",
* @OA\Response(response="200", description="Succes")
* @OA\Response(response="500", description="Bdd Error")
* )
*/
$app->post('/Operation/FromIdCompte/', function(Request $request, Response $response,array $args){
$idCompte = $request->getParsedBody()["id"];
$query = 'SELECT * FROM Operation WHERE compte=:id';
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':id', $idCompte, PDO::PARAM_STR);
$stmt->execute();
$ope = $stmt->fetchAll(PDO::FETCH_OBJ);
$db = null;
$response->getBody()->write(json_encode($ope));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
$app->post('/Operation/add/', function(Request $request, Response $response, array $args){
$compte = $request->getParsedBody()["compte"];
$nom = $request->getParsedBody()["nom"];
$montant = $request->getParsedBody()["montant"];
$dateO = $request->getParsedBody()["dateO"];
$methodePayement = $request->getParsedBody()["methodePayement"];
$isDebit = $request->getParsedBody()["isDebit"];
$tag = $request->getParsedBody()["tag"];
$fromBanque = $request->getParsedBody()["fromBanque"];
$query = "INSERT INTO Operation (compte, nom, montant, dateO, methodePayement, isDebit, fromBanque, tag) SELECT :compte,:nom,:montant, STR_TO_DATE(:dateO, '%d/%m/%Y %H:%i:%s' ), :methodePayement, :isD, :fromBanque, :tag;";
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':compte', $compte, PDO::PARAM_STR);
$stmt->bindValue(':nom', $nom, PDO::PARAM_STR);
$stmt->bindValue(':montant', $montant, PDO::PARAM_STR);
$stmt->bindValue(':dateO', $dateO, PDO::PARAM_STR);
$stmt->bindValue(':methodePayement', $methodePayement, PDO::PARAM_STR);
$stmt->bindValue(':isD', $isDebit, PDO::PARAM_BOOL);
$stmt->bindValue(':tag', $tag, PDO::PARAM_STR);
$stmt->bindValue(':fromBanque', $fromBanque, PDO::PARAM_BOOL);
$result = $stmt->execute();
$db = null;
$response->getBody()->write(json_encode($result));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
$app->delete('/Operation/delete/', function (Request $request, Response $response, array $args) {
$compte = $request->getParsedBody()["compte"];
$nom = $request->getParsedBody()["nom"];
$query = "DELETE FROM Operation WHERE compte=:compte AND nom=:nom";
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':compte', $compte, PDO::PARAM_STR);
$stmt->bindValue(':nom', $nom, PDO::PARAM_STR);
$result = $stmt->execute();
$db = null;
$response->getBody()->write(json_encode($result));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
?>

@ -0,0 +1,125 @@
<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
use OpenApi\Annotations as OA;
/**
* @OA\Info(title="My First API", version="0.1")
*/
$app->addBodyParsingMiddleware();
$app->addRoutingMiddleware();
$app->addErrorMiddleware(true, true, true);
/**
* @OA\Get(path="/api/Planification",
* @OA\Response(response="200", description="Succes")
* @OA\Response(response="500", description="Bdd Error")
* )
*/
$app->post('/Planification/FromIdCompte/', function(Request $request, Response $response,array $args){
$idCompte = $request->getParsedBody()["id"];
$query = 'SELECT * FROM Planification WHERE compte=:id';
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':id', $idCompte, PDO::PARAM_STR);
$stmt->execute();
$ope = $stmt->fetchAll(PDO::FETCH_OBJ);
$db = null;
$response->getBody()->write(json_encode($ope));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
$app->post('/Planification/add/', function(Request $request, Response $response, array $args){
$compte = $request->getParsedBody()["compte"];
$nom = $request->getParsedBody()["nom"];
$montant = $request->getParsedBody()["montant"];
$dateO = $request->getParsedBody()["dateO"];
$methodePayement = $request->getParsedBody()["methodePayement"];
$isDebit = $request->getParsedBody()["isDebit"];
$tag = $request->getParsedBody()["tag"];
$query = "INSERT INTO Planification (compte, nom, montant, dateO, methodePayement, isDebit, tag) SELECT :compte,:nom,:montant, STR_TO_DATE(:dateO, '%d/%m/%Y %H:%i:%s' ), :methodePayement, :isD ,:tag;";
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':compte', $compte, PDO::PARAM_STR);
$stmt->bindValue(':nom', $nom, PDO::PARAM_STR);
$stmt->bindValue(':montant', $montant, PDO::PARAM_STR);
$stmt->bindValue(':dateO', $dateO, PDO::PARAM_STR);
$stmt->bindValue(':methodePayement', $methodePayement, PDO::PARAM_STR);
$stmt->bindValue(':isD', $isDebit, PDO::PARAM_BOOL);
$stmt->bindValue(':tag', $tag, PDO::PARAM_STR);
$result = $stmt->execute();
$db = null;
$response->getBody()->write(json_encode($result));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
$app->delete('/Planification/delete/', function (Request $request, Response $response, array $args) {
$compte = $request->getParsedBody()["compte"];
$nom = $request->getParsedBody()["nom"];
$query = "DELETE FROM Planification WHERE compte=:compte AND nom=:nom";
try{
$db = new Database();
$conn = $db->connect();
$stmt = $conn->prepare($query);
$stmt->bindValue(':compte', $compte, PDO::PARAM_STR);
$stmt->bindValue(':nom', $nom, PDO::PARAM_STR);
$result = $stmt->execute();
$db = null;
$response->getBody()->write(json_encode($result));
return $response
->withHeader('content-type', 'application/json')
->withStatus(200);
} catch(PDOException $e){
$error = array("message" => $e->getMessage());
$response->getBody()->write(json_encode($error));
return $response
->withHeader('content-type', 'application/json')
->withStatus(500);
}
});
?>

@ -0,0 +1,483 @@
using Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace Data
{
public static class ClientAPI
{
private const string ROOT_URL = "http://82.64.164.20:8888/";
//routes inscrit
private const string GET_INSCRITS_DATA_URL = ROOT_URL+"Inscrit/";
private const string POST_EMAIL_INSCRIT_DATA_URL = ROOT_URL+"Inscrit/FromMail/";
private const string PUT_PASSWORD_INSCRIT_DATA_URL = ROOT_URL+"Inscrit/UpdatePassword/";
private const string POST_ADD_INSCRIT_DATA_URL = ROOT_URL + "Inscrit/add/";
private const string DELETE_INSCRIT_DATA_URL = ROOT_URL + "Inscrit/delete/";
//routes banque
private const string GET_BANQUES_DATA_URL = ROOT_URL + "Banque/";
private const string POST_BANQUES_INSCRIT_DATA_URL = ROOT_URL + "Banque/FromId/";
private const string POST_ADD_BANQUE_INSCRIT_DATA_URL = ROOT_URL + "Banque/add/";
private const string DELETE_BANQUE_INSCRIT_DATA_URL = ROOT_URL + "Banque/delete/";
//routes compte
private const string POST_COMPTE_INSCRIT_DATA_URL = ROOT_URL + "Compte/FromIdInscrit/";
private const string POST_ADD_COMPTE_INSCRIT_DATA_URL = ROOT_URL + "Compte/add/";
private const string DELETE_COMPTE_INSCRIT_DATA_URL = ROOT_URL + "Compte/delete/";
//routes operation
private const string POST_OPERATION_COMPTE_DATA_URL = ROOT_URL + "Operation/FromIdCompte/";
private const string POST_ADD_OPERATION_COMPTE_DATA_URL = ROOT_URL + "Operation/add/";
private const string DELETE_OPERATION_COMPTE_DATA_URL = ROOT_URL + "Operation/delete/";
//routes planification
private const string POST_PLANIFICATION_COMPTE_DATA_URL = ROOT_URL + "Planification/FromIdCompte/";
private const string POST_ADD_PLANIFICATION_COMPTE_DATA_URL = ROOT_URL + "Planification/add/";
private const string DELETE_PLANIFICATION_COMPTE_DATA_URL = ROOT_URL + "Planification/delete/";
//routes echeance
private const string POST_ECHEANCE_COMPTE_DATA_URL = ROOT_URL + "Echeance/FromIdCompte/";
private const string POST_ADD_ECHEANCE_COMPTE_DATA_URL = ROOT_URL + "Echeance/add/";
private const string DELETE_ECHEANCE_COMPTE_DATA_URL = ROOT_URL + "Echeance/delete/";
//routes utilitaire
private const string TEST_API_STATEMENT = ROOT_URL;
private static HttpClient cli = new HttpClient();
//Inscrit
public static async Task<List<Inscrit>> GetInscritsAsync()
{
HttpResponseMessage reponse = await cli.GetAsync(GET_INSCRITS_DATA_URL);
if(reponse.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<List<Inscrit>>(await reponse.Content.ReadAsStringAsync());
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<List<Inscrit>> GetInscritAsync(string email)
{
var dataBody = new Dictionary<string, string> { { "email", email } };
HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_EMAIL_INSCRIT_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<List<Inscrit>>(await reponse.Content.ReadAsStringAsync());
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> PutPasswordInscritAsync(string email, string password)
{
var dataBody = new Dictionary<string, string> { { "email", email }, { "password", password } };
HttpResponseMessage reponse = await cli.PutAsJsonAsync(PUT_PASSWORD_INSCRIT_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> PostAddInscritAsync(string nom, string prenom, string email, string password)
{
var dataBody = new Dictionary<string, string> { { "nom", nom }, { "prenom", prenom }, { "email", email }, { "password", password } };
HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_ADD_INSCRIT_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> DeleteInscritAsync(string email)
{
var dataBody = new Dictionary<string, string> { { "email", email } };
var reponse =
cli.SendAsync(
new HttpRequestMessage(HttpMethod.Delete, DELETE_INSCRIT_DATA_URL)
{
Content = new FormUrlEncodedContent(dataBody)
})
.Result;
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
//Banque
public static async Task<List<Banque>> GetBanquesAsync()
{
HttpResponseMessage reponse = await cli.GetAsync(GET_BANQUES_DATA_URL);
if (reponse.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<List<Banque>>(await reponse.Content.ReadAsStringAsync());
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<List<Banque>> 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());
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> PostAddBanqueInscritAsync(string nomBanque, string idInscrit)
{
var dataBody = new Dictionary<string, string> { { "nom", nomBanque }, { "idInscrit", idInscrit } };
HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_ADD_BANQUE_INSCRIT_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> DeleteBanqueInscritAsync(string nomBanque, string idInscrit)
{
var dataBody = new Dictionary<string, string> { { "nom", nomBanque }, { "idInscrit", idInscrit } };
var reponse =
cli.SendAsync(
new HttpRequestMessage(HttpMethod.Delete, DELETE_BANQUE_INSCRIT_DATA_URL)
{
Content = new FormUrlEncodedContent(dataBody)
})
.Result;
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
//Comptes
public static async Task<List<Compte>> GetCompteAsync(string id)
{
var dataBody = new Dictionary<string, string> { { "id", id } };
HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_COMPTE_INSCRIT_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<List<Compte>>(await reponse.Content.ReadAsStringAsync());
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> PostAddCompteInscritAsync(string nomCompte, string idInscrit)
{
var dataBody = new Dictionary<string, string> { { "nom", nomCompte }, { "idInscrit", idInscrit } };
HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_ADD_COMPTE_INSCRIT_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> DeleteCompteInscritAsync(string nomCompte, string idInscrit)
{
var dataBody = new Dictionary<string, string> { { "nom", nomCompte }, { "idInscrit", idInscrit } };
var reponse =
cli.SendAsync(
new HttpRequestMessage(HttpMethod.Delete, DELETE_COMPTE_INSCRIT_DATA_URL)
{
Content = new FormUrlEncodedContent(dataBody)
})
.Result;
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
//Operations
public static async Task<List<Operation>> GetOperationAsync(string id)
{
var dataBody = new Dictionary<string, string> { { "id", id } };
HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_OPERATION_COMPTE_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<List<Operation>>(await reponse.Content.ReadAsStringAsync());
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> PostAddOperationInscritAsync(Compte compte, Operation operation)
{
var dataBody = new Dictionary<string, string>
{
{ "compte", compte.Identifiant },
{ "nom", operation.IntituleOperation },
{ "montant", operation.Montant.ToString() },
{ "dateO", operation.DateOperation.ToString() },
{ "methodePayement", operation.ModePayement.ToString() },
{ "isDebit", operation.IsDebit.ToString() },
{ "tag", operation.Tag.ToString() },
{ "fromBanque", operation.FromBanque.ToString() }
};
HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_ADD_OPERATION_COMPTE_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> DeleteOperationInscritAsync(string idCompte, string nomOpe)
{
var dataBody = new Dictionary<string, string> { { "compte", idCompte }, { "nom", nomOpe } };
var reponse =
cli.SendAsync(
new HttpRequestMessage(HttpMethod.Delete, DELETE_OPERATION_COMPTE_DATA_URL)
{
Content = new FormUrlEncodedContent(dataBody)
})
.Result;
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
//Planifications
public static async Task<List<Planification>> GetPlanificationAsync(string id)
{
var dataBody = new Dictionary<string, string> { { "id", id } };
HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_PLANIFICATION_COMPTE_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<List<Planification>>(await reponse.Content.ReadAsStringAsync());
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> PostAddPlanificationInscritAsync(Compte compte, Planification planification)
{
var dataBody = new Dictionary<string, string>
{
{ "compte", compte.Identifiant },
{ "nom", planification.IntituleOperation },
{ "montant", planification.Montant.ToString() },
{ "dateO", planification.DateOperation.ToString() },
{ "methodePayement", planification.ModePayement.ToString() },
{ "isDebit", planification.IsDebit.ToString() },
{ "tag", planification.Tag.ToString() }
};
HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_ADD_PLANIFICATION_COMPTE_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> DeletePlanificationInscritAsync(string idCompte, string nomOpe)
{
var dataBody = new Dictionary<string, string> { { "compte", idCompte }, { "nom", nomOpe } };
var reponse =
cli.SendAsync(
new HttpRequestMessage(HttpMethod.Delete, DELETE_PLANIFICATION_COMPTE_DATA_URL)
{
Content = new FormUrlEncodedContent(dataBody)
})
.Result;
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
//Echeances
public static async Task<List<Echeance>> GetEcheanceAsync(string id)
{
var dataBody = new Dictionary<string, string> { { "id", id } };
HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_ECHEANCE_COMPTE_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return JsonConvert.DeserializeObject<List<Echeance>>(await reponse.Content.ReadAsStringAsync());
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> PostAddEcheanceInscritAsync(Compte compte, Echeance echeance)
{
var dataBody = new Dictionary<string, string>
{
{ "compte", compte.Identifiant },
{ "nom", echeance.IntituleOperation },
{ "montant", echeance.Montant.ToString() },
{ "dateO", echeance.DateOperation.ToString() },
{ "methodePayement", echeance.ModePayement.ToString() },
{ "isDebit", echeance.IsDebit.ToString() },
{ "tag", echeance.Tag.ToString() }
};
HttpResponseMessage reponse = await cli.PostAsJsonAsync(POST_ADD_ECHEANCE_COMPTE_DATA_URL, dataBody);
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
public static async Task<bool> DeleteEcheanceInscritAsync(string idCompte, string nomOpe)
{
var dataBody = new Dictionary<string, string> { { "compte", idCompte }, { "nom", nomOpe } };
var reponse =
cli.SendAsync(
new HttpRequestMessage(HttpMethod.Delete, DELETE_ECHEANCE_COMPTE_DATA_URL)
{
Content = new FormUrlEncodedContent(dataBody)
})
.Result;
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
throw new HttpRequestException(reponse.StatusCode.ToString());
}
}
//Utilitaires
public static async Task<bool> GetStateApi()
{
HttpResponseMessage reponse = await cli.GetAsync(TEST_API_STATEMENT);
if (reponse.IsSuccessStatusCode)
{
return true;
}
else
{
return false;
}
}
}
}

@ -18,6 +18,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Npgsql" Version="6.0.7" /> <PackageReference Include="Npgsql" Version="6.0.7" />
</ItemGroup> </ItemGroup>

@ -13,6 +13,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Npgsql" Version="6.0.7" /> <PackageReference Include="Npgsql" Version="6.0.7" />
</ItemGroup> </ItemGroup>

@ -99,7 +99,7 @@ namespace Data
row = ""; row = "";
} }
} }
compteEnCoursDeSaisie.ajouterOperation(new Operation(intituleOperation, montant, dateOperation, modePayement, isDebit)); compteEnCoursDeSaisie.ajouterOperation(new Operation(intituleOperation, montant, dateOperation, modePayement, TagOperation.None, isDebit));
} }
else else
{ {

@ -0,0 +1,133 @@
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Data
{
public class PersAPI : IPersistanceManager
{
// /!\ Toutes les méthodes ici permettent d'uniquement manipuler une stratégie de persistance
// /!\ et ne doit en aucun cas manipuler la mémoire !
//actions sur les inscrits
public bool AjouterInscrit(Inscrit inscrit)
{
return ClientAPI.PostAddInscritAsync(inscrit.Nom, inscrit.Prenom, inscrit.Mail, inscrit.Mdp).GetAwaiter().GetResult();
}
public bool SupprimerInscrit(Inscrit inscrit)
{
return ClientAPI.DeleteInscritAsync(inscrit.Mail).GetAwaiter().GetResult();
}
public bool ModifierMdpInscrit(string mail, string nouveauMdp)
{
return ClientAPI.PutPasswordInscritAsync(mail,nouveauMdp).GetAwaiter().GetResult();
}
public Inscrit RecupererInscrit(string mail)
{
List<Inscrit> inscrits = ClientAPI.GetInscritAsync(mail).GetAwaiter().GetResult();
if(inscrits.Count >= 1)
{
throw new ArgumentException("Cet email contient plusieurs utilisateurs pour la même adresse");
}
return inscrits.FirstOrDefault();
}
public bool EmailDisponible(string mail)
{
List<Inscrit> inscrits = ClientAPI.GetInscritAsync(mail).GetAwaiter().GetResult();
if (inscrits.Count >= 1)
{
return false;
}
return true;
}
//actions sur les banques
public bool AjouterBanque(Banque banque, Inscrit inscrit)
{
return ClientAPI.PostAddBanqueInscritAsync(banque.Nom, inscrit.Id.ToString()).GetAwaiter().GetResult();
}
public bool SupprimerBanque(Banque banque, Inscrit inscrit)
{
return ClientAPI.DeleteBanqueInscritAsync(banque.Nom, inscrit.Id.ToString()).GetAwaiter().GetResult();
}
public IList<Banque> RecupererBanques(Inscrit inscrit)
{
return ClientAPI.GetBanqueAsync(inscrit.Id.ToString()).GetAwaiter().GetResult();
}
public IList<Banque> RecupererBanquesDisponible()
{
return ClientAPI.GetBanquesAsync().GetAwaiter().GetResult();
}
//actions sur les comptes
public bool AjouterCompte(Compte compte, Inscrit inscrit)
{
return ClientAPI.PostAddCompteInscritAsync(compte.Nom, inscrit.Id.ToString()).GetAwaiter().GetResult();
}
public bool SupprimerCompte(Compte compte, Inscrit inscrit)
{
return ClientAPI.DeleteCompteInscritAsync(compte.Nom, inscrit.Id.ToString()).GetAwaiter().GetResult();
}
public IList<Compte> RecupererCompte(Banque banque, Inscrit inscrit)
{
return ClientAPI.GetCompteAsync(inscrit.Id.ToString()).GetAwaiter().GetResult();
}
//actions sur les Opérations
public bool AjouterOperation(Compte compte, Operation operation)
{
return ClientAPI.PostAddOperationInscritAsync(compte,operation).GetAwaiter().GetResult();
}
public bool SupprimerOperation(Compte compte, Operation operation)
{
return ClientAPI.DeleteOperationInscritAsync(compte.Identifiant, operation.IntituleOperation).GetAwaiter().GetResult();
}
public IList<Operation> RecupererOperation(Compte compte)
{
return ClientAPI.GetOperationAsync(compte.Identifiant).GetAwaiter().GetResult();
}
//actions sur les Planifications
public bool AjouterPlanification(Compte compte, Planification planification)
{
return ClientAPI.PostAddPlanificationInscritAsync(compte, planification).GetAwaiter().GetResult();
}
public bool SupprimerPlanification(Compte compte, Planification planification)
{
return ClientAPI.DeletePlanificationInscritAsync(compte.Identifiant, planification.IntituleOperation).GetAwaiter().GetResult();
}
public IList<Planification> RecupererPlanification(Compte compte)
{
return ClientAPI.GetPlanificationAsync(compte.Identifiant).GetAwaiter().GetResult();
}
//actions sur les Echéances
public bool AjouterEcheance(Compte compte, Echeance echeance)
{
return ClientAPI.PostAddEcheanceInscritAsync(compte, echeance).GetAwaiter().GetResult();
}
public bool SupprimerEcheance(Compte compte, Echeance echeance)
{
return ClientAPI.DeleteEcheanceInscritAsync(compte.Identifiant, echeance.IntituleOperation).GetAwaiter().GetResult();
}
public IList<Echeance> RecupererEcheance(Compte compte)
{
return ClientAPI.GetEcheanceAsync(compte.Identifiant).GetAwaiter().GetResult();
}
//actions utilitaire
public bool TestConnexion()
{
return ClientAPI.GetStateApi().GetAwaiter().GetResult();
}
}
}

@ -17,7 +17,7 @@ using System.Reflection.PortableExecutable;
namespace LinqToPgSQL namespace LinqToPgSQL
{ {
public class PersLinqToPgSQL : IPersistanceManager public class PersLinqToPgSQL /*: IPersistanceManager*/
{ {
private Hash hash = new Hash(); private Hash hash = new Hash();
private static string connexionBDD = String.Format("Server=2.3.8.130; Username=postgres; Database=conseco; Port=5432; Password=lulu; SSLMode=Prefer"); private static string connexionBDD = String.Format("Server=2.3.8.130; Username=postgres; Database=conseco; Port=5432; Password=lulu; SSLMode=Prefer");
@ -296,11 +296,11 @@ namespace LinqToPgSQL
return ListeCompte; return ListeCompte;
} }
public List<Banque> LoadBanqueId(string id) public List<Banque> LoadBanqueId(int id)
{ {
int idnombre = Int16.Parse(id); ;
List<Banque> ListeBanque = new List<Banque>(); List<Banque> ListeBanque = new List<Banque>();
Debug.WriteLine(idnombre); Debug.WriteLine(id);
var conn = new NpgsqlConnection(connexionBDD); var conn = new NpgsqlConnection(connexionBDD);
Console.Out.WriteLine("Ouverture de la connection"); Console.Out.WriteLine("Ouverture de la connection");
try try
@ -314,7 +314,7 @@ namespace LinqToPgSQL
Environment.Exit(-1); Environment.Exit(-1);
} }
NpgsqlCommand cmd = new NpgsqlCommand("select b.nom,b.urlsite,b.urllogo from banque b, inscrbanque ib, Inscrit i where ib.idinscrit =(@p) AND ib.nombanque = b.nom AND ib.idinscrit = i.id;", conn); NpgsqlCommand cmd = new NpgsqlCommand("select b.nom,b.urlsite,b.urllogo from banque b, inscrbanque ib, Inscrit i where ib.idinscrit =(@p) AND ib.nombanque = b.nom AND ib.idinscrit = i.id;", conn);
cmd.Parameters.AddWithValue("p", idnombre); cmd.Parameters.AddWithValue("p", id);
NpgsqlDataReader dataReader = cmd.ExecuteReader(); NpgsqlDataReader dataReader = cmd.ExecuteReader();
while (dataReader.Read()) while (dataReader.Read())
{ {

@ -2,21 +2,21 @@
namespace Data namespace Data
{ {
public class Stub : IPersistanceManager public class PersStub /*: IPersistanceManager*/
{ {
private List<Inscrit> lesInscrits = new List<Inscrit>(); private List<Inscrit> lesInscrits = new List<Inscrit>();
public Stub() public PersStub()
{ {
lesInscrits.Add(new Inscrit( lesInscrits.Add(new Inscrit(
"1", 1,
"LIVET", "LIVET",
"livet.hugo2003@gmail.com", "livet.hugo2003@gmail.com",
"Hugo", "Hugo",
"Bonjour63." "Bonjour63."
)); ));
} }
public string GetId(string mail) public int GetId(string mail)
{ {
foreach(Inscrit i in lesInscrits) foreach(Inscrit i in lesInscrits)
{ {
@ -25,7 +25,7 @@ namespace Data
return i.Id; return i.Id;
} }
} }
return null; return -1;
} }
public void SupprimerInscritBdd(Inscrit inscrit) public void SupprimerInscritBdd(Inscrit inscrit)
{ {
@ -63,10 +63,10 @@ namespace Data
public void CreateInscrit(Inscrit inscrit){ public void CreateInscrit(Inscrit inscrit){
lesInscrits.Add(inscrit); lesInscrits.Add(inscrit);
} }
public string LastInscrit() /*public string LastInscrit()
{ {
return lesInscrits[lesInscrits.Count - 1].Id; return lesInscrits[lesInscrits.Count - 1].Id;
} }*/
public bool ExistEmail(string mail) public bool ExistEmail(string mail)
{ {
foreach(Inscrit i in lesInscrits) foreach(Inscrit i in lesInscrits)
@ -154,7 +154,9 @@ namespace Data
return LoadOperation.LoadOperationsFromOFX(ofx); return LoadOperation.LoadOperationsFromOFX(ofx);
} }
public string LoadInscrit(string id, string mdp)
public List<Banque> LoadBanqueId(int id)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

@ -7,11 +7,11 @@ INSERT INTO Devise VALUES('NZD','DOLLAR NEO-ZELANDAIS');
INSERT INTO Devise VALUES('ZAR','RANd'); INSERT INTO Devise VALUES('ZAR','RANd');
INSERT INTO Inscrit (nom,prenom,mail,mdp)VALUES('EVARD','LUCAS','lucasevard@gmail.com','test'); INSERT INTO Inscrit (nom,prenom,mail,mdp)VALUES('EVARD','LUCAS','lucasevard@gmail.com','Azerty12345678!');
INSERT INTO Inscrit (nom,prenom,mail,mdp)VALUES('MONCUL','STEPHANE','stef@gmail.com','teststef'); INSERT INTO Inscrit (nom,prenom,mail,mdp)VALUES('MONCUL','STEPHANE','stef@gmail.com','Azerty12345678!');
INSERT INTO Inscrit (nom,prenom,mail,mdp)VALUES('MENFOUMETTOITOUTNU','RENAUD','renaudtoutnu@gmail.com','test000'); INSERT INTO Inscrit (nom,prenom,mail,mdp)VALUES('MENFOUMETTOITOUTNU','RENAUD','renaudtoutnu@gmail.com','Azerty12345678!');
INSERT INTO Inscrit (nom,prenom,mail,mdp)VALUES('YOUVOI','BENJAMIN','BENJAMIN@gmail.com','BENJAMIN'); INSERT INTO Inscrit (nom,prenom,mail,mdp)VALUES('YOUVOI','BENJAMIN','BENJAMIN@gmail.com','Azerty12345678!');
INSERT INTO Inscrit (nom,prenom,mail,mdp)VALUES('TUBEAU','RAOUL','raoullacouille@gmail.com','zizi'); INSERT INTO Inscrit (nom,prenom,mail,mdp)VALUES('TUBEAU','RAOUL','raoullacouille@gmail.com','Azerty12345678!');
INSERT INTO DeviseInscrit VALUES('EUR','1'); INSERT INTO DeviseInscrit VALUES('EUR','1');
INSERT INTO DeviseInscrit VALUES('JPY','2'); INSERT INTO DeviseInscrit VALUES('JPY','2');
@ -23,6 +23,7 @@ INSERT INtO Banque(nom,urlsite,urllogo) VALUES('BNP PARIBAS','mabanque','imagesi
INSERT INtO Banque(nom,urlsite,urllogo) VALUES('CREDIT AGRICOLE','credit-agricole.fr','imageca'); INSERT INtO Banque(nom,urlsite,urllogo) VALUES('CREDIT AGRICOLE','credit-agricole.fr','imageca');
INSERT INtO Banque(nom,urlsite,urllogo) VALUES('BANQUE POSTALE','labanquepostale.fr','imgbp'); INSERT INtO Banque(nom,urlsite,urllogo) VALUES('BANQUE POSTALE','labanquepostale.fr','imgbp');
INSERT INtO Banque(nom,urlsite,urllogo) VALUES('CAISSE D EPARGNE','caisse-epargne.fr','imgcaissedepargne'); INSERT INtO Banque(nom,urlsite,urllogo) VALUES('CAISSE D EPARGNE','caisse-epargne.fr','imgcaissedepargne');
INSERT INtO Banque(nom,urlsite,urllogo) VALUES('ORANGE BANK','orange.fr','cpt');
INSERT INTO InscrBanque (nomBanque,idInscrit)VALUES('BNP PARIBAS','1'); INSERT INTO InscrBanque (nomBanque,idInscrit)VALUES('BNP PARIBAS','1');
@ -36,8 +37,6 @@ INSERT INTO Compte (nom,idInscritBanque)VALUES('LIVRET A','2');
INSERT INTO Compte (nom,idInscritBanque)VALUES('LIVRET A','3'); INSERT INTO Compte (nom,idInscritBanque)VALUES('LIVRET A','3');
INSERT INTO Compte (nom,idInscritBanque)VALUES('LIVRET A','4'); INSERT INTO Compte (nom,idInscritBanque)VALUES('LIVRET A','4');
INSERT INTO `Operation` (`id`, `compte`, `nom`, `montant`, `dateO`, `methodePayement`, `isDebit`, `fromBanque`, `tag`) VALUES (NULL, '1', 'JSP MAIS JAI PAYER', '500', '2023-01-02', 'Vir', '1', '1', 'Divers')
INSERT INTO Planification (nom,credit,compte,datep,datecrea,methodePayement) VALUES ('EDF','190','1',now(),now(),'CB'); INSERT INTO `Planification` (`id`, `compte`, `nom`, `montant`, `dateO`, `methodePayement`, `isDebit`, `tag`) VALUES (NULL, '1', 'FAUT QUE JE PAYE', '100', '2023-01-30', 'Vir', '1', 'Energie');
INSERT INTO Planification (nom,credit,compte,datep,datecrea,methodePayement) VALUES ('SPOTIFY','190','2',now(),now(),'Prélevement'); INSERT INTO `Echeancier` (`id`, `compte`, `nom`, `montant`, `dateO`, `methodePayement`, `isDebit`, `tag`) VALUES (NULL, '1', 'FAUT PAYER VITEEEE', '50', '2023-01-06', 'Vir', '1', 'Divers');
INSERT INTO Planification (nom,credit,compte,datep,datecrea,methodePayement) VALUES ('NETFLIX','190','3',now(),now(),'Cheque');
INSERT INTO Planification (nom,credit,compte,datep,datecrea,methodePayement) VALUES ('PLAYSTATION PLUS','190','4',now(),now(),'Espece');

@ -62,44 +62,45 @@ CREATE TABLE Compte
CREATE TABLE Echeancier CREATE TABLE Echeancier
( (
id MEDIUMINT PRIMARY KEY AUTO_INCREMENT, id MEDIUMINT PRIMARY KEY AUTO_INCREMENT,
nom varchar(40),
credit numeric,
compte MEDIUMINT, compte MEDIUMINT,
debit numeric, nom varchar(40),
dateE date, montant numeric,
datecrea date, dateO date,
methodePayement varchar(20), methodePayement varchar(20),
CONSTRAINT ck_echan CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')), isDebit boolean,
FOREIGN KEY(compte) REFERENCES Compte(id), tag varchar(30),
UNIQUE (datecrea,compte) CONSTRAINT ck_methEch CHECK (methodePayement IN ('Cb','Esp','Chq','Vir','Pre', 'None')),
CONSTRAINT ck_tagEch CHECK (tag IN ('Alimentaire','Carburant','Habitation','Energie','Telephonie','Loisir','Restauration','Divers','Transport','Transaction','Santé')),
FOREIGN KEY(compte) REFERENCES Compte(id)
); );
CREATE TABLE Operation CREATE TABLE Operation
( (
id MEDIUMINT PRIMARY KEY AUTO_INCREMENT, id MEDIUMINT PRIMARY KEY AUTO_INCREMENT,
nom varchar(40),
credit numeric,
compte MEDIUMINT, compte MEDIUMINT,
debit numeric, nom varchar(40),
montant numeric,
dateO date, dateO date,
datecrea date,
methodePayement varchar(20), methodePayement varchar(20),
CONSTRAINT ck_methPaye CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')), isDebit boolean,
FOREIGN KEY(compte) REFERENCES Compte(id), fromBanque boolean,
UNIQUE (datecrea,compte) tag varchar(30),
CONSTRAINT ck_methOpe CHECK (methodePayement IN ('Cb','Esp','Chq','Vir','Pre', 'None')),
CONSTRAINT ck_tagOpe CHECK (tag IN ('Alimentaire','Carburant','Habitation','Energie','Telephonie','Loisir','Restauration','Divers','Transport','Transaction','Santé')),
FOREIGN KEY(compte) REFERENCES Compte(id)
); );
CREATE TABLE Planification CREATE TABLE Planification
( (
id MEDIUMINT PRIMARY KEY AUTO_INCREMENT, id MEDIUMINT PRIMARY KEY AUTO_INCREMENT,
nom varchar(40),
credit numeric,
compte MEDIUMINT, compte MEDIUMINT,
debit numeric, nom varchar(40),
dateP date, montant numeric,
datecrea date, dateO date,
methodePayement varchar(20), methodePayement varchar(20),
CONSTRAINT ck_planif CHECK (methodePayement IN ('CB','Cheque','Espece','Prélevement')), isDebit boolean,
FOREIGN KEY(compte) REFERENCES Compte(id), tag varchar(30),
UNIQUE (datecrea,compte) CONSTRAINT ck_methPla CHECK (methodePayement IN ('Cb','Esp','Chq','Vir','Pre', 'None')),
CONSTRAINT ck_tagPla CHECK (tag IN ('Alimentaire','Carburant','Habitation','Energie','Telephonie','Loisir','Restauration','Divers','Transport','Transaction','Santé')),
FOREIGN KEY(compte) REFERENCES Compte(id)
); );

@ -6,7 +6,7 @@ namespace IHM
{ {
public partial class App : Application public partial class App : Application
{ {
public Manager Manager { get; set; } = new Manager(new Stub()); public Manager Manager { get; set; } = new Manager(new PersAPI());
public App() public App()
{ {
InitializeComponent(); InitializeComponent();

@ -26,7 +26,7 @@ public partial class ChangePassword : ContentPage
} }
else else
{ {
Mgr.changePasswordBdd(MailUser, EntryNewMdp.Text); //Mgr.changePasswordBdd(MailUser, EntryNewMdp.Text);
AffichError("mdp changé", "mot de passe bien changé", "ok"); AffichError("mdp changé", "mot de passe bien changé", "ok");
NavigateTo("../.."); NavigateTo("../..");
} }

@ -20,7 +20,7 @@ public partial class ForgetPassword : ContentPage
{ {
AffichError("Email inconnue", "Aucun compte existant portant cette adresse mail", "OK"); AffichError("Email inconnue", "Aucun compte existant portant cette adresse mail", "OK");
} }
if (Mgr.existEmail(EntryMail.Text)) /*if (Mgr.existEmail(EntryMail.Text))
{ {
Random generator = new Random(); Random generator = new Random();
code = generator.Next(0, 1000000).ToString("D6"); code = generator.Next(0, 1000000).ToString("D6");
@ -28,7 +28,7 @@ public partial class ForgetPassword : ContentPage
ValidateReceptCode.IsVisible = true; ValidateReceptCode.IsVisible = true;
ConnexionButton.IsEnabled = false; ConnexionButton.IsEnabled = false;
UpdateArc(); UpdateArc();
} }*/
} }
private async void AffichError(string s, string s1, string s2) private async void AffichError(string s, string s1, string s2)
{ {

@ -20,7 +20,7 @@ public partial class MainPage : ContentPage
} }
else else
{ {
if (Mgr.existEmail(EntryMail.Text)) /*if (Mgr.existEmail(EntryMail.Text))
{ {
if (Mgr.isEqualHash(Mgr.recupMdpBdd(EntryMail.Text), EntryPassworld.Text)) if (Mgr.isEqualHash(Mgr.recupMdpBdd(EntryMail.Text), EntryPassworld.Text))
{ {
@ -35,7 +35,7 @@ public partial class MainPage : ContentPage
else else
{ {
AffichError("Compte inexistant", "Email ou mot de passe invalide", "OK"); AffichError("Compte inexistant", "Email ou mot de passe invalide", "OK");
} }*/
} }
} }

@ -100,6 +100,10 @@
</MauiImage> </MauiImage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Data\Data.csproj" /> <ProjectReference Include="..\Data\Data.csproj" />
<ProjectReference Include="..\Modele\Model.csproj" /> <ProjectReference Include="..\Modele\Model.csproj" />

@ -11,7 +11,7 @@ public partial class AjoutBanques : ContentPage
{ {
InitializeComponent(); InitializeComponent();
BindingContext = Mgr; BindingContext = Mgr;
Mgr.importBanques(); //Mgr.importBanques();
if (OperatingSystem.IsIOS()) if (OperatingSystem.IsIOS())
{ {
boutonRetour.IsVisible = true; boutonRetour.IsVisible = true;
@ -29,12 +29,12 @@ public partial class AjoutBanques : ContentPage
{ {
if (result.FileName.EndsWith("ofx", StringComparison.OrdinalIgnoreCase)) if (result.FileName.EndsWith("ofx", StringComparison.OrdinalIgnoreCase))
{ {
IList<Compte> lesComptes = Mgr.getCompteFromOFX(result.FullPath); //IList<Compte> lesComptes = Mgr.getCompteFromOFX(result.FullPath);
Debug.WriteLine(lesComptes.Count); /*Debug.WriteLine(lesComptes.Count);
foreach(Compte compte in lesComptes) foreach(Compte compte in lesComptes)
{ {
Mgr.User.LesBanques.First().AjouterCompte(compte); Mgr.User.LesBanques.First().AjouterCompte(compte);
} }*/
} }
} }

@ -25,7 +25,7 @@ public partial class ChangePassword : ContentPage
} }
else else
{ {
Mgr.changePasswordBdd(MailUser, EntryNewMdp.Text); //Mgr.changePasswordBdd(MailUser, EntryNewMdp.Text);
AffichError("mdp changé", "mot de passe bien changé", "ok"); AffichError("mdp changé", "mot de passe bien changé", "ok");
NavigateTo("../.."); NavigateTo("../..");
} }

@ -17,11 +17,11 @@ public partial class DashBoard : ContentPage
} }
if (!Mgr.testConnexionAsDatabase()) /* if (!Mgr.testConnexionAsDatabase())
{ {
loadPage(new ErrorPage()); loadPage(new ErrorPage());
} }*/
} }

@ -22,10 +22,10 @@ public partial class ErrorPage : ContentPage
public void conIsActive() public void conIsActive()
{ {
while (!Mgr.testConnexionAsDatabase()) /*while (!Mgr.testConnexionAsDatabase())
{ {
Thread.Sleep(TIME_TEST_DB); Thread.Sleep(TIME_TEST_DB);
} }*/
ConnexionValide(); ConnexionValide();
return; return;

@ -20,7 +20,7 @@ public partial class ForgetPassword : ContentPage
{ {
AffichError("Email inconnue", "Aucun compte existant portant cette adresse mail", "OK"); AffichError("Email inconnue", "Aucun compte existant portant cette adresse mail", "OK");
} }
if (Mgr.existEmail(EntryMail.Text)){ /*if (Mgr.existEmail(EntryMail.Text)){
Random generator = new Random(); Random generator = new Random();
code = generator.Next(0, 1000000).ToString("D6"); code = generator.Next(0, 1000000).ToString("D6");
Email.CreateMail(EntryMail.Text, code); Email.CreateMail(EntryMail.Text, code);
@ -31,7 +31,7 @@ public partial class ForgetPassword : ContentPage
else else
{ {
AffichError("Mail inexistant", "Aucun compte possédant cette adresse email trouvé", "OK"); AffichError("Mail inexistant", "Aucun compte possédant cette adresse email trouvé", "OK");
} }*/
} }
private async void AffichError(string s, string s1, string s2) private async void AffichError(string s, string s1, string s2)
{ {

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

@ -20,7 +20,7 @@ public partial class Inscription : ContentPage
} }
else else
{ {
if(EntryNewPassword.Text.Equals(EntryConfirmationPassword.Text)) { /*if(EntryNewPassword.Text.Equals(EntryConfirmationPassword.Text)) {
if (Mgr.existEmail(EntryNewMail.Text)) if (Mgr.existEmail(EntryNewMail.Text))
{ {
AffichError("Mail existant", "un compte porte déjà cette adresse mail, veuillez en changer", "OK"); AffichError("Mail existant", "un compte porte déjà cette adresse mail, veuillez en changer", "OK");
@ -43,15 +43,15 @@ public partial class Inscription : ContentPage
else else
{ {
AffichError("Mot de passe de confirmation invalide", "Veuillez mettre deux mots de passe identiques", "OK"); AffichError("Mot de passe de confirmation invalide", "Veuillez mettre deux mots de passe identiques", "OK");
} }*/
} }
} }
private void ValideCode(object sender, EventArgs e) private void ValideCode(object sender, EventArgs e)
{ {
if (EntryCodeRecept.Text == code) if (EntryCodeRecept.Text == code)
{ {
Inscrit inscrit = new Inscrit(Mgr.lastInscrit() + 1, EntryNewName.Text, EntryNewMail.Text, EntryNewSurname.Text, EntryNewPassword.Text); //Inscrit inscrit = new Inscrit(Mgr.lastInscrit() + 1, EntryNewName.Text, EntryNewMail.Text, EntryNewSurname.Text, EntryNewPassword.Text);
Mgr.createInscrit(inscrit); //Mgr.createInscrit(inscrit);
AffichError("compte créé", "Compte bien créé", "OK"); AffichError("compte créé", "Compte bien créé", "OK");
NavigateTo(".."); NavigateTo("..");
} }

@ -21,7 +21,7 @@ namespace IHM.Mobile
AffichError("Champ invalide", "Veuillez compléter tout les champs", "OK"); AffichError("Champ invalide", "Veuillez compléter tout les champs", "OK");
} }
else { else {
if (Mgr.existEmail(EntryMail.Text)) /* if (Mgr.existEmail(EntryMail.Text))
{ {
if (Mgr.isEqualHash(Mgr.recupMdpBdd(EntryMail.Text), EntryPassworld.Text)) if (Mgr.isEqualHash(Mgr.recupMdpBdd(EntryMail.Text), EntryPassworld.Text))
{ {
@ -36,13 +36,13 @@ namespace IHM.Mobile
else else
{ {
AffichError("Compte inexistant", "Email ou mot de passe invalide", "OK"); AffichError("Compte inexistant", "Email ou mot de passe invalide", "OK");
} }*/
} }
} }
private async void ConnexionValide() private async void ConnexionValide()
{ {
Mgr.LoadBanques(); //Mgr.LoadBanques();
await Navigation.PopModalAsync(); await Navigation.PopModalAsync();
} }

@ -1,4 +1,5 @@
using System; using Newtonsoft.Json;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
@ -27,6 +28,7 @@ namespace Model
} }
private List<Compte> listeDesComptes = new List<Compte>(); private List<Compte> listeDesComptes = new List<Compte>();
[JsonConstructor]
public Banque(string nom, string urlSite, string urlLogo) public Banque(string nom, string urlSite, string urlLogo)
{ {
Nom = nom; Nom = nom;
@ -72,5 +74,10 @@ namespace Model
throw new KeyNotFoundException(); throw new KeyNotFoundException();
} }
public override string ToString()
{
return Nom + " " + UrlSite + " " + UrlLogo;
}
} }
} }

@ -1,5 +1,4 @@
using Microsoft.Maui.Graphics; using Newtonsoft.Json;
using System.Collections.Specialized;
using System.ComponentModel; using System.ComponentModel;
namespace Model namespace Model
@ -26,13 +25,19 @@ namespace Model
private List<Operation> lesOpe = new List<Operation>(); private List<Operation> lesOpe = new List<Operation>();
public List<Planification> LesPla { get; set; } = new List<Planification>(); public List<Planification> LesPla { get; set; } = new List<Planification>();
public List<Echeance> LesEch { get; set; } = new List<Echeance>(); public List<Echeance> LesEch { get; set; } = new List<Echeance>();
public Compte(string id,string nom, double solde)
[JsonConstructor]
public Compte(string id, string nom)
{ {
Identifiant = id; Identifiant = id;
Nom = nom; Nom = nom;
Solde = solde; Solde = 0;
DerniereModification = DateTime.Now; DerniereModification = DateTime.Now;
} }
public Compte(string id,string nom, double solde) : base()
{
Solde = solde;
}
public Compte(string id, string nom, double solde, List<Operation> lesOpe) public Compte(string id, string nom, double solde, List<Operation> lesOpe)
{ {
Identifiant = id; Identifiant = id;
@ -125,7 +130,7 @@ namespace Model
public override string ToString() public override string ToString()
{ {
return Identifiant + " " + Nom + " " + Solde + " " + DerniereModification + "\n"; return Identifiant + " " + Nom + " " + Solde + " " + DerniereModification;
} }
} }

@ -1,5 +1,7 @@
using System; using Newtonsoft.Json;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -8,5 +10,33 @@ namespace Model
{ {
public class Echeance public class Echeance
{ {
public string IntituleOperation { get; private set; }
public double Montant { get; private set; }
public DateTime DateOperation { get; private set; }
public MethodePayement ModePayement { get; private set; }
public bool IsDebit { get; private set; }
public TagOperation Tag { get; private set; }
[JsonConstructor]
public Echeance(string intituleOperation, double montant, DateTime dateOperation, MethodePayement modePayement, TagOperation tag, bool isDebit = true)
{
IntituleOperation = intituleOperation;
Montant = montant;
DateOperation = dateOperation;
ModePayement = modePayement;
IsDebit = isDebit;
Tag = tag;
}
public override string ToString()
{
return IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + " " + Tag;
}
} }
} }

@ -8,21 +8,50 @@ namespace Model
{ {
public interface IPersistanceManager public interface IPersistanceManager
{ {
string GetId(string mail); // /!\ Toutes les méthodes ici permettent d'uniquement manipuler une stratégie de persistance
void SupprimerInscritBdd(Inscrit inscrit); // /!\ et ne doit en aucun cas manipuler la mémoire !
void SupprimerBanqueBdd(Inscrit inscrit, Banque banque);
void SupprimerToutesBanquesBdd(Inscrit inscrit); //actions sur les inscrits
void CreateInscrit(Inscrit inscrit); bool AjouterInscrit(Inscrit inscrit);
string LastInscrit(); bool SupprimerInscrit(Inscrit inscrit);
bool ExistEmail(string mail); bool ModifierMdpInscrit(string mail, string nouveauMdp);
void ChangePasswordBdd(string mail, string newMdp); Inscrit RecupererInscrit(string mail);
string RecupMdpBdd(string mail); bool EmailDisponible(string mail);
int CalculTotalSoldeComtpe(Inscrit user);
List<Banque> LoadBanqueId(string id);
public bool TestConnexionAsDatabase(); //actions sur les banques
public List<Banque> ImportBanques(); bool AjouterBanque(Banque banque, Inscrit inscrit);
public Inscrit GetInscrit(string mail); bool SupprimerBanque(Banque banque, Inscrit inscrit);
IList<Banque> RecupererBanques(Inscrit inscrit);
public IList<Compte> GetCompteFromOFX(string ofx); IList<Banque> RecupererBanquesDisponible();
//actions sur les comptes
bool AjouterCompte(Compte compte, Inscrit inscrit);
bool SupprimerCompte(Compte compte, Inscrit inscrit);
IList<Compte> RecupererCompte(Banque banque, Inscrit inscrit);
//actions sur les Opérations
bool AjouterOperation(Compte compte, Operation operation);
bool SupprimerOperation(Compte compte, Operation operation);
IList<Operation> RecupererOperation(Compte compte);
//actions sur les Planifications
bool AjouterPlanification(Compte compte, Planification planification);
bool SupprimerPlanification(Compte compte, Planification planification);
IList<Planification> RecupererPlanification(Compte compte);
//actions sur les Echéances
bool AjouterEcheance(Compte compte, Echeance echeance);
bool SupprimerEcheance(Compte compte, Echeance echeance);
IList<Echeance> RecupererEcheance(Compte compte);
//actions utilitaire
bool TestConnexion();
} }
} }

@ -6,6 +6,7 @@ using System.Text.RegularExpressions;
using Model; using Model;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.ComponentModel; using System.ComponentModel;
using Newtonsoft.Json;
namespace Model namespace Model
{ {
@ -15,8 +16,9 @@ namespace Model
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
public string Id { get; private set; } public int Id { get; set; }
public string Nom { get; private set; } public string Nom { get; set; }
public string Prenom { get; set; }
public string Mail public string Mail
{ {
@ -36,7 +38,7 @@ namespace Model
} }
private string mail; private string mail;
public string Prenom { get; set; }
public string Mdp public string Mdp
{ {
@ -77,8 +79,10 @@ namespace Model
} }
} }
private List<Banque> lesBanques =new(); private List<Banque> lesBanques;
public Inscrit(string id, string nom, string mail, string prenom, string mdp, double soldeTotal = 0)
[JsonConstructor]
public Inscrit(int id, string nom, string mail, string prenom, string mdp, double soldeTotal = 0)
{ {
Id = id; Id = id;
Nom = nom; Nom = nom;
@ -88,24 +92,16 @@ namespace Model
SoldeTotal = soldeTotal; SoldeTotal = soldeTotal;
lesBanques = new(); lesBanques = new();
} }
public Inscrit(string 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)
{ {
LesBanques = lesbanques; LesBanques = lesbanques;
} }
public Inscrit(string mail, string id)
{
Prenom = "Lucas";
Mail = mail;
Id = id;
}
public Inscrit(List<Banque> lesbanques) public Inscrit(List<Banque> lesbanques)
{ {
LesBanques = lesbanques; LesBanques = lesbanques;
} }
public void ajouterBanque(Banque banque) public void ajouterBanque(Banque banque)
{ {
@ -123,5 +119,9 @@ namespace Model
Dev = devise; Dev = devise;
} }
public override string ToString()
{
return Id + " " + Nom + " " + Prenom + " " + Mail + " " + Mdp;
}
} }
} }

@ -79,91 +79,21 @@ namespace Model
Pers = persistance; Pers = persistance;
} }
public void SupprimerInscritBdd(Inscrit i)
{
Pers.SupprimerInscritBdd(i);
}
public string GetId(string mail)
{
return Pers.GetId(mail);
}
public void LoadBanques()
{
User.LesBanques = Pers.LoadBanqueId(User.Id);
if (User.LesBanques.Count() > 0)
{
SelectedBanque = User.LesBanques[0];
}
}
public void supprimerToutesBanquesBdd(Inscrit inscrit)
{
Pers.SupprimerToutesBanquesBdd(inscrit);
}
public void createInscrit(Inscrit inscrit)
{
Pers.CreateInscrit(inscrit);
}
public string lastInscrit()
{
return Pers.LastInscrit();
}
public bool existEmail(string mail)
{
return Pers.ExistEmail(mail);
}
public void changePasswordBdd(string mail, string newMdp)
{
Pers.ChangePasswordBdd(mail, newMdp);
}
public string recupMdpBdd(string mail)
{
return Pers.RecupMdpBdd(mail);
}
public bool isEqualHash(string mdpBdd, string mdpSent) public bool isEqualHash(string mdpBdd, string mdpSent)
{ {
return hash.IsEqualHash(mdpBdd, mdpSent); return hash.IsEqualHash(mdpBdd, mdpSent);
} }
public void createUser(string mail)
{
//User = new Inscrit(mail, GetId(mail));
User = Pers.GetInscrit(mail);
}
public int recupTotalSolde()
{
Solde = Pers.CalculTotalSoldeComtpe(User);
return Solde;
}
public void deconnexion() public void deconnexion()
{ {
User = null; User = null;
} }
public bool testConnexionAsDatabase()
{
return Pers.TestConnexionAsDatabase();
}
public void importBanques()
{
BanquesDisponibleInApp = Pers.ImportBanques();
}
public IList<Compte> getCompteFromOFX(string ofx)
{
return Pers.GetCompteFromOFX(ofx);
}
} }
} }

@ -12,6 +12,7 @@ namespace Model
Cb, Cb,
Esp, Esp,
Chq, Chq,
Vir Vir,
Pre
} }
} }

@ -17,4 +17,8 @@
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>
</Project> </Project>

@ -12,4 +12,8 @@
<None Remove="Platforms\**" /> <None Remove="Platforms\**" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>
</Project> </Project>

@ -1,4 +1,5 @@
using System; using Newtonsoft.Json;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
@ -32,20 +33,27 @@ namespace Model
public bool IsDebit { get; private set; } public bool IsDebit { get; private set; }
public Operation(string intituleOperation, double montant, DateTime dateOperation, MethodePayement modePayement, bool isDebit=true) public TagOperation Tag { get; private set; }
public bool FromBanque { get; private set; }
[JsonConstructor]
public Operation(string intituleOperation, double montant, DateTime dateOperation, MethodePayement modePayement, TagOperation tag, bool fromBanque, bool isDebit=true)
{ {
IntituleOperation = intituleOperation; IntituleOperation = intituleOperation;
Montant = montant; Montant = montant;
DateOperation = dateOperation; DateOperation = dateOperation;
ModePayement = modePayement; ModePayement = modePayement;
IsDebit = isDebit; IsDebit = isDebit;
Tag = tag;
FromBanque = fromBanque;
} }
void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public override string ToString() public override string ToString()
{ {
return IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + "\n"; return IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + " " + FromBanque + " " + Tag;
} }
} }
} }

@ -1,12 +1,42 @@
using System; using Microsoft.Maui.Controls;
using Newtonsoft.Json;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Model namespace Model
{ {
public class Planification public class Planification
{ {
public string IntituleOperation { get; private set; }
public double Montant { get; private set; }
public DateTime DateOperation { get; private set; }
public MethodePayement ModePayement { get; private set; }
public bool IsDebit { get; private set; }
public TagOperation Tag { get; private set; }
[JsonConstructor]
public Planification(string intituleOperation, double montant, DateTime dateOperation, MethodePayement modePayement, TagOperation tag, bool isDebit = true)
{
IntituleOperation = intituleOperation;
Montant = montant;
DateOperation = dateOperation;
ModePayement = modePayement;
IsDebit = isDebit;
Tag = tag;
}
public override string ToString()
{
return IntituleOperation + " " + DateOperation + " " + Montant + " " + ModePayement + " " + IsDebit + " " + Tag;
}
} }
} }

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public enum TagOperation
{
None,
Alimentaire,
Carburant,
Habitation,
Energie,
Telephonie,
Loisir,
Restauration,
Divers,
Transport,
Transaction,
Santé
}
}

@ -1,6 +1,13 @@
using Data; using Data;
using Model; using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Net.Http.Headers;
using System.Security.Principal;
using System.Xml.Linq;
//test OFX
/*
Console.WriteLine("Test Deserializer OFX - simplifié"); Console.WriteLine("Test Deserializer OFX - simplifié");
IList<Compte> comptes= new List<Compte>(); IList<Compte> comptes= new List<Compte>();
@ -16,4 +23,226 @@ foreach (Compte compte in comptes)
{ {
Console.WriteLine("\t\t"+operation); Console.WriteLine("\t\t"+operation);
} }
}
*/
//test APIClient
Console.WriteLine("Test ClientAPI");
Console.WriteLine("\n\nEtat API : " + ClientAPI.GetStateApi().GetAwaiter().GetResult());
Console.WriteLine("\n\n\n----Inscrits----\n");
IList<Inscrit> res = ClientAPI.GetInscritsAsync().GetAwaiter().GetResult();
foreach(Inscrit i in res)
{
Console.WriteLine(i);
}
Console.WriteLine("\n--------\n");
IList<Inscrit> inscrit = ClientAPI.GetInscritAsync("renaudtoutnu@gmail.com").GetAwaiter().GetResult();
foreach (Inscrit i in inscrit)
{
Console.WriteLine(i);
}
Console.WriteLine("\n----Modifs----\n");
bool r = ClientAPI.PutPasswordInscritAsync("lucasevard@gmail.com", "CeciEstUnNouveauMdp123456789!").GetAwaiter().GetResult();
Console.WriteLine("Changement de mdp : "+r+"\n");
bool rr = ClientAPI.PostAddInscritAsync("LIVET", "Hugo", "livet.hugo2003@gmail.com", "EnAvantOuiOui!0").GetAwaiter().GetResult();
Console.WriteLine("Ajout user : " + rr + "\n");
Console.WriteLine("\n----Resultats----\n");
IList<Inscrit> modif = ClientAPI.GetInscritsAsync().GetAwaiter().GetResult();
foreach (Inscrit i in modif)
{
Console.WriteLine(i);
}
Console.WriteLine("\n----Modifs----\n");
bool rrr = ClientAPI.DeleteInscritAsync("livet.hugo2003@gmail.com").GetAwaiter().GetResult();
Console.WriteLine("Del user : " + rrr + "\n");
modif = ClientAPI.GetInscritsAsync().GetAwaiter().GetResult();
foreach (Inscrit i in modif)
{
Console.WriteLine(i);
}
Console.WriteLine("\n\n\n----Banques----\n");
IList<Banque> banques = ClientAPI.GetBanquesAsync().GetAwaiter().GetResult();
foreach (Banque b in banques)
{
Console.WriteLine(b);
}
Console.WriteLine("\n--------\n");
IList<Banque> banquesId1 = ClientAPI.GetBanqueAsync("1").GetAwaiter().GetResult();
foreach (Banque b in banquesId1)
{
Console.WriteLine(b);
}
Console.WriteLine("\n----Modifs----\n");
bool rrrr = ClientAPI.PostAddBanqueInscritAsync("ORANGE BANK","1").GetAwaiter().GetResult();
Console.WriteLine("Add banque for user : " + rrrr + "\n");
Console.WriteLine("\n----Verif----\n");
banquesId1 = ClientAPI.GetBanqueAsync("1").GetAwaiter().GetResult();
foreach (Banque b in banquesId1)
{
Console.WriteLine(b);
}
Console.WriteLine("\n----Modifs----\n");
bool rrrrrr = ClientAPI.DeleteBanqueInscritAsync("ORANGE BANK", "1").GetAwaiter().GetResult();
Console.WriteLine("Del banque for user : " + rrrrrr + "\n");
Console.WriteLine("\n----Verif----\n");
banquesId1 = ClientAPI.GetBanqueAsync("1").GetAwaiter().GetResult();
foreach (Banque b in banquesId1)
{
Console.WriteLine(b);
}
Console.WriteLine("\n\n\n----Comptes----\n");
IList<Compte> comptes = ClientAPI.GetCompteAsync("1").GetAwaiter().GetResult();
foreach (Compte c in comptes)
{
Console.WriteLine(c);
}
Console.WriteLine("\n----Modifs----\n");
bool rrrrrrr = ClientAPI.PostAddCompteInscritAsync("PEL","1").GetAwaiter().GetResult();
Console.WriteLine("Add Compte for user : " + rrrrrrr + "\n");
Console.WriteLine("\n----Verif----\n");
comptes = ClientAPI.GetCompteAsync("1").GetAwaiter().GetResult();
foreach (Compte c in comptes)
{
Console.WriteLine(c);
}
rrrrrrr = ClientAPI.DeleteCompteInscritAsync("PEL", "1").GetAwaiter().GetResult();
Console.WriteLine("Del Compte for user : " + rrrrrrr + "\n");
Console.WriteLine("\n----Verif----\n");
comptes = ClientAPI.GetCompteAsync("1").GetAwaiter().GetResult();
foreach (Compte c in comptes)
{
Console.WriteLine(c);
}
Console.WriteLine("\n\n\n----Operations----\n");
IList<Operation> operations = ClientAPI.GetOperationAsync("1").GetAwaiter().GetResult();
foreach (Operation o in operations)
{
Console.WriteLine(o);
}
Console.WriteLine("\n----Modifs----\n");
rrrrrrr = ClientAPI.PostAddOperationInscritAsync(new Compte("1","PEL"), new Operation("test",100,DateTime.Now,MethodePayement.Cb, TagOperation.Alimentaire, true, true)).GetAwaiter().GetResult();
Console.WriteLine("Add Ope On Compte : " + rrrrrrr + "\n");
Console.WriteLine("\n----Verif----\n");
operations = ClientAPI.GetOperationAsync("1").GetAwaiter().GetResult();
foreach (Operation o in operations)
{
Console.WriteLine(o);
}
Console.WriteLine("\n----Modifs----\n");
rrrrrrr = ClientAPI.DeleteOperationInscritAsync("1", "test").GetAwaiter().GetResult();
Console.WriteLine("Del Ope On Compte : " + rrrrrrr + "\n");
Console.WriteLine("\n----Verif----\n");
operations = ClientAPI.GetOperationAsync("1").GetAwaiter().GetResult();
foreach (Operation o in operations)
{
Console.WriteLine(o);
}
Console.WriteLine("\n\n\n----Planifications----\n");
IList<Planification> planifications = ClientAPI.GetPlanificationAsync("1").GetAwaiter().GetResult();
foreach (Planification p in planifications)
{
Console.WriteLine(p);
}
Console.WriteLine("\n----Modifs----\n");
rrrrrrr = ClientAPI.PostAddPlanificationInscritAsync(new Compte("1", "PEL"), new Planification("test", 100, DateTime.Now, MethodePayement.Cb, TagOperation.Alimentaire, true)).GetAwaiter().GetResult();
Console.WriteLine("Add Pla On Compte : " + rrrrrrr + "\n");
Console.WriteLine("\n----Verif----\n");
planifications = ClientAPI.GetPlanificationAsync("1").GetAwaiter().GetResult();
foreach (Planification p in planifications)
{
Console.WriteLine(p);
}
Console.WriteLine("\n----Modifs----\n");
rrrrrrr = ClientAPI.DeletePlanificationInscritAsync("1", "test").GetAwaiter().GetResult();
Console.WriteLine("Del Pla On Compte : " + rrrrrrr + "\n");
Console.WriteLine("\n----Verif----\n");
planifications = ClientAPI.GetPlanificationAsync("1").GetAwaiter().GetResult();
foreach (Planification p in planifications)
{
Console.WriteLine(p);
}
Console.WriteLine("\n\n\n----Echeances----\n");
IList<Echeance> echeances = ClientAPI.GetEcheanceAsync("1").GetAwaiter().GetResult();
foreach (Echeance e in echeances)
{
Console.WriteLine(e);
}
Console.WriteLine("\n----Modifs----\n");
rrrrrrr = ClientAPI.PostAddEcheanceInscritAsync(new Compte("1", "PEL"), new Echeance("test", 100, DateTime.Now, MethodePayement.Cb, TagOperation.Alimentaire, true)).GetAwaiter().GetResult();
Console.WriteLine("Add Ech On Compte : " + rrrrrrr + "\n");
Console.WriteLine("\n----Verif----\n");
echeances = ClientAPI.GetEcheanceAsync("1").GetAwaiter().GetResult();
foreach (Echeance e in echeances)
{
Console.WriteLine(e);
}
Console.WriteLine("\n----Modifs----\n");
rrrrrrr = ClientAPI.DeleteEcheanceInscritAsync("1", "test").GetAwaiter().GetResult();
Console.WriteLine("Del Ech On Compte : " + rrrrrrr + "\n");
Console.WriteLine("\n----Verif----\n");
echeances = ClientAPI.GetEcheanceAsync("1").GetAwaiter().GetResult();
foreach (Echeance e in echeances)
{
Console.WriteLine(e);
} }

@ -7,6 +7,10 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Data\Data.csproj" /> <ProjectReference Include="..\Data\Data.csproj" />
<ProjectReference Include="..\Modele\Model.csproj" /> <ProjectReference Include="..\Modele\Model.csproj" />

@ -7,6 +7,10 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Data\Data_CI.csproj" /> <ProjectReference Include="..\Data\Data_CI.csproj" />
<ProjectReference Include="..\Modele\Model_CI.csproj" /> <ProjectReference Include="..\Modele\Model_CI.csproj" />

@ -25,7 +25,7 @@ namespace TestsUnitaires
public void TestConstructeurCompte2() public void TestConstructeurCompte2()
{ {
List<Operation> testlistope = new(); List<Operation> testlistope = new();
Operation testope = new("test", 20, DateTime.Now, MethodePayement.Cb); Operation testope = new("test", 20, DateTime.Now, MethodePayement.Cb, TagOperation.Alimentaire, true, true);
testlistope.Add(testope); testlistope.Add(testope);
Compte c1 = new("012345678901", "Livret A", 234,testlistope); Compte c1 = new("012345678901", "Livret A", 234,testlistope);
Compte c2 = new("012345678902", "&e23R_te7", 1245.34, testlistope); Compte c2 = new("012345678902", "&e23R_te7", 1245.34, testlistope);
@ -48,7 +48,7 @@ namespace TestsUnitaires
public void testAjouterOperation() public void testAjouterOperation()
{ {
Compte c1 = new("012345678901", "Livret A", 234); Compte c1 = new("012345678901", "Livret A", 234);
c1.ajouterOperation(new("test", 20, DateTime.Now, MethodePayement.Cb)); c1.ajouterOperation(new("test", 20, DateTime.Now, MethodePayement.Cb, TagOperation.Alimentaire, true, true));
Assert.True(c1.LesOpe.Count() == 1); Assert.True(c1.LesOpe.Count() == 1);
} }
@ -56,7 +56,7 @@ namespace TestsUnitaires
public void testSupprimerOperation() public void testSupprimerOperation()
{ {
Compte c1 = new("012345678901", "Livret A", 234); Compte c1 = new("012345678901", "Livret A", 234);
Operation testope = new("test", 20, DateTime.Now, MethodePayement.Cb); Operation testope = new("test", 20, DateTime.Now, MethodePayement.Cb, TagOperation.Alimentaire, true, true);
c1.ajouterOperation(testope); c1.ajouterOperation(testope);
Assert.True(c1.LesOpe.Count() == 1); Assert.True(c1.LesOpe.Count() == 1);
c1.supprimerOperation(testope); c1.supprimerOperation(testope);
@ -68,7 +68,7 @@ namespace TestsUnitaires
public void testSupprimerBanque() public void testSupprimerBanque()
{ {
Banque bq = new Banque("Crédit Agricole", "https://creditagricole.fr", "https://yt3.ggpht.com/a/AGF-l7_mEfX2eQaGm8GefLOg5ZMRciNw-pESE3gUWg=s900-c-k-c0xffffffff-no-rj-mo"); Banque bq = new Banque("Crédit Agricole", "https://creditagricole.fr", "https://yt3.ggpht.com/a/AGF-l7_mEfX2eQaGm8GefLOg5ZMRciNw-pESE3gUWg=s900-c-k-c0xffffffff-no-rj-mo");
Inscrit i1 = new Inscrit("A1001", "Smith", "smith@gmail.com", "luke", "test20000aA", 500); Inscrit i1 = new Inscrit(1, "Smith", "smith@gmail.com", "luke", "test20000aA", 500);
Assert.NotNull(i1.LesBanques); Assert.NotNull(i1.LesBanques);
i1.ajouterBanque(bq); i1.ajouterBanque(bq);
Assert.Contains(bq, i1.LesBanques); Assert.Contains(bq, i1.LesBanques);

@ -12,9 +12,9 @@ namespace TestsUnitaires
[Fact] [Fact]
public void testCtorInscrit() public void testCtorInscrit()
{ {
Inscrit i = new Inscrit("I001", "LIVET", "Hugo.LIVET@etu.uca.fr", "Hugo", "Tu Sauras Passss:)1215", 2000); Inscrit i = new Inscrit(1, "LIVET", "Hugo.LIVET@etu.uca.fr", "Hugo", "Tu Sauras Passss:)1215", 2000);
Assert.NotNull(i); Assert.NotNull(i);
Assert.Equal("I001", i.Id); Assert.Equal(1, i.Id);
Assert.Equal("LIVET", i.Nom); Assert.Equal("LIVET", i.Nom);
Assert.Equal("Hugo.LIVET@etu.uca.fr", i.Mail); Assert.Equal("Hugo.LIVET@etu.uca.fr", i.Mail);
Assert.Equal("Hugo", i.Prenom); Assert.Equal("Hugo", i.Prenom);
@ -28,9 +28,9 @@ namespace TestsUnitaires
List<Banque> lesBanques = new List<Banque>(); List<Banque> lesBanques = new List<Banque>();
Banque b = new Banque("CA", "enavantouioui.fr", "NaN.fr"); Banque b = new Banque("CA", "enavantouioui.fr", "NaN.fr");
lesBanques.Add(b); lesBanques.Add(b);
Inscrit i = new Inscrit("I001", "LIVET", "Hugo.LIVET@etu.uca.fr", "Hugo", "Tu Sauras Passss:)1215", 2000, lesBanques); Inscrit i = new Inscrit(1, "LIVET", "Hugo.LIVET@etu.uca.fr", "Hugo", "Tu Sauras Passss:)1215", 2000, lesBanques);
Assert.NotNull(i); Assert.NotNull(i);
Assert.Equal("I001", i.Id); Assert.Equal(1, i.Id);
Assert.Equal("LIVET", i.Nom); Assert.Equal("LIVET", i.Nom);
Assert.Equal("Hugo.LIVET@etu.uca.fr", i.Mail); Assert.Equal("Hugo.LIVET@etu.uca.fr", i.Mail);
Assert.Equal("Hugo", i.Prenom); Assert.Equal("Hugo", i.Prenom);
@ -45,7 +45,7 @@ namespace TestsUnitaires
public void testAjoutBanqueInscrit() public void testAjoutBanqueInscrit()
{ {
Banque b = new Banque("CA", "enavantouioui.fr", "NaN.fr"); Banque b = new Banque("CA", "enavantouioui.fr", "NaN.fr");
Inscrit i = new Inscrit("I001", "LIVET", "Hugo.LIVET@etu.uca.fr", "Hugo", "Tu Sauras Passss:)1215", 2000); Inscrit i = new Inscrit(1, "LIVET", "Hugo.LIVET@etu.uca.fr", "Hugo", "Tu Sauras Passss:)1215", 2000);
i.ajouterBanque(b); i.ajouterBanque(b);
Assert.Contains(b, i.LesBanques); Assert.Contains(b, i.LesBanques);
} }
@ -54,7 +54,7 @@ namespace TestsUnitaires
public void testSupprimerBanqueInscrit() public void testSupprimerBanqueInscrit()
{ {
Banque b = new Banque("CA", "enavantouioui.fr", "NaN.fr"); Banque b = new Banque("CA", "enavantouioui.fr", "NaN.fr");
Inscrit i = new Inscrit("I001", "LIVET", "Hugo.LIVET@etu.uca.fr", "Hugo", "Tu Sauras Passss:)1215", 2000); Inscrit i = new Inscrit(1, "LIVET", "Hugo.LIVET@etu.uca.fr", "Hugo", "Tu Sauras Passss:)1215", 2000);
i.ajouterBanque(b); i.ajouterBanque(b);
i.SupprimerBanque(b); i.SupprimerBanque(b);
Assert.DoesNotContain(b, i.LesBanques); Assert.DoesNotContain(b, i.LesBanques);
@ -66,17 +66,17 @@ namespace TestsUnitaires
[Fact] [Fact]
public void testChoixDeviseInscrit() public void testChoixDeviseInscrit()
{ {
Inscrit i = new Inscrit("I001", "LIVET", "Hugo.LIVET@etu.uca.fr", "Hugo", "Tu Sauras Passss:)1215", 2000); Inscrit i = new Inscrit(1, "LIVET", "Hugo.LIVET@etu.uca.fr", "Hugo", "Tu Sauras Passss:)1215", 2000);
i.ChoisirDevise(Devises.Euro); i.ChoisirDevise(Devises.Euro);
Assert.Equal(Devises.Euro, i.Dev); Assert.Equal(Devises.Euro, i.Dev);
} }
[Theory] [Theory]
[InlineData("I000001", "LIVET", "a@a.fr", "Hugo", "123Soleil@azerty", 20000, true)]//OK [InlineData(1, "LIVET", "a@a.fr", "Hugo", "123Soleil@azerty", 20000, true)]//OK
[InlineData("I000002", "LIVET", "aa.fr", "Hugo", "123Soleil@azerty", 20000, false)]//Mail invalide psk pas de @ [InlineData(2, "LIVET", "aa.fr", "Hugo", "123Soleil@azerty", 20000, false)]//Mail invalide psk pas de @
[InlineData("I000003", "LIVET", "a@a.fr", "Hugo", "123soleil@azerty", 20000, false)]//mdp Invalide psk mdp sans Maj [InlineData(3, "LIVET", "a@a.fr", "Hugo", "123soleil@azerty", 20000, false)]//mdp Invalide psk mdp sans Maj
[InlineData("I000004", "LIVET", "a@a.fr", "Hugo", "Soleil@azerty", 20000, false)]//mdp Invalide psk pas de chiffres [InlineData(4, "LIVET", "a@a.fr", "Hugo", "Soleil@azerty", 20000, false)]//mdp Invalide psk pas de chiffres
public void CtorInscrit2TU(string id, string nom, string mail, string prenom, string mdp, double solde, bool notShouldThrowException) public void CtorInscrit2TU(int id, string nom, string mail, string prenom, string mdp, double solde, bool notShouldThrowException)
{ {
if (!notShouldThrowException) if (!notShouldThrowException)
{ {

@ -1,4 +1,5 @@
using LinqToPgSQL; using Data;
using LinqToPgSQL;
using Model; using Model;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -13,7 +14,7 @@ namespace TestsUnitaires
[Fact] [Fact]
public void testLoadInscrit() public void testLoadInscrit()
{ {
Manager m = new Manager(new PersLinqToPgSQL()); Manager m = new Manager(new PersAPI());
//Assert.Null(m.SelectedBanque); //Assert.Null(m.SelectedBanque);
//m.LoadInscrit("lucasevard@gmail.com", "test"); //m.LoadInscrit("lucasevard@gmail.com", "test");
//Assert.Equal(m.SelectedInscrits, "00001"); //Assert.Equal(m.SelectedInscrits, "00001");

@ -10,6 +10,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

@ -10,6 +10,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

Loading…
Cancel
Save