Merge branch 'xaml-C#/data-binding' of codefirst.iut.uca.fr:antoine.perederii/Banquale into xaml-C#/data-binding

pull/52/head
Antoine PEREDERII 2 years ago
commit c4cd2894fc

@ -22,6 +22,10 @@ public partial class App : Application
MainPage = new AppShell();
//MyManager.SelectedTransaction = MyManager.CustomersList[0].AccountsList[0].TransactionsList[0];
//MainPage = new Views.TransactionsPage();
}
}

@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using Model;
using Org.Apache.Http.Cookies;
namespace Banquale.Stub
{
@ -25,26 +26,32 @@ namespace Banquale.Stub
Account Account3 = new Account(3519, "Perotte", "FR7663522541416969585847002");
Transaction Transaction1 = new Transaction(true, 55, Account1, 1, new DateTime(2023, 6, 21, 15, 29, 20));
Transaction Transaction12 = new Transaction(true, 105, Account1, 2, new DateTime(2023, 8, 17, 18, 54, 35));
Transaction Transaction13 = new Transaction(true, 187, Account1, 3, new DateTime(2023, 5, 3, 8, 39, 49));
Transaction Transaction1 = new Transaction(true, 55, Account2, 1, new DateTime(2023, 6, 21, 15, 29, 20));
Transaction Transaction12 = new Transaction(true, 105, Account2, 2, new DateTime(2023, 8, 17, 18, 54, 35));
Transaction Transaction13 = new Transaction(true, 187, Account3, 3, new DateTime(2023, 5, 3, 8, 39, 49));
Transaction Transaction2 = new Transaction(false, 54.99, Account2, 4, new DateTime(2022, 8, 15));
Transaction Transaction3 = new Transaction(true, 1000, Account3, 5, new DateTime(2020, 9, 1, 20, 00, 00));
Debug.WriteLine(Customer1.Name, Customer1.Password);
List<Customer> CustomersList = new List<Customer>();
List<Transaction> TransactionList= new List<Transaction>();
List<Account> AccountsList = new List<Account>();
List<Transaction> TransactionsList= new List<Transaction>();
List<Account> AccountsList = new List<Account>();
//Account1.TransactionsList.Add(Transaction1);
//Account1.TransactionsList.Add(Transaction12);
//Account1.TransactionsList.Add(Transaction13);
//Account1.TransactionsList.Add(Transaction2);
//Account1.TransactionsList.Add(Transaction3);
//Account2.TransactionsList.Add(Transaction2);
Account1.TransactionsList.Add(Transaction1);
Account1.TransactionsList.Add(Transaction12);
Account1.TransactionsList.Add(Transaction13);
Account1.TransactionsList.Add(Transaction2);
Account1.TransactionsList.Add(Transaction3);
Account1.DoTransactions(Account2, 55, true, 1);
Account1.DoTransactions(Account2, 105, true, 2);
Account1.DoTransactions(Account3, 187, true, 3);
Account1.DoTransactions(Account2, 54.99, false, 4);
Account1.DoTransactions(Account3, 1000, false, 5);
Account2.TransactionsList.Add(Transaction2);
Customer1.AccountsList.Add(Account1);
Customer1.AccountsList.Add(Account2);

@ -20,9 +20,9 @@
HorizontalOptions="Fill">
<Grid.GestureRecognizers>
<!--<TapGestureRecognizer
<TapGestureRecognizer
Tapped="Transaction_Clicked"
NumberOfTapsRequired="1" />-->
NumberOfTapsRequired="1" />
</Grid.GestureRecognizers>

@ -35,6 +35,8 @@ public partial class BalanceView : ContentView
//Mgr.SelectedTransaction = transaction;
Mgr.SelectedTransaction = Mgr.CustomersList[0].AccountsList[0].TransactionsList[0];
await Navigation.PushModalAsync(new TransactionsPage());
}

@ -6,16 +6,7 @@
Title="CategoryPage">
<VerticalStackLayout
VerticalOptions="Center" >
<local:CategoryView />
<local:CategoryView />
<local:CategoryView />
<local:CategoryView />
<local:CategoryView />
<local:CategoryView />
<local:CategoryView />
<local:CategoryView />
<local:CategoryView />
VerticalOptions="Center">
<local:CategoryView />
</VerticalStackLayout>

@ -1,7 +1,11 @@
using Model;
namespace Banquale.Views.Category;
public partial class CategoryPage : ContentPage
{
public Manager Mgr => (App.Current as App).MyManager;
public CategoryPage()
{
InitializeComponent();

@ -5,7 +5,7 @@
<VerticalStackLayout>
<ListView ItemsSource="{Binding TransactionsList}"
<ListView ItemsSource="{Binding CategoryList}"
Grid.Row="2"
SelectionMode="None">
@ -16,7 +16,7 @@
<ViewCell>
<Grid
ColumnDefinitions="40, 3*, *"
ColumnDefinitions="*, *, *"
Margin="20, 5, 20, 5"
HorizontalOptions="Fill">
@ -28,22 +28,11 @@
</Grid.GestureRecognizers>
<Label
Text="{Binding Id}"
Grid.Column="0"
Text="{Binding .}"
Grid.Column="1"
x:Name="transactionId"/>
<Label
Text="{Binding Date, StringFormat='{0:ddd dd MMM yyyy}'}"
Grid.Column="1"
VerticalOptions="Center"
Margin="10, 0, 0, 0"/>
<Label
Text="{Binding Sum, StringFormat='{0} €'}"
Grid.Column="2"
VerticalOptions="Center"
HorizontalOptions="End"
Margin="0, 0, 20, 0"/>
</Grid>

@ -1,9 +1,14 @@
using Model;
namespace Banquale.Views.Category;
public partial class CategoryView : ContentView
{
public Manager Mgr => (App.Current as App).MyManager;
public CategoryView()
{
InitializeComponent();
BindingContext = Mgr;
}
}

@ -22,7 +22,7 @@ public partial class ConnectionPage : ContentPage
return;
}
if(currentId == 0)
if(currentId == 0 && password == "consultant")
{
Mgr.IsConsultant = true;
await Navigation.PushModalAsync(new ConsultantHomePage());

@ -3,20 +3,19 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Banquale.Views.MessageListPage"
Title="MessageListPage"
Shell.NavBarIsVisible="False">
Shell.NavBarIsVisible="True">
<VerticalStackLayout>
<Label
Text="{Binding MessagesList[0].Subject}"
<!--<Label
Text="rzklpkrz,e"
Grid.Column="1"
VerticalOptions="Center"
Margin="10, 0, 0, 0"
BackgroundColor="Red"/>
BackgroundColor="Red"/>-->
<!--<Label Text="{Binding }" />-->
<!--<ListView ItemsSource="{Binding Consultant}"
<ListView ItemsSource="{Binding Consultant.MessagesList}"
SelectionMode="None">
<ListView.ItemTemplate>
@ -25,17 +24,17 @@
<ViewCell>
<Grid ColumnDefinitions="*, *, *">
<Label
Text="Hello"
VerticalOptions="Center"
Margin="10, 0, 0, 0"/>
Text="{Binding Subject}"
Grid.Column="0"/>
<Label
Text="{Binding Description}"
Grid.Column="2"/>
</Grid>
</ViewCell>
@ -43,7 +42,7 @@
</ListView.ItemTemplate>
</ListView>-->
</ListView>
</VerticalStackLayout>
</ContentPage>

@ -12,6 +12,6 @@ public partial class MessageListPage : ContentPage
{
Debug.WriteLine(Mgr.Consultant.MessagesList[0].Subject);
InitializeComponent();
BindingContext = Mgr.Consultant;
BindingContext = Mgr;
}
}

@ -118,7 +118,7 @@ namespace Model
/// <param name="sum">Somme de la transaction.</param>
/// <param name="type">Type de transaction (débit ou crédit).</param>
/// <param name="nb">Numéro de la transaction.</param>
public void DoTransactions(Account involvedAccount, Double sum, bool type, int nb)
public void DoTransactions(Account involvedAccount, double sum, bool type, int nb)
{
if (type) // si le type est True => c'est un débit, on doit donc ajouter la transaction pour l'autre compte
{

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
@ -27,7 +28,7 @@ namespace Model
[DataMember]
public List<Customer> CustomersList { get; private set; } // devient un set
public List<string> CategoryList { get; private set; } = new List<string> {"Automobile", "Santé", "Abonnement", "Logement", "Impôts et taxes", "Courses", "Loisirs et sorties", "Enfant(s)"};
public ObservableCollection<string> CategoryList { get; private set; } = new ObservableCollection<string> {"Automobile", "Santé", "Abonnement", "Logement", "Impôts et taxes", "Courses", "Loisirs et sorties", "Enfant(s)"};
/// <summary>
/// Consultant assigné au gestionnaire.

@ -3,6 +3,8 @@
/// \author Votre nom
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
namespace Model
@ -11,20 +13,49 @@ namespace Model
/// Classe représentant un message.
/// </summary>
[DataContract]
public class Message
public class Message : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
void OnPropertyChanged([CallerMemberName] string? propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
/// <summary>
/// Sujet du message.
/// </summary>
[DataMember]
public string Subject { get; private set; }
public string Subject
{
get => subject;
set
{
if (subject == value) return;
subject = value;
OnPropertyChanged();
}
}
private string subject;
/// <summary>
/// Description du message.
/// </summary>
[DataMember]
public string Description { get; private set; }
public string Description
{
get => description;
set
{
if (description == value) return;
description = value;
OnPropertyChanged();
}
}
private string description;
/// <summary>
/// Constructeur de la classe Message.
/// </summary>

@ -12,7 +12,7 @@ namespace Model
/// <summary>
/// Occurs when a property value changes.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
public event PropertyChangedEventHandler? PropertyChanged;
void OnPropertyChanged(string propertyName)
{
@ -65,7 +65,7 @@ namespace Model
/// Gets or sets the account(s) involved in the transaction.
/// </summary>
[DataMember(Order = 4)]
public Account InvolvedAccounts
public Account? InvolvedAccounts
{
get => involvedAccounts;
set
@ -77,13 +77,13 @@ namespace Model
}
}
[DataMember]
private Account involvedAccounts;
private Account? involvedAccounts;
/// <summary>
/// Gets or sets the category of the transaction.
/// </summary>
[DataMember(Order = 5)]
public string Category
public string? Category
{
get => category;
set
@ -125,6 +125,7 @@ namespace Model
/// <param name="date">The date of the transaction.</param>
public Transaction(bool type, double sum, Account involvedAccounts, int id, DateTime date)
{
Category = null;
Type = type;
Sum = sum;
Id = id;

Loading…
Cancel
Save