Esempio n. 1
0
        // Change the username; pUser should contain the new username! Change it later?
        public Boolean databaseOperation(user pUser, string pConnectionString)
        {
            var connection = new SQLiteConnection(pConnectionString);

            connection.Open();

            Database db = new DB.Database(@"URI=file:C:\Users\Michael Distler\source\repos\WPF_Login\test.db");

            // Check if username already exists
            if (db.userMgt(pUser, "CheckUserNameExists"))
            {
                return(false);
            }
            else
            {
                var command = new SQLiteCommand(connection);
                command.CommandText = "UPDATE user SET user_name = @user_name WHERE user_id = @user_id";
                command.Parameters.AddWithValue("@user_name", pUser.getName());
                command.Parameters.AddWithValue("@user_id", pUser.getID());
                command.Prepare();

                command.ExecuteNonQuery();

                connection.Close();

                return(true);
            }
        }
Esempio n. 2
0
        private void btnNewPassword_Click(object sender, RoutedEventArgs e)
        {
            user currentUser = (user)App.Current.Properties["currentUser"];

            currentUser.setPassword(tboxNewPassword.Text);

            DB.Database db = new DB.Database(@"URI=file:C:\Users\Michael Distler\source\repos\WPF_Login\test.db");

            db.userMgt(currentUser, "ChangePassword"); // SPÄTER ERSETZEN
            //if(db.userMgt(currentUser, "ChangeUsername"))
            //{
            //    MELDUNG ÜBER NEUES LABEL
            //}
        }