Beispiel #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            ModifAdmin u = new ModifAdmin()
            {
                NomJoueur  = txtPlayerName.Text,
                Nom        = txtFirstName.Text,
                Prenom     = txtLastName.Text,
                Courriel   = txtEmail.Text,
                MotDePasse = txtPassword.Text
            };

            var result = ModifAdminValidator.Validate(u);

            if (!result.IsValid)
            {
                MessageBox.Show(string.Join("\n", result.Errors.ToList()), "Errors", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                string resultat = CompteJoueursCRUD.ModifCompteJoueur(
                    Int32.Parse(txtId.Text),
                    txtPlayerName.Text,
                    txtEmail.Text,
                    txtFirstName.Text,
                    txtLastName.Text,
                    TypeUtilisateur.Admin,
                    txtPassword.Text);

                if (resultat == "SUCCESS")
                {
                    MessageBox.Show("The admin has been modified", "Success!", MessageBoxButtons.OK, MessageBoxIcon.None);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("An error has occured with the modification of the admin", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }