fonctionne, oit faire fonctionner connexion

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

@ -39,6 +39,8 @@
<!-- 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" />
<!-- Custom Fonts -->

@ -29,8 +29,7 @@ namespace CanYouBuildIt.Model
{
var donnee = Persi.chargeDonnee();
listUtil.AddRange(donnee.Item1);
//listComp.AddRange(donnee.Item2);
Console.Write("SJBEVKBV<SBDVK<KBCBJCqCeCsVHQ%LRVKzropjv$ptihujhbgoZRGJ");
listComp.AddRange(donnee.Item2);
}
public void sauvegardeDonnee()
@ -47,5 +46,28 @@ namespace CanYouBuildIt.Model
{
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"
FontAttributes="Bold"
TextColor="White"
Clicked="BoutonValider"
HorizontalOptions="Center" />
<Button Margin="90,60,0,0"
x:Name="btn_insc"
Text="inscription"
FontAttributes="Bold"
TextColor="White"
Clicked="btninsc"
HorizontalOptions="Center" />
</HorizontalStackLayout>

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