merger C# to master

pull/41/head
Antoine PEREDERII 2 years ago
commit d71d636358

@ -40,8 +40,8 @@ steps:
- dotnet restore Banquale.sln - dotnet restore Banquale.sln
- dotnet sonarscanner begin /k:"Banquale" /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.login=$${PLUGIN_SONAR_TOKEN} - dotnet sonarscanner begin /k:"Banquale" /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
- dotnet build Banquale.sln -c Release --no-restore - dotnet build Banquale.sln -c Release --no-restore
# - dotnet test Banquale.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" - dotnet test Banquale.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
# - reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport" - reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
# - dotnet publish Banquale/Banquale.csproj -c Release --no-restore -o $CI_PROJECT_DIR/build/release -f:net7.0-android /p:AndroidSdkDirectory=/usr/lib/android-sdk # - dotnet publish Banquale/Banquale.csproj -c Release --no-restore -o $CI_PROJECT_DIR/build/release -f:net7.0-android /p:AndroidSdkDirectory=/usr/lib/android-sdk
- dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN} - dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
depends_on: [tests] depends_on: [tests]

File diff suppressed because it is too large Load Diff

@ -13,9 +13,9 @@ public partial class App : Application
public App() public App()
{ {
MyManager.ChargeDonnee(); MyManager.DataLoad();
MyManager.Persistance = new DataContractPersistance.DataContractPers(); MyManager.Persistence = new DataContractPersistance.DataContractPers();
MyManager.SauvegardeDonnee(); MyManager.DataSave();
InitializeComponent(); InitializeComponent();

@ -9,9 +9,9 @@ public partial class AppShell : Shell
InitializeComponent(); InitializeComponent();
Routing.RegisterRoute("balance/categorydetails", typeof(CategoryPage)); Routing.RegisterRoute("balance/categorydetails", typeof(CategoryPage));
Routing.RegisterRoute("newpagedetails", typeof(NewPage1)); Routing.RegisterRoute("newpagedetails", typeof(NewPage1));
//Routing.RegisterRoute("menu/requestdetails", typeof(RequestPage)); Routing.RegisterRoute("menu/requestdetails", typeof(RequestPage));
//Routing.RegisterRoute("menu/ribdetails", typeof(RibPage)); Routing.RegisterRoute("menu/ribdetails", typeof(RibPage));
//Routing.RegisterRoute("menu/transferdetails", typeof(TransferPage)); Routing.RegisterRoute("menu/transferdetails", typeof(TransferPage));
} }
} }

@ -8,31 +8,31 @@ using System.Xml;
namespace Banquale.DataContractPersistance namespace Banquale.DataContractPersistance
{ {
public class DataContractPers : IPersistanceManager public class DataContractPers : IPersistenceManager
{ {
public string FilePath { get; set; } = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/datbase.xml"; public string FilePath { get; set; } = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/datbase.xml";
public string FileName { get; set; } = "ClientAndTransactionsList.xml"; public string FileName { get; set; } = "ClientAndTransactionsList.xml";
public (List<Client>, List<Transactions>) ChargeDonnee() public (List<Customer>, List<Transactions>) DataLoad()
{ {
var serializer = new DataContractSerializer(typeof(List<Client>)); var serializer = new DataContractSerializer(typeof(List<Customer>));
List<Client> ListClients; List<Customer> CustomersList;
using (Stream s = File.OpenRead(Path.Combine(FilePath, FileName))) using (Stream s = File.OpenRead(Path.Combine(FilePath, FileName)))
{ {
ListClients = serializer.ReadObject(s) as List<Client>; CustomersList = serializer.ReadObject(s) as List<Customer>;
} }
return (ListClients, new List<Transactions>()); return (CustomersList, new List<Transactions>());
} }
public void SauvegardeDonnee(List<Client> c, List<Transactions> t) public void DataSave(List<Customer> c, List<Transactions> t)
{ {
var serializer = new DataContractSerializer(typeof(List<Client>)); var serializer = new DataContractSerializer(typeof(List<Customer>));
if(!Directory.Exists(FilePath)) if(!Directory.Exists(FilePath))
{ {
Debug.WriteLine("Directory crée à l'instant"); Debug.WriteLine("Directory created");
Debug.WriteLine(FilePath); Debug.WriteLine(FilePath);
Directory.CreateDirectory(FilePath); Directory.CreateDirectory(FilePath);
} }

@ -5,7 +5,7 @@ namespace Banquale.DataContractPersistance
{ {
public class DataToPersist public class DataToPersist
{ {
public List<Client> clients { get; set; } = new List<Client>(); public List<Customer> customer { get; set; } = new List<Customer>();
public List<Transactions> transactions { get; set; } = new List<Transactions>(); public List<Transactions> transactions { get; set; } = new List<Transactions>();
} }
} }

@ -8,10 +8,13 @@ using System.Threading.Tasks;
namespace Banquale.Model namespace Banquale.Model
{ {
public class Compte : INotifyPropertyChanged public class Account : INotifyPropertyChanged
{ {
public event PropertyChangedEventHandler PropertyChanged;
public event PropertyChangedEventHandler PropertyChanged; public int Balance { get; set; }
public string Name { get; set;}
void OnPropertyChanged(string propertyName) void OnPropertyChanged(string propertyName)
{ {
@ -59,7 +62,6 @@ namespace Banquale.Model
} }
private string iBAN; private string iBAN;
public List<Transactions> CompteList { get; set; }
public Compte(int solde, string nom, string iBAN) public Compte(int solde, string nom, string iBAN)
{ {
@ -67,5 +69,6 @@ namespace Banquale.Model
Nom = nom; Nom = nom;
IBAN = iBAN; IBAN = iBAN;
} }
public List<Transactions> TransactionsList { get; set; }
} }
} }

@ -9,13 +9,13 @@ using System.Threading.Tasks;
namespace Banquale.Model namespace Banquale.Model
{ {
[DataContract] [DataContract]
public class Client: Personne public class Customer : Person
{ {
[DataMember] [DataMember]
public List<Compte> ListeComptes { get; private set; } public List<Account> AccountsList { get; private set; }
public Client(string nom, string prenom, string mdp) : base(nom, prenom, mdp) public Customer(string name, string firstName, string password) : base(name, firstName, password)
{} {}
//public bool DoTransactions(string name, string IBAN, float montant) //public bool DoTransactions(string name, string IBAN, float montant)

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Banquale.Model
{
public interface IPersistenceManager
{
public (List<Customer>, List<Transactions>) DataLoad();
void DataSave(List<Customer> c, List<Transactions> t);
}
}

@ -7,56 +7,56 @@ namespace Banquale.Model
public class Manager public class Manager
{ {
[DataMember] [DataMember]
public List<Client> ListeClients { get; private set; } public List<Customer> CustomersList { get; private set; }
[DataMember] [DataMember]
public List<Transactions> ListeTransactions { get; private set; } public List<Transactions> TransactionsList { get; private set; }
public IPersistanceManager Persistance { get; set; } public IPersistenceManager Persistence { get; set; }
public Manager(IPersistanceManager persistance) { public Manager(IPersistenceManager persistance) {
ListeTransactions = new List<Transactions>(); TransactionsList = new List<Transactions>();
ListeClients = new List<Client>(); CustomersList = new List<Customer>();
Persistance = persistance; Persistence = persistance;
} }
public Manager() public Manager()
{ {
ListeClients = new List<Client>(); CustomersList = new List<Customer>();
ListeTransactions = new List<Transactions>(); TransactionsList = new List<Transactions>();
} }
public bool AjouterClient(Client MonClient) public bool AddCustomer(Customer MyCustomer)
{ {
ListeClients.Add(MonClient); CustomersList.Add(MyCustomer);
return true; return true;
} }
public Client GetClient(int place) { public Customer GetCustomer(int place) {
return ListeClients[place]; return CustomersList[place];
} }
public void SauvegardeDonnee() public void DataSave()
{ {
Persistance.SauvegardeDonnee(ListeClients, ListeTransactions); Persistence.DataSave(CustomersList, TransactionsList);
} }
public void ChargeDonnee() public void DataLoad()
{ {
var donnees = Persistance.ChargeDonnee(); var data = Persistence.DataLoad();
ListeClients.AddRange(donnees.Item1); CustomersList.AddRange(data.Item1);
ListeTransactions.AddRange(donnees.Item2); TransactionsList.AddRange(data.Item2);
foreach (var j in donnees.Item1) foreach (var j in data.Item1)
{ {
ListeClients.Add(j); CustomersList.Add(j);
} }
foreach (var i in donnees.Item2) foreach (var i in data.Item2)
{ {
ListeTransactions.Add(i); TransactionsList.Add(i);
} }
} }

@ -9,23 +9,23 @@ using System.Threading.Tasks;
namespace Banquale.Model namespace Banquale.Model
{ {
[DataContract] [DataContract]
public class Personne public class Person
{ {
[DataMember] [DataMember]
public string Nom { get; private set; } public string Name { get; private set; }
[DataMember] [DataMember]
public string Prenom { get; private set; } public string FirstName { get; private set; }
[DataMember] [DataMember]
public int Id { get; private set; } public int Id { get; private set; }
[DataMember] [DataMember]
public string Mdp { get; private set; } public string Password { get; private set; }
public Personne(string nom, string prenom, string mdp) public Person(string name, string firstName, string password)
{ {
Nom = nom; Name = name;
Prenom = prenom; FirstName = firstName;
Id = 0; Id = 0;
Mdp = mdp; Password = password;
} }
} }

@ -86,6 +86,17 @@ namespace Banquale.Model
CompteImplique = compteImplique; CompteImplique = compteImplique;
Categorie = categorie; Categorie = categorie;
Date = date; Date = date;
public int Sum { get; private set; }
public Account InvolvedAccounts { get; private set; }
public string Category { get; private set; }
public Transactions(int type, int sum, Account involvedAccounts, string category) {
Type = type;
Sum = sum;
InvolvedAccounts = involvedAccounts;
Category = category;
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;

@ -3,6 +3,7 @@ using Banquale.Model;
namespace Banquale.Stub namespace Banquale.Stub
{ {
<<<<<<< HEAD
public class Stub : IPersistanceManager public class Stub : IPersistanceManager
{ {
@ -33,9 +34,26 @@ namespace Banquale.Stub
ListeClients.Add(Client2); ListeClients.Add(Client2);
ListeClients.Add(Client3); ListeClients.Add(Client3);
return (ListeClients, ListeTransactions /*, ListeCompte*/); return (ListeClients, ListeTransactions /*, ListeCompte*/);
=======
public class Stub : IPersistenceManager
{
public (List<Customer>, List<Transactions>) DataLoad()
{
Customer Customer1 = new Customer("Jacques", "Morice", "J'aimeLesFrites");
Customer Customer2 = new Customer("Francis", "Begore", "J'aimeLes");
Customer Customer3 = new Customer("Michel", "Boudout", "MonMdP");
Console.WriteLine(Customer1);
List<Customer> CustomersList = new List<Customer>();
List<Transactions> TransactionsList = new List<Transactions>();
CustomersList.Add(Customer1);
CustomersList.Add(Customer2);
CustomersList.Add(Customer3);
return (CustomersList, TransactionsList);
>>>>>>> origin/master
} }
public void SauvegardeDonnee(List<Client> c, List<Transactions> t) public void DataSave(List<Customer> c, List<Transactions> t)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

@ -9,8 +9,11 @@ public partial class BalancePage : ContentPage
public BalancePage() public BalancePage()
{ {
InitializeComponent(); InitializeComponent();
<<<<<<< HEAD
BindingContext = new Compte(999, "Tatouille", "FR76 9161 9581 6296 8415 2361 004"); ; BindingContext = new Compte(999, "Tatouille", "FR76 9161 9581 6296 8415 2361 004"); ;
=======
>>>>>>> origin/master
} }
public async void OnButtonClicked(object sender, EventArgs e) public async void OnButtonClicked(object sender, EventArgs e)

@ -17,11 +17,11 @@ public partial class NewPage1 : ContentPage
void Button_Clicked(System.Object sender, System.EventArgs e) void Button_Clicked(System.Object sender, System.EventArgs e)
{ {
Client client1 = new Client("Monsieur", "Bonjour", "HelloThisIsMyPassword"); Customer customer1 = new Customer("Mister", "Hello", "HelloThisIsMyPassword");
myManager.AjouterClient(client1); myManager.AddCustomer(customer1);
cpt++; cpt++;
Console.WriteLine(cpt); Console.WriteLine(cpt);
Console.WriteLine(client1.Nom); Console.WriteLine(customer1.Name);
} }
public async void ArrowBack(object sender, EventArgs e) public async void ArrowBack(object sender, EventArgs e)

@ -1,25 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>

@ -1,9 +0,0 @@
namespace TestUnit;
public class UnitTest1// une classe = type de chose à tester
{ // ex : class envoie argent
[Fact]
public void Test1() // test unitaire tester chaque petit truc et test intégration qui regarde l'intégration de ttes la classe
{
}
}

@ -1 +0,0 @@
global using Xunit;
Loading…
Cancel
Save