Ejemplo n.º 1
0
 private void buttonInscription_Click(object sender, RoutedEventArgs e)
 {
     if (!verif())
     {
         warningStack.Visibility     = Visibility.Visible;
         RecSwarningStack.Visibility = System.Windows.Visibility.Visible;
         Fenetre.IsEnabled           = false;
         //   warningStack.Background = Brushes.Red;
         Warning.Content = "Vérifier les informations que vous avez rentré!";
     }
     else
     {
         this.removeWhites();
         string encryptedpasswrd = App.CrypterMdp(doctorPassword.Password);
         Doctor doc = new Doctor(doctorNom.Text, doctorPrenom.Text, doctorMail.Text, doctorAdress.Text, doctorNumber.Text
                                 , doctorSexe.Text, doctorSpec.Text, doctorUsername.Text, encryptedpasswrd);
         string type = "Medcin";
         if (this.type.IsChecked == true)
         {
             type = "MedcinAdmin";
         }
         doc.Insert_Nv_Doctor(type);
         warningStack.Visibility     = Visibility.Visible;
         RecSwarningStack.Visibility = System.Windows.Visibility.Visible;
         Fenetre.IsEnabled           = false;
         // warningStack.Background = Brushes.Green;
         Warning.Content = "Compte créé avec succès!";
         vider();
     }
 }
Ejemplo n.º 2
0
 private void valider_ic_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (passverif && userverif && this.Spécialité.Text.Trim() != "")
     {
         if (ChangePassword.IsChecked == true)
         {
             if (Password.Password.Length > 5)
             {
                 ConnexionBDD Datab = new ConnexionBDD();
                 Datab.connecter();
                 string type;
                 if (this.Med.IsChecked == true)
                 {
                     type = "Medcin";
                 }
                 else
                 {
                     type = "MedcinAdmin";
                 }
                 string pass    = App.CrypterMdp(this.Password.Password);
                 String Command = @"update Doctor set Username='******',Passwordd='" + pass + "',Spécialité='";
                 Command += this.Spécialité.Text + "',CompteAdmin='" + type + "' where Username='******'";
                 SqlCommand Macmd = new SqlCommand(Command, Datab.cnx);
                 Macmd.ExecuteNonQuery();
                 App.gestcpt.page_modifier_support.Visibility = System.Windows.Visibility.Hidden;
                 Datab.deconnecter();
                 App.gestcpt = new PageGestionCompte();
                 App.gest_adm.Gestion_support.NavigationService.Navigate(App.gestcpt);
             }
             else
             {
                 MessageBox.Show("Mot de passe trés court");
             }
         }
         else
         {
             ConnexionBDD Datab = new ConnexionBDD();
             Datab.connecter();
             string type;
             if (this.Med.IsChecked == true)
             {
                 type = "Medcin";
             }
             else
             {
                 type = "MedcinAdmin";
             }
             string pass    = App.CrypterMdp(this.Password.Password);
             String Command = @"update Doctor set Username='******',Spécialité='";
             Command += this.Spécialité.Text + "',CompteAdmin='" + type + "' where Username='******'";
             SqlCommand Macmd = new SqlCommand(Command, Datab.cnx);
             Macmd.ExecuteNonQuery();
             App.gestcpt.page_modifier_support.Visibility = System.Windows.Visibility.Hidden;
             Datab.deconnecter();
             App.gestcpt = new PageGestionCompte();
             App.gest_adm.Gestion_support.NavigationService.Navigate(App.gestcpt);
         }
     }
     else
     {
         //Données non valides
     }
 }
Ejemplo n.º 3
0
 private void log_butt_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ConnexionBDD Datab = new ConnexionBDD();
         Datab.connecter();
         string        user    = Username.Text;
         string        pass    = App.CrypterMdp(Password.Password);
         string        command = "SELECT COUNT(1) FROM Doctor WHERE Username='******' AND Passwordd='" + pass + "'";
         SqlCommand    Macmd   = new SqlCommand(command, Datab.cnx);
         SqlDataReader dr;
         dr = Macmd.ExecuteReader();
         int count = 0;
         if (dr.Read())
         {
             count = (int)dr[0];
         }
         dr.Close();
         if (count == 1)
         {
             command = "select Id_Doctor,CompteAdmin,EtatCompte from Doctor where Username='******'";
             Macmd   = new SqlCommand(command, Datab.cnx);
             dr      = Macmd.ExecuteReader();
             int idmed = -1; string typecompt; int etat;
             if (dr.Read())
             {
                 idmed     = (int)dr[0];
                 typecompt = dr[1].ToString();
                 etat      = int.Parse(dr[2].ToString());
                 if (etat == 1)
                 {
                     if (typecompt == "Admin")
                     {
                         //Gestion des compte
                         App.gest_adm = new GestionComptes();
                         App.gest_adm.Show();
                         App.authent.Close();
                     }
                     else
                     {
                         if (typecompt == "MedcinAdmin")
                         {
                             App.acc = new Nv_acceuil(idmed, true);
                             App.acc.Show();
                             App.authent.Close();
                             App.authent = null;
                         }
                         else
                         {
                             if (typecompt == "Medcin")
                             {
                                 App.acc = new Nv_acceuil(idmed, false);
                                 App.acc.Show();
                                 App.authent.Close();
                                 App.authent = null;
                             }
                         }
                     }
                 }
                 else
                 {
                     cptdsctvé.Visibility    = System.Windows.Visibility.Visible;
                     Reccptdsctvé.Visibility = System.Windows.Visibility.Visible;
                     authgrd.IsEnabled       = false;
                 }
             }
         }
         else
         {
             Stackerrauth.Visibility    = System.Windows.Visibility.Visible;
             RecStackerrauth.Visibility = System.Windows.Visibility.Visible;
             authgrd.IsEnabled          = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }