Ejemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string username = TBUser.Text;
            string password = TBPassword.Text;
            //bool valide = Passerelle.identification(username, password);
            EmployeDAO DaoEmploye = new EmployeDAO();
            Employe    unEmploye  = DaoEmploye.findlogin(username, password);
            bool       admin      = unEmploye.getAdmin();

            try
            {
                if (unEmploye != null)
                {
                    if (admin == true)
                    {
                        WAdmin windows = new WAdmin();
                        windows.Show();
                    }
                    else
                    {
                        WChoixJouet windows = new WChoixJouet();
                        windows.Show();
                    }
                    this.Close();
                }
                else
                {
                    lEtat.Content   = "Nom d'utilisateur ou mot de passe incorrecte";
                    TBPassword.Text = "";
                }
            }
            catch
            {
                MessageBox.Show("Connexion impossible");
                lEtat.Content = "Connexion impossible";
            }
        }
Ejemplo n.º 2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     string username=TBUser.Text;
     string password=TBPassword.Text;
     //bool valide = Passerelle.identification(username, password);
     EmployeDAO DaoEmploye = new EmployeDAO();
     Employe unEmploye = DaoEmploye.findlogin(username, password);
     bool admin=unEmploye.getAdmin();
     try
     {
         if (unEmploye != null)
         {
             if (admin == true)
             {
                 WAdmin windows=new WAdmin();
                 windows.Show();
             }
             else
             {
                 WChoixJouet windows = new WChoixJouet();
                 windows.Show();
             }
             this.Close();
         }
         else
         {
             lEtat.Content = "Nom d'utilisateur ou mot de passe incorrecte";
             TBPassword.Text = "";
         }
     }
     catch
     {
         MessageBox.Show("Connexion impossible");
         lEtat.Content = "Connexion impossible";
     }
 }