diff --git a/src/Banquale/Banquale/App.xaml.cs b/src/Banquale/Banquale/App.xaml.cs
index 611755d..73c8986 100644
--- a/src/Banquale/Banquale/App.xaml.cs
+++ b/src/Banquale/Banquale/App.xaml.cs
@@ -16,11 +16,11 @@ public partial class App : Application
MyManager.DataLoad();
MyManager.Persistence = new DataContractPersistance.DataContractPers();
+ //MyManager.DataSave();
- InitializeComponent();
+ InitializeComponent();
MainPage = new AppShell();
- //MyManager.DataSave();
}
diff --git a/src/Banquale/Banquale/AppShell.xaml b/src/Banquale/Banquale/AppShell.xaml
index 1c8e8ff..9088f35 100644
--- a/src/Banquale/Banquale/AppShell.xaml
+++ b/src/Banquale/Banquale/AppShell.xaml
@@ -4,7 +4,6 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:Banquale.Views"
- xmlns:balance="clr-namespace:Banquale.Views.Balance"
xmlns:transfer="clr-namespace:Banquale.Views.Transfer"
Shell.FlyoutBehavior="Disabled">
@@ -16,7 +15,7 @@
diff --git a/src/Banquale/Banquale/Banquale.csproj b/src/Banquale/Banquale/Banquale.csproj
index a799d15..c4b35c0 100644
--- a/src/Banquale/Banquale/Banquale.csproj
+++ b/src/Banquale/Banquale/Banquale.csproj
@@ -49,7 +49,6 @@
-
@@ -64,7 +63,6 @@
-
diff --git a/src/Banquale/Banquale/DataContractPersistance/DataContractPers.cs b/src/Banquale/Banquale/DataContractPersistance/DataContractPers.cs
index 2ee64c1..c31bba9 100644
--- a/src/Banquale/Banquale/DataContractPersistance/DataContractPers.cs
+++ b/src/Banquale/Banquale/DataContractPersistance/DataContractPers.cs
@@ -13,40 +13,93 @@ namespace Banquale.DataContractPersistance
//public string FilePath { get; set; } = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/datbase.xml";
public string FilePath { get; set; } = FileSystem.Current.AppDataDirectory;
- public string FileName { get; set; } = "CustomerList.xml";
+ public string FileName { get; set; } = "DataSave.xml";
- public List DataLoad()
+ public (List, Consultant) DataLoad()
{
- var serializer = new DataContractSerializer(typeof(List));
+ var serializer = new DataContractSerializer(typeof(DataToPersist));
- List CustomersList;
+ DataToPersist data;
- using (Stream s = File.OpenRead(Path.Combine(FilePath, FileName)))
- {
- CustomersList = serializer.ReadObject(s) as List;
- }
- return CustomersList;
+ if (File.Exists(Path.Combine(FilePath, FileName))) // Vérifiez si le fichier existe
+ {
+ using (Stream s = File.OpenRead(Path.Combine(FilePath, FileName)))
+ {
+ data = serializer.ReadObject(s) as DataToPersist;
+ }
+ }
+ else
+ {
+ data = new DataToPersist(); // Si le fichier n'existe pas, créez une nouvelle liste
+ }
+
+ // List CustomersList;
+ //Consultant Consultant;
+
+ //using (Stream s = File.OpenRead(Path.Combine(FilePath, FileNameCustomer)))
+ //{
+ // CustomersList = serializer.ReadObject(s) as List;
+ // }
+
+ // using (Stream s = File.OpenRead(Path.Combine(FilePath, FileNameConsultant)))
+ // {
+ // Consultant = serializer2.ReadObject(s) as Consultant;
+ // }
+
+ return (data.customer, data.consultant);
}
- public void DataSave(List c)
+ public void DataSave(List cu, Consultant co)
{
- var serializer = new DataContractSerializer(typeof(List));
-
- if(!Directory.Exists(FilePath))
- {
- Debug.WriteLine("Directory created");
- Debug.WriteLine(FilePath);
- Directory.CreateDirectory(FilePath);
- }
-
- var settings = new XmlWriterSettings() { Indent = true };
- using (TextWriter tw = File.CreateText(Path.Combine(FilePath, FileName)))
- {
- using (XmlWriter writer = XmlWriter.Create(tw, settings))
- {
- serializer.WriteObject(writer, c);
- }
- }
+ var serializer = new DataContractSerializer(typeof(DataToPersist));
+
+ if (!Directory.Exists(FilePath))
+ {
+ Debug.WriteLine("Directory doesn't exist.");
+ Directory.CreateDirectory(FilePath);
+ }
+
+
+ DataToPersist data = new DataToPersist();
+ data.customer = cu;
+ data.consultant = co;
+
+ var settings = new XmlWriterSettings() { Indent = true };
+ using (TextWriter tw = File.CreateText(Path.Combine(FilePath, FileName)))
+ {
+ using (XmlWriter w = XmlWriter.Create(tw, settings))
+ {
+ serializer.WriteObject(w, data);
+ }
+ }
+
+
+ // var serializer = new DataContractSerializer(typeof(List));
+ // var serializer2 = new DataContractSerializer(typeof(Consultant));
+
+ // if (!Directory.Exists(FilePath))
+ //{
+ // Debug.WriteLine("Directory created");
+ // Debug.WriteLine(FilePath);
+ // Directory.CreateDirectory(FilePath);
+ //}
+
+ //var settings = new XmlWriterSettings() { Indent = true };
+ // using (TextWriter tw = File.CreateText(Path.Combine(FilePath, FileNameCustomer)))
+ //{
+ // using (XmlWriter writer = XmlWriter.Create(tw, settings))
+ // {
+ // serializer.WriteObject(writer, cu);
+ // }
+ //}
+
+ // using (TextWriter tw2 = File.CreateText(Path.Combine(FilePath, FileNameConsultant)))
+ // {
+ // using (XmlWriter writer2 = XmlWriter.Create(tw2, settings))
+ // {
+ // serializer.WriteObject(writer2, co);
+ // }
+ // }
}
}
}
diff --git a/src/Banquale/Banquale/DataContractPersistance/DataToPersist.cs b/src/Banquale/Banquale/DataContractPersistance/DataToPersist.cs
index ba7d64d..abd68ba 100644
--- a/src/Banquale/Banquale/DataContractPersistance/DataToPersist.cs
+++ b/src/Banquale/Banquale/DataContractPersistance/DataToPersist.cs
@@ -5,8 +5,8 @@ namespace Banquale.DataContractPersistance
{
public class DataToPersist
{
- public List customer { get; set; } = new List();
- public List transactions { get; set; } = new List();
+ public List customer { get; set; } = new List();
+ public Consultant consultant { get; set; } = null;
}
}
diff --git a/src/Banquale/Banquale/Model/Account.cs b/src/Banquale/Banquale/Model/Account.cs
index d11a7af..f2b87c8 100644
--- a/src/Banquale/Banquale/Model/Account.cs
+++ b/src/Banquale/Banquale/Model/Account.cs
@@ -103,13 +103,14 @@ namespace Banquale.Model
// Console.WriteLine("Help button pressed !");
//}
- internal static void AskForHelp(Entry request, Entry subject, Editor message)
+ internal static Message AskForHelp(Entry subject, Editor description)
{
- Debug.WriteLine(request.Text);
- Debug.WriteLine(subject);
- Debug.WriteLine(message);
+ Debug.WriteLine(subject.Text);
+ Debug.WriteLine(description.Text);
Debug.WriteLine("Help button pressed !");
//throw new NotImplementedException();
+ Message message = new Message(subject.Text, description.Text);
+ return message;
}
internal static void DoRequest(Entry name, Entry iBAN, Entry sum)
diff --git a/src/Banquale/Banquale/Model/IPersistenceManager.cs b/src/Banquale/Banquale/Model/IPersistenceManager.cs
index ac355c1..2f67d5a 100644
--- a/src/Banquale/Banquale/Model/IPersistenceManager.cs
+++ b/src/Banquale/Banquale/Model/IPersistenceManager.cs
@@ -8,8 +8,8 @@ namespace Banquale.Model
{
public interface IPersistenceManager
{
- public List DataLoad();
+ public (List, Consultant) DataLoad();
- void DataSave(List c /* , List t, List c2*/);
+ void DataSave(List cu, Consultant co);
}
}
diff --git a/src/Banquale/Banquale/Model/Manager.cs b/src/Banquale/Banquale/Model/Manager.cs
index ba1a3e4..6caf616 100644
--- a/src/Banquale/Banquale/Model/Manager.cs
+++ b/src/Banquale/Banquale/Model/Manager.cs
@@ -7,11 +7,9 @@ namespace Banquale.Model
public class Manager
{
[DataMember]
- public List CustomersList { get; private set; }
+ public List CustomersList { get; private set; } // devient un set
- public List TransactionsList { get; private set; }
-
- public List AccountList { get; private set; }
+ public Consultant Consultant { get; private set; } // 1 SEUL consultant
public Customer SelectedCustomer
{
@@ -37,18 +35,15 @@ namespace Banquale.Model
public IPersistenceManager Persistence { get; set; }
- public Manager(IPersistenceManager persistence) {
-
- TransactionsList = new List();
+ public Manager(IPersistenceManager persistence)
+ {
CustomersList = new List();
Persistence = persistence;
-
}
public Manager()
{
CustomersList = new List();
- TransactionsList = new List();
}
public bool AddCustomer(Customer MyCustomer)
@@ -63,24 +58,21 @@ namespace Banquale.Model
public void DataSave()
{
- Persistence.DataSave(CustomersList);
+ Persistence.DataSave(CustomersList, Consultant);
}
public void DataLoad()
{
var data = Persistence.DataLoad();
- CustomersList.AddRange(data);
+ CustomersList.AddRange(data.Item1);
- foreach (var j in data)
+ foreach (var j in data.Item1)
{
CustomersList.Add(j);
}
- /*
- foreach (var i in data.Item2)
- {
- TransactionsList.Add(i);
- }*/
+
+ Consultant = data.Item2;
}
}
diff --git a/src/Banquale/Banquale/Model/Person.cs b/src/Banquale/Banquale/Model/Person.cs
index 6a90c6b..a33329b 100644
--- a/src/Banquale/Banquale/Model/Person.cs
+++ b/src/Banquale/Banquale/Model/Person.cs
@@ -24,7 +24,15 @@ namespace Banquale.Model
{
Name = name;
FirstName = firstName;
- Id = 0;
+ Id = 1;
+ Password = password;
+ }
+
+ public Person(string name, string firstName, uint id, string password)
+ {
+ Name = name;
+ FirstName = firstName;
+ Id = id;
Password = password;
}
diff --git a/src/Banquale/Banquale/Stub/Stub.cs b/src/Banquale/Banquale/Stub/Stub.cs
index 6be2b48..d1836e0 100644
--- a/src/Banquale/Banquale/Stub/Stub.cs
+++ b/src/Banquale/Banquale/Stub/Stub.cs
@@ -7,8 +7,10 @@ namespace Banquale.Stub
public class Stub : IPersistenceManager
{
- public List /*List, List*/ DataLoad()
+ public (List, Consultant) DataLoad()
{
+ Consultant Consultant = new Consultant("Consultant", "Consultant", 0, "Consultant");
+
Customer Customer1 = new Customer("Jacques", "Morice", "J'aimeLesFrites");
Customer Customer2 = new Customer("Francis", "Begore", "J'aimeLes");
Customer Customer3 = new Customer("Michel", "Boudout", "MonMdP");
@@ -37,44 +39,8 @@ namespace Banquale.Stub
Account1.TransactionsList.Add(Transactions2);
Account1.TransactionsList.Add(Transactions3);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions1);
- //Account1.TransactionsList.Add(Transactions12);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions2);
- //Account1.TransactionsList.Add(Transactions3);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions1);
- //Account1.TransactionsList.Add(Transactions12);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions2);
- //Account1.TransactionsList.Add(Transactions3);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
- //Account1.TransactionsList.Add(Transactions13);
-
Account2.TransactionsList.Add(Transactions2);
- //AccountsList.Add(Account1);
- //AccountsList.Add(Account2);
- //AccountsList.Add(Account3);
-
Customer1.AccountsList.Add(Account1);
Customer1.AccountsList.Add(Account2);
@@ -83,10 +49,10 @@ namespace Banquale.Stub
CustomersList.Add(Customer1);
CustomersList.Add(Customer2);
CustomersList.Add(Customer3);
- return CustomersList; // TransactionsList /*, AccountsList*/);
+ return (CustomersList, Consultant);
}
- public void DataSave(List c)
+ public void DataSave(List c, Consultant consultant)
{
throw new NotImplementedException();
}
diff --git a/src/Banquale/Banquale/Views/Balance/BalanceView.xaml b/src/Banquale/Banquale/Views/Balance/BalanceView.xaml
deleted file mode 100644
index d82a6d6..0000000
--- a/src/Banquale/Banquale/Views/Balance/BalanceView.xaml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Banquale/Banquale/Views/Balance/BalanceView.xaml.cs b/src/Banquale/Banquale/Views/Balance/BalanceView.xaml.cs
deleted file mode 100644
index eeea5b8..0000000
--- a/src/Banquale/Banquale/Views/Balance/BalanceView.xaml.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Banquale.Model;
-using Banquale.Views.Category;
-namespace Banquale.Views.Balance;
-
-public partial class BalanceView : ContentView
-{
-
- public Manager Mgr => (App.Current as App).MyManager;
-
- public BalanceView()
- {
- InitializeComponent();
- BindingContext = Mgr;
- }
-
- public async void Transaction_Clicked(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)
- {
- await Shell.Current.Navigation.PushAsync(new TransactionsPage());
- }
-}
diff --git a/src/Banquale/Banquale/Views/Balance/BalancePage.xaml b/src/Banquale/Banquale/Views/BalancePage.xaml
similarity index 96%
rename from src/Banquale/Banquale/Views/Balance/BalancePage.xaml
rename to src/Banquale/Banquale/Views/BalancePage.xaml
index 6a3af48..75ef4e1 100644
--- a/src/Banquale/Banquale/Views/Balance/BalancePage.xaml
+++ b/src/Banquale/Banquale/Views/BalancePage.xaml
@@ -1,9 +1,9 @@
@@ -84,7 +84,7 @@
Grid.Column="0"
MaximumHeightRequest="30"/>
diff --git a/src/Banquale/Banquale/Views/Balance/BalancePage.xaml.cs b/src/Banquale/Banquale/Views/BalancePage.xaml.cs
similarity index 95%
rename from src/Banquale/Banquale/Views/Balance/BalancePage.xaml.cs
rename to src/Banquale/Banquale/Views/BalancePage.xaml.cs
index d11d362..a3b967f 100644
--- a/src/Banquale/Banquale/Views/Balance/BalancePage.xaml.cs
+++ b/src/Banquale/Banquale/Views/BalancePage.xaml.cs
@@ -1,6 +1,6 @@
using Banquale.Model;
-namespace Banquale.Views.Balance;
+namespace Banquale.Views;
public partial class BalancePage : ContentPage
diff --git a/src/Banquale/Banquale/Views/ConsultantIdPage.xaml.cs b/src/Banquale/Banquale/Views/ConsultantIdPage.xaml.cs
index 1484126..8d54a38 100644
--- a/src/Banquale/Banquale/Views/ConsultantIdPage.xaml.cs
+++ b/src/Banquale/Banquale/Views/ConsultantIdPage.xaml.cs
@@ -1,4 +1,4 @@
-using Banquale.Views.Balance;
+using Banquale.Views;
namespace Banquale.Views;
public partial class ConsultantIdPage : ContentPage
diff --git a/src/Banquale/Banquale/Views/HelpPage.xaml b/src/Banquale/Banquale/Views/HelpPage.xaml
index 5f2cbd7..ccf50d5 100644
--- a/src/Banquale/Banquale/Views/HelpPage.xaml
+++ b/src/Banquale/Banquale/Views/HelpPage.xaml
@@ -6,18 +6,6 @@
-
-
-
-
-
-
(App.Current as App).MyManager;
public HelpPage()
{
InitializeComponent();
@@ -10,7 +11,8 @@ public partial class HelpPage : ContentPage
public async void Send_Clicked(Object sender, EventArgs e)
{
- Account.AskForHelp(Request, Subject, Message);
+ Message message = Account.AskForHelp(Subject, Message);
+ Mgr.Consultant.MessagesList.Add(message);
await Shell.Current.GoToAsync("//balance");
}
diff --git a/src/Banquale/Banquale/Views/SwitchAccountPage.xaml b/src/Banquale/Banquale/Views/SwitchAccountPage.xaml
index 4d01dfc..74e3c5c 100644
--- a/src/Banquale/Banquale/Views/SwitchAccountPage.xaml
+++ b/src/Banquale/Banquale/Views/SwitchAccountPage.xaml
@@ -7,13 +7,12 @@
Shell.NavBarIsVisible="False">
-
+
-
-
+
@@ -21,15 +20,15 @@
-
+
+
+
-
@@ -45,10 +44,10 @@
HorizontalOptions="Fill"
MinimumHeightRequest="100"
MinimumWidthRequest="375"
- Margin="0,65,0,0"
+ Margin="10"
FontSize="Large"
Clicked="DisconnectionClicked"/>
-
+
\ No newline at end of file
diff --git a/src/Banquale/Banquale/Views/SwitchAccountView.xaml b/src/Banquale/Banquale/Views/SwitchAccountView.xaml
deleted file mode 100644
index f06a109..0000000
--- a/src/Banquale/Banquale/Views/SwitchAccountView.xaml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Banquale/Banquale/Views/SwitchAccountView.xaml.cs b/src/Banquale/Banquale/Views/SwitchAccountView.xaml.cs
deleted file mode 100644
index b575284..0000000
--- a/src/Banquale/Banquale/Views/SwitchAccountView.xaml.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace Banquale.Views;
-
-public partial class SwitchAccountView : ContentView
-{
- public SwitchAccountView()
- {
- InitializeComponent();
- }
-
- public async void Transfer_Clicked(object sender, EventArgs e)
- {
- await Shell.Current.GoToAsync("//balance");
- }
-
-}
\ No newline at end of file