Esempio n. 1
0
        private void btnAddNewUser_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (!this._isNewUsernameValid())
            {
                return;
            }
            if (!this._isNewUserPasswordValid())
            {
                return;
            }
            if (!this._isNewUserConfirmationPasswordValid())
            {
                return;
            }

            // validations done; let's create a new user account
            User user = new User(txtNewUserUsername.Text, txtNewUserPassword.Password);

            if (ConfigurationManager.AddUser(user))
            {
                txtLoginUsername.Text    = user.Username;
                pbLoginPassword.Password = "";

                this.btnCancelAddNewUser_Click(sender, e);
            }
            else
            {
                MessageBox.Show("Unable to add the user to the system. Please, try again");
            }
        }