Пример #1
0
        //on Click function. allow the access at the program to the user creating new referencies
        private void signUp(object sender, EventArgs e)
        {
            try
            {
                UserManagerClient userManager = new UserManagerClient(); //initialize

                //check if the Email is just used for another account, if the email is valid try to create and save into the databse the account
                if (this.CheckEmail(EmailBoxSignUp.Text))
                {
                    //control of the good account's creation
                    if (userManager.CreateUser(NameBoxSignUp.Text, EmailBoxSignUp.Text, EasyEncryption.MD5.ComputeMD5Hash(PasswordBoxSignUp.Text), false, null, 20)) //account's creation
                    {
                        MessageBox.Show("Utente creato.", "Loggati pure.", MessageBoxButtons.OK);                                                                    //affermative message
                    }
                    else
                    {
                        MessageBox.Show("Sicuro?", "Temo che ci sia qualcosa che non va.", MessageBoxButtons.OK); //negative message
                    }
                }
                else // if the Email isin't valid the program show an errore message
                {
                    MessageBox.Show("Sicuro?", "Controlla l'email.", MessageBoxButtons.OK);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Errore nella connessione al server.", "Proprio non riesco.", MessageBoxButtons.OK);
            }
        }