fonctionne, oit faire fonctionner connexion

pull/9/head
Clement LESME 2 years ago
parent 3a7551e491
commit 2a16ff44f8

@ -39,6 +39,8 @@
<!-- Images --> <!-- Images -->
<MauiImage Include="Resources\Images\*" /> <MauiImage Include="Resources\Images\*" />
<MauiImage Include="Resources\Images\Logo\*" />
<MauiImage Include="Resources\Images\Pc\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" /> <MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
<!-- Custom Fonts --> <!-- Custom Fonts -->

@ -29,8 +29,7 @@ namespace CanYouBuildIt.Model
{ {
var donnee = Persi.chargeDonnee(); var donnee = Persi.chargeDonnee();
listUtil.AddRange(donnee.Item1); listUtil.AddRange(donnee.Item1);
//listComp.AddRange(donnee.Item2); listComp.AddRange(donnee.Item2);
Console.Write("SJBEVKBV<SBDVK<KBCBJCqCeCsVHQ%LRVKzropjv$ptihujhbgoZRGJ");
} }
public void sauvegardeDonnee() public void sauvegardeDonnee()
@ -47,5 +46,28 @@ namespace CanYouBuildIt.Model
{ {
listComp.Add(composant); listComp.Add(composant);
} }
public int rechercheUsername(string usern)
{
for (int i = 0; i < listUtil.Count; i++ )
{
if (listUtil[i].username.Equals(usern,StringComparison.OrdinalIgnoreCase)){
return i;
}
}
return -1;
}
public int recherchePwd(string pwd)
{
for (int i = 0; i < listUtil.Count; i++)
{
if (listUtil[i].password.Equals(pwd,StringComparison.OrdinalIgnoreCase))
{
return i;
}
}
return -1;
}
} }
} }

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before

Width:  |  Height:  |  Size: 191 KiB

After

Width:  |  Height:  |  Size: 191 KiB

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

@ -53,12 +53,14 @@
Text="LOGIN" Text="LOGIN"
FontAttributes="Bold" FontAttributes="Bold"
TextColor="White" TextColor="White"
Clicked="BoutonValider"
HorizontalOptions="Center" /> HorizontalOptions="Center" />
<Button Margin="90,60,0,0" <Button Margin="90,60,0,0"
x:Name="btn_insc" x:Name="btn_insc"
Text="inscription" Text="inscription"
FontAttributes="Bold" FontAttributes="Bold"
TextColor="White" TextColor="White"
Clicked="btninsc"
HorizontalOptions="Center" /> HorizontalOptions="Center" />
</HorizontalStackLayout> </HorizontalStackLayout>

@ -1,9 +1,10 @@
namespace CanYouBuildIt.Views; namespace CanYouBuildIt.Views;
using CanYouBuildIt.Model;
public partial class Login : ContentPage public partial class Login : ContentPage
{ {
public Manager MyManager => (App.Current as App).MyManager; public Manager manager => (App.Current as App).manager;
public PageConnexion() public Login()
{ {
InitializeComponent(); InitializeComponent();
} }
@ -14,9 +15,9 @@ public partial class Login : ContentPage
string email = Adresse.Text; string email = Adresse.Text;
string MdpUlti = Mdp.Text; string MdpUlti = Mdp.Text;
string Name = Nom.Text; string Name = Nom.Text;
int idname = MyManager.rechercheNom(Name); int idname = manager.rechercheUsername(Name);
int idmail = MyManager.rechercheAdresse(email); //int idmail = manager.rechercheAdresse(email);
int idmdp = MyManager.rechercheMdp(MdpUlti); int idmdp = manager.recherchePwd(MdpUlti);
if (Name == null || MdpUlti == null) if (Name == null || MdpUlti == null)
{ {
@ -25,24 +26,24 @@ public partial class Login : ContentPage
error.IsVisible = false; error.IsVisible = false;
return; return;
} }
else if (idname == -1 && idmail == -1 && idmdp == -1) else if (idname == -1 /*&& idmail == -1*/ && idmdp == -1)
{ {
wrong.IsVisible = true; wrong.IsVisible = true;
await Task.Delay(1000); await Task.Delay(1000);
wrong.IsVisible = false; wrong.IsVisible = false;
return; return;
} }
else if (idname != -1 && idmail != -1 && idmdp != -1) else if (idname != -1 /*&& idmail != -1*/ && idmdp != -1)
{ {
valide.IsVisible = true; valide.IsVisible = true;
await Task.Delay(1000); await Task.Delay(1000);
valide.IsVisible = false; valide.IsVisible = false;
await Navigation.PushAsync(new Accueil(idname)); //await Navigation.PushAsync(new Accueil(idname));
} }
} }
private void btninsc(object sender, EventArgs e) private void btninsc(object sender, EventArgs e)
{ {
Navigation.PushAsync(new PageInscription()); await Navigation.PopAsync();
} }
} }
Loading…
Cancel
Save