Create Diagramme de classe and update cs file in english #40

Merged
antoine.perederii merged 1 commits from C#/model_class_diagram into master 2 years ago

File diff suppressed because it is too large Load Diff

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>();
} }
} }

@ -7,14 +7,14 @@ using System.Threading.Tasks;
namespace Banquale.Model namespace Banquale.Model
{ {
public class Compte public class Account
{ {
public int Solde { get; set; } public int Balance { get; set; }
public string Nom { get; set;} public string Name { get; set;}
public string IBAN { get; set; } public string IBAN { get; set; }
public List<Transactions> CompteList { get; set; } 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)
{} {}

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

@ -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;
} }
} }

@ -10,17 +10,17 @@ namespace Banquale.Model
{ {
public int Type { get; private set; } public int Type { get; private set; }
public int Somme { get; private set; } public int Sum { get; private set; }
public Compte CompteImplique { get; private set; } public Account InvolvedAccounts { get; private set; }
public string Categorie { get; private set; } public string Category { get; private set; }
public Transactions(int type, int somme, Compte compteImplique, string categorie) { public Transactions(int type, int sum, Account involvedAccounts, string category) {
Type = type; Type = type;
Somme = somme; Sum = sum;
CompteImplique = compteImplique; InvolvedAccounts = involvedAccounts;
Categorie = categorie; Category = category;
} }
} }
} }

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

@ -7,8 +7,6 @@ public partial class BalancePage : ContentPage
public BalancePage() public BalancePage()
{ {
InitializeComponent(); InitializeComponent();
} }
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)

Loading…
Cancel
Save