示例#1
0
        /// <summary>
        /// Méthode de connexion
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            // Déclaration et attribution des variables
            string password = passwordboxLoginPassword.Password.ToString();
            string mail     = textboxLoginMail.Text;
            // Execution de la requete afin de récuperer id de utilisateur si il existe
            string login = Users.Login(mail, password);

            // Si requete ne renvoie pas null ou rien
            if (!String.IsNullOrEmpty(login))
            {
                // On stock le login dans une attribut de la classe Users
                Users.IdUserConnected    = int.Parse(login);
                textblockErrorLogin.Text = "Identifiants réussi";
                // Instanciation  de la fênetre profil
                profil profilWindow = new profil();
                // Affichage de la fênetre profil
                profilWindow.Show();
                // Fermeture de la fênetre actuelle
                this.Close();
            }
            else
            {
                textblockErrorLogin.Text = "Identifiants incorrect";
            }
        }
示例#2
0
 public void InsertProfil(profilDB profl)
 {
     using (DataAccesDataContext dbContext = new DataAccesDataContext())
     {
         profil profil = new profil
         {
             code_profil        = profl.code,
             description_profil = profl.libelle
         };
         dbContext.profil.InsertOnSubmit(profil);
         dbContext.SubmitChanges();
     }
 }
示例#3
0
        private void btnAjouter_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textLibelle.Text))
            {
                MessageBox.Show("le libellé est obligatoires", "Message Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                profil profil = new profil()
                {
                    libelle = textLibelle.Text.Trim(),
                };
                if (metier.CreerProfil(profil))
                {
                    MessageBox.Show("Classe créer avec succès", "Message Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textLibelle.Clear();


                    LoadDataGridView();
                }
            }
        }
示例#4
0
 public bool CreerProfil(profil profil)
 {
     ctx.profil.Add(profil);
     return(ctx.SaveChanges() != 0);
 }