コード例 #1
0
        private async void signUpButton_Click(object sender, RoutedEventArgs e)
        {
            String password        = PasswordNew.Password;
            String confirmPassword = ConfirmPasswordNew.Password;

            handleDatabase = new HandleDatabase();

            if (Employee.IsChecked == true)
            {
                accountType = "Employee";
            }
            else
            {
                accountType = "Admin";
            }
            try
            {
                int affectedLines = handleDatabase.createUser(userNameNew, password, accountType);

                if (affectedLines > 0)
                {
                    await this.ShowMessageAsync("Profile Created", "Your Profile has been Successfully Created", MessageDialogStyle.Affirmative);

                    UserNameNew.Text            = "";
                    PasswordNew.Password        = "";
                    ConfirmPasswordNew.Password = "";
                    SignControl.SelectedIndex   = 0;
                }
                else
                {
                    await this.ShowMessageAsync("Profile Not Created", "Sorry Can not Create the Profile, Please Try again", MessageDialogStyle.Affirmative);

                    UserNameNew.Text            = "";
                    PasswordNew.Password        = "";
                    ConfirmPasswordNew.Password = "";
                }
            }
            catch (SqlException sqlException)
            {
                Console.WriteLine(sqlException);
            }
        }