Beispiel #1
0
        private void EditUser_Click(object sender, RoutedEventArgs e)
        {
            if (UsersBox.SelectedItem != null)
            {
                DatabaseUser blankuser = new DatabaseUser()
                {
                    Name = (string)UsersBox.SelectedItem
                };

                blankuser = DatabaseHandler.GetUserInfo(blankuser);


                DatabaseAdminUserWindow dialog = new DatabaseAdminUserWindow(blankuser.Name, blankuser.Fullname, blankuser.Email, blankuser.Expertise);
                dialog.ShowDialog();

                if (dialog.DialogResult == true)
                {
                    DatabaseUser user = new DatabaseUser()
                    {
                        Name      = dialog.GetName(),
                        Fullname  = dialog.GetFullName(),
                        Email     = dialog.Getemail(),
                        Expertise = dialog.GetExpertise(),
                        Password  = dialog.GetPassword()
                    };

                    DatabaseHandler.ChangeUserCustomData(user);

                    if (user.Password != "")
                    {
                        if (DatabaseHandler.ChangeUserPassword(user))
                        {
                        }
                    }

                    GetUsers();
                }
            }
        }
Beispiel #2
0
        private void DatabasePassMenu_Click(object sender, RoutedEventArgs e)
        {
            DatabaseUser blankuser = new DatabaseUser()
            {
                Name = Properties.Settings.Default.MongoDBUser
            };

            blankuser = DatabaseHandler.GetUserInfo(blankuser);

            DatabaseUserManageWindow dialog = new DatabaseUserManageWindow(blankuser.Name, blankuser.Fullname, blankuser.Email, blankuser.Expertise);

            dialog.ShowDialog();

            if (dialog.DialogResult == true)
            {
                DatabaseUser user = new DatabaseUser()
                {
                    Name      = dialog.GetName(),
                    Fullname  = dialog.GetFullName(),
                    Password  = dialog.GetPassword(),
                    Email     = dialog.Getemail(),
                    Expertise = dialog.GetExpertise()
                };

                DatabaseHandler.ChangeUserCustomData(user);

                if (user.Password != "" && user.Password != null)
                {
                    if (DatabaseHandler.ChangeUserPassword(user))
                    {
                        MessageBox.Show("Password Change successful!");
                        Properties.Settings.Default.MongoDBPass = MainHandler.Encode(user.Password);
                        databaseConnect();
                    }
                }
            }
        }