Пример #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();
                }
            }
        }
Пример #2
0
        private void AddUser_Click(object sender, RoutedEventArgs e)
        {
            DatabaseAdminUserWindow dialog = new DatabaseAdminUserWindow();

            dialog.ShowDialog();

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

                if (DatabaseHandler.AddUser(user, dialog.GetIsUserAdmin()))
                {
                    GetUsers();
                }
            }
        }