create customer page

pull/52/head
Antoine PEREDERII 2 years ago
parent 1f994eb49d
commit ac5b66c8d1

@ -15,8 +15,7 @@ public partial class BalancePage : ContentPage
{ {
//Label lext = new Label { Text = "Hello" }; //Label lext = new Label { Text = "Hello" };
//Grid.Add(lext); //Grid.Add(lext);
Image backArrow = new Image { HeightRequest = 100 }; Image backArrow = new Image { Source = "{StaticResource AccountIcon}", HeightRequest = 100 };
backArrow.SetBinding(Image.SourceProperty, "backArrowIcon");
Grid.Add(backArrow); Grid.Add(backArrow);
} }
} }

@ -4,20 +4,61 @@
x:Class="Banquale.Views.CreateCustomerPage" x:Class="Banquale.Views.CreateCustomerPage"
Title="CreateCustomerPage"> Title="CreateCustomerPage">
<StackLayout Margin="20"> <StackLayout Margin="20"
x:Name="StackLayout">
<Label Text="Informations du client" FontSize="Title" HorizontalOptions="Center" Margin="0,0,0,20" /> <Label
Text="Informations du client"
FontSize="Title"
HorizontalOptions="Center"
Margin="0,0,0,20" />
<Label Text="ID client" FontSize="Subtitle" /> <Label
<Entry x:Name="clientIdEntry" Placeholder="Entrez l'ID client" /> Text="Nom"
FontSize="Subtitle" />
<Entry
x:Name="NameEntry"
Placeholder="Entrez le nom" />
<Label Text="Nom" FontSize="Subtitle" /> <Label
<Entry x:Name="clientLastNameEntry" Placeholder="Entrez le nom" /> Text="Prénom"
FontSize="Subtitle" />
<Entry
x:Name="FirstNameEntry"
Placeholder="Entrez le prénom" />
<Label Text="Prénom" FontSize="Subtitle" /> <Label
<Entry x:Name="clientFirstNameEntry" Placeholder="Entrez le prénom" /> Text="Mot de Passe"
FontSize="Subtitle" />
<Entry
x:Name="PasswordEntry"
Placeholder="Entrez le mot de passe" />
<Button Text="Enregistrer" HorizontalOptions="Center" Margin="0,20,0,0" /> <Label
Text="Compte 1"
FontSize="Title" />
<Entry
x:Name="BalanceEntry"
Placeholder="Entrez le solde du compte" />
<Label
Text="Nom du compte"
FontSize="Subtitle" />
<Entry
x:Name="Name1Entry"
Placeholder="Entrez le nom" />
<Button
Text="Ajouter un compte"
HorizontalOptions="Center"
Margin="0,20,0,0"
Clicked="Account_Clicked"/>
<Button
Text="Enregistrer"
HorizontalOptions="Center"
Margin="0,20,0,0"
Clicked="Create_Customer_Clicked"/>
</StackLayout> </StackLayout>

@ -1,9 +1,43 @@
namespace Banquale.Views; using Model;
namespace Banquale.Views;
public partial class CreateCustomerPage : ContentPage public partial class CreateCustomerPage : ContentPage
{ {
public Manager Mgr => (App.Current as App).MyManager;
int nbAccount = 1;
public CreateCustomerPage() public CreateCustomerPage()
{ {
InitializeComponent(); InitializeComponent();
} }
public void Create_Customer_Clicked(System.Object sender, System.EventArgs e)
{
string name = NameEntry.Text;
string firstName = FirstNameEntry.Text;
string password = PasswordEntry.Text;
if(string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(firstName))
{
DisplayAlert("Erreur", "Tous les champs doivent être renseignés", "OK");
}
else
{
Customer customer = new Customer(name, firstName, password);
Mgr.CustomersList.Add(customer);
}
}
public void Account_Clicked(object sender, EventArgs e)
{
Label account = new Label { Text = "Compte " + Convert.ToString(nbAccount)};
Label balance = new Label { Text = "Solde" };
Entry balanceEntry = new Entry { Placeholder = "Entrez le solde du compte" };
StackLayout.Add(account);
StackLayout.Add(balance);
StackLayout.Add(balanceEntry);
}
} }

Loading…
Cancel
Save