Exemplo n.º 1
0
        // 更改用户信息按钮
        private void OnEditUser(object sender, RoutedEventArgs e)
        {
            if (allUserListView.SelectedItem == null)
            {
                MessageBox.Show("请选中要修改的数据行!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            User thisUser = (User)allUserListView.SelectedItem;

            if (thisUser == null)
            {
                MessageBox.Show("请选中要修改的数据行!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            if (MainWindow.myAuthority <= thisUser.Authority && MainWindow.myUsername != thisUser.UserName)
            {
                MessageBox.Show("权限不够!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            EditUser edit = new EditUser(thisUser);

            edit.Owner = this;
            edit.Title = "修改用户信息";
            edit.Show();
        }
Exemplo n.º 2
0
        // 添加用户按钮
        private void OnAddUser(object sender, RoutedEventArgs e)
        {
            //AddUser add = new AddUser();
            //add.Owner = this;
            //add.Show();
            EditUser add = new EditUser();

            add.Owner = this;
            add.Title = "添加新用户";
            add.Show();
        }