inedexation

pull/116/head
Nicolas MAYE 2 years ago
parent 131218b1be
commit 9b77b36c32

@ -12,7 +12,10 @@ namespace IHM
MainPage = new AppShell(); MainPage = new AppShell();
if(OperatingSystem.IsWindows())
{
MainPage = new UI_Windows.MainPage_Windows();
}
} }

@ -14,6 +14,8 @@ namespace IHM
Routing.RegisterRoute("ForgetPassword", typeof(ForgetPassword)); Routing.RegisterRoute("ForgetPassword", typeof(ForgetPassword));
Routing.RegisterRoute("ChangePassword", typeof(ChangePassword)); Routing.RegisterRoute("ChangePassword", typeof(ChangePassword));
} }
} }

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.ChangePassword"
Title="ChangePassword">
<VerticalStackLayout>
<Label
Text="Changer votre mot de passe"
VerticalOptions="Center"
HorizontalOptions="Center"
FontSize="20"
Margin="20"/>
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7" Margin="40">
<Entry BackgroundColor="White"
TextColor="Black"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="Nouveau mot de passe"
x:Name="EntryNewMdp"
IsPassword="True"/>
</Border>
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7" Margin="40,0,40,40">
<Entry BackgroundColor="White"
TextColor="Black"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="Confirmer mot de passe"
x:Name="EntryNewMdpConfirmation"
IsPassword="True"/>
</Border>
<Button
x:Name="ValidationButton"
Text="valider"
Clicked="ValidationButton_Clicked"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentPage>

@ -1,45 +0,0 @@
using Model;
namespace IHM;
public partial class ChangePassword : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
private string MailUser;
public ChangePassword(string mailUser)
{
InitializeComponent();
MailUser = mailUser;
}
private void ValidationButton_Clicked(object sender, EventArgs e)
{
if (EntryNewMdp.Text == null || EntryNewMdpConfirmation.Text == null)
{
AffichError("Champ non valide", "Veuillez remplir tout les champs", "OK");
}
else {
if (!EntryNewMdp.Text.Equals(EntryNewMdpConfirmation.Text))
{
AffichError("mot de passe non identique", "veuillez entrer des mots de passe identique", "OK");
}
else
{
Mgr.changePasswordBdd(MailUser, EntryNewMdp.Text);
AffichError("mdp changé", "mot de passe bien changé", "ok");
NavigateTo("../..");
}
}
}
private async void NavigateTo(string path)
{
await Shell.Current.GoToAsync(path);
}
private async void AffichError(string s, string s1, string s2)
{
await DisplayAlert(s, s1, s2);
}
}

@ -1,27 +0,0 @@
using Model;
namespace IHM;
public partial class DashBoard : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
public DashBoard()
{
InitializeComponent();
//Routing.RegisterRoute(nameof(DashBoard), typeof(DashBoard));
if (Mgr.SelectedInscrit == null)
{
loadInscription();
}
}
public async void loadInscription()
{
await Navigation.PushModalAsync(new MainPage());
}
}

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.ForgetPassword"
Title="ForgetPassword">
<VerticalStackLayout
Margin="20"
Padding="30">
<Label
Text="Rentrée votre adresse email :"
HorizontalOptions="Center" />
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7" Margin="40">
<Entry BackgroundColor="White"
TextColor="Black"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="Email"
x:Name="EntryMail"/>
</Border>
<Button
x:Name="ConnexionButton"
Text="valider Email"
Clicked="SearchEmail"
HorizontalOptions="Center" />
<VerticalStackLayout x:Name="ValidateReceptCode" IsVisible="false" Margin="20">
<Label Text="Veuillez rentrer le code à 6 chiffres reçus par mail"
HorizontalOptions="Center"/>
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7" Margin="40">
<Entry BackgroundColor="White"
TextColor="Black"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="6 Chiffres"
Keyboard="Numeric"
x:Name="EntryCodeRecept"/>
</Border>
<Button
x:Name="ValidationButton"
Text="valider"
Clicked="ValideCode"
HorizontalOptions="Center" />
</VerticalStackLayout>
</VerticalStackLayout>
</ContentPage>

@ -91,6 +91,9 @@
<MauiXaml Update="Inscription.xaml"> <MauiXaml Update="Inscription.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="UI_Windows\MainPage_Windows.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -1,86 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Inscription"
Title="Inscription">
<ScrollView>
<VerticalStackLayout
Margin="10"
Padding="30">
<Label
Text="Renter vos identifiants"
VerticalOptions="Center"
HorizontalOptions="Center" />
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7">
<Entry BackgroundColor="White"
TextColor="Black"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="Nom"
x:Name="EntryNewName"/>
</Border>
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7">
<Entry BackgroundColor="White"
TextColor="Black"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="Prenom"
x:Name="EntryNewSurname"/>
</Border>
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7">
<Entry BackgroundColor="White"
TextColor="Black"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="Adresse mail"
x:Name="EntryNewMail"/>
</Border>
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7">
<Entry BackgroundColor="White"
TextColor="Black"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="Mot de passe"
IsPassword="True"
x:Name="EntryNewPassword"/>
</Border>
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7">
<Entry BackgroundColor="White"
TextColor="Black"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="Confirmer mot de passe"
IsPassword="True"
x:Name="EntryConfirmationPassword"/>
</Border>
<Button
x:Name="InscriptionButton"
Text="Créer son compte"
Clicked="InscriptionOnClicked"
HorizontalOptions="Center" />
<VerticalStackLayout x:Name="ValidateReceptCode" IsVisible="false" Margin="20">
<Label Text="Veuillez rentrer le code à 6 chiffres reçus par mail"
HorizontalOptions="Center"/>
<Border StrokeShape="RoundRectangle 40" BackgroundColor="White" Padding="7" Margin="40">
<Entry BackgroundColor="White"
TextColor="Black"
VerticalTextAlignment="Center"
FontSize="15"
Placeholder="6 Chiffres"
Keyboard="Numeric"
x:Name="EntryCodeRecept"/>
</Border>
<Button
x:Name="ValidationButton"
Text="valider"
Clicked="ValideCode"
HorizontalOptions="Center" />
</VerticalStackLayout>
</VerticalStackLayout>
</ScrollView>
</ContentPage>

@ -1,73 +0,0 @@
using Model;
using Email = Model.Email;
namespace IHM;
public partial class Inscription : ContentPage
{
private string code;
public Manager Mgr => (App.Current as App).Manager;
public Inscription()
{
InitializeComponent();
}
public void InscriptionOnClicked(object sender, EventArgs e)
{
if (EntryNewName.Text == null || EntryNewMail.Text == null || EntryConfirmationPassword.Text == null || EntryNewPassword.Text == null ||
EntryNewSurname.Text == null)
{
AffichError("Champ invalide", "Veuillez compléter tout les champs", "OK");
}
else
{
if(EntryNewPassword.Text.Equals(EntryConfirmationPassword.Text)) {
if (Mgr.existEmail(EntryNewMail.Text))
{
AffichError("Mail existant", "un compte porte déjà cette adresse mail, veuillez en changer", "OK");
}
else
{
try
{
Random generator = new Random();
code = generator.Next(0, 1000000).ToString("D6");
Email.CreateMail(EntryNewMail.Text, code);
ValidateReceptCode.IsVisible = true;
}
catch (Exception ex)
{
AffichError("Information invalide", ex.Message, "OK");
}
}
}
else
{
AffichError("Mot de passe de confirmation invalide", "Veuillez mettre deux mots de passe identiques", "OK");
}
}
}
private void ValideCode(object sender, EventArgs e)
{
if (EntryCodeRecept.Text == code)
{
Inscrit inscrit = new Inscrit(Mgr.lastInscrit() + 1, EntryNewName.Text, EntryNewMail.Text, EntryNewSurname.Text, EntryNewPassword.Text);
Mgr.createInscrit(inscrit);
AffichError("compte créé", "Compte bien créé", "OK");
NavigateTo("..");
}
else
{
AffichError("Code non identique", "Veuillez entrer le même code que celui reçu par mail", "OK");
}
}
private async void AffichError(string s, string s1, string s2)
{
await DisplayAlert(s, s1, s2);
}
private async void NavigateTo(string s)
{
await Shell.Current.GoToAsync(s);
}
}

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Operations">
<VerticalStackLayout>
<Label
Text="Operations"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentPage>

@ -1,9 +0,0 @@
namespace IHM;
public partial class Operations : ContentPage
{
public Operations()
{
InitializeComponent();
}
}

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Planification">
<VerticalStackLayout>
<Label
Text="Planification"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentPage>

@ -1,9 +0,0 @@
namespace IHM;
public partial class Planification : ContentPage
{
public Planification()
{
InitializeComponent();
}
}

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="IHM.Settings">
<VerticalStackLayout>
<Label
Text="Paramètre"
VerticalOptions="Center"
HorizontalOptions="Center" />
<Button
Text="Déconnexion"
VerticalOptions="End"
Clicked="deconnexionOnClicked"
HorizontalOptions="Center"/>
</VerticalStackLayout>
</ContentPage>

@ -1,19 +0,0 @@
namespace IHM;
using Model;
public partial class Settings : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
public Settings()
{
InitializeComponent();
}
public void deconnexionOnClicked(object sender, EventArgs e)
{
Mgr.SelectedInscrit = null;
NavigateTo();
}
private async void NavigateTo()
{
await Navigation.PushModalAsync(new MainPage());
}
}
Loading…
Cancel
Save